/* 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;
}
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;
}