This makes objects which are "behind" the shadow map volume sample the
shadow map correctly and not treat the clear value as a shadow caster.
return 1.0;
vec4 region = shadows[index].region;
- float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, shadow_coord.z));
+ float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, min(shadow_coord.z, 1.0)));
return mix(1.0, shadow_sample, shadows[index].darkness);
}
else