]> git.tdb.fi Git - libs/gl.git/commitdiff
Only apply ambient occlusion to the ambient lighting component
authorMikko Rasa <tdb@tdb.fi>
Sun, 25 Sep 2022 17:15:03 +0000 (20:15 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 25 Sep 2022 17:21:57 +0000 (20:21 +0300)
shaderlib/cooktorrance.glsl

index 8a69d473e83935adf8d8d866b2beab07518e22ea..25289ed57bc916af3eb41a4f9893d99289399618 100644 (file)
@@ -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();