X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fcooktorrance.glsl;h=ff1a56c7c237e240ebd7cb4c69df8a7ce24a36ba;hb=3054756d04a94ec9471448970421de4a7aa7b247;hp=79f88f6475db747479996e81c73079de8d1106bd;hpb=4d276c9b986b111611b8396f94dae56dbe736387;p=libs%2Fgl.git diff --git a/shaderlib/cooktorrance.glsl b/shaderlib/cooktorrance.glsl index 79f88f64..ff1a56c7 100644 --- a/shaderlib/cooktorrance.glsl +++ b/shaderlib/cooktorrance.glsl @@ -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; }