]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/cooktorrance.glsl
Avoid emitting duplicate specialization constants in SPIR-V
[libs/gl.git] / shaderlib / cooktorrance.glsl
index 79f88f6475db747479996e81c73079de8d1106bd..ff1a56c7c237e240ebd7cb4c69df8a7ce24a36ba 100644 (file)
@@ -74,7 +74,8 @@ virtual vec3 get_emission_color()
 /* Computes the diffuse reflection of the macrosurface */
 vec3 lambert_diffuse(vec3 base_color)
 {
-       // Scale by pi to get a result per steradian, suitable for integration
+       /* Scale by pi (cosine-weighted area of a hemisphere) because the light
+       scatters in every direction */
        return base_color/PI;
 }
 
@@ -156,7 +157,7 @@ vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metaln
                if(light_sources[i].type!=0)
                {
                        IncomingLight incoming = get_incoming_light(i, world_vertex.xyz);
-                       float shadow = get_shadow_factor(i);
+                       float shadow = get_shadow_factor(i, world_vertex);
                        color += cooktorrance_one_light_direct(normal, look, incoming.direction, base_color, metalness, roughness)*incoming.color*shadow;
                }