From: Mikko Rasa Date: Sun, 25 Sep 2022 17:15:03 +0000 (+0300) Subject: Only apply ambient occlusion to the ambient lighting component X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=afffed5bf161b5972a02f055225701118ed5a4e7;p=libs%2Fgl.git Only apply ambient occlusion to the ambient lighting component --- diff --git a/shaderlib/cooktorrance.glsl b/shaderlib/cooktorrance.glsl index 8a69d473..25289ed5 100644 --- a/shaderlib/cooktorrance.glsl +++ b/shaderlib/cooktorrance.glsl @@ -164,9 +164,8 @@ vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metaln color += cooktorrance_one_light_direct(normal, look, incoming.direction, base_color, metalness, roughness)*incoming.color*shadow; } - color += cooktorrance_environment(normal, look, base_color, metalness, roughness); - - color *= get_occlusion_value(); + float occlusion = get_occlusion_value(); + color += cooktorrance_environment(normal, look, base_color, metalness, roughness)*occlusion; if(use_emission) color += get_emission_color();