]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/cooktorrance.glsl
Only apply ambient occlusion to the ambient lighting component
[libs/gl.git] / 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();