]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/shadow.glsl
Don't apply shadows outside the shadowmap's range
[libs/gl.git] / shaderlib / shadow.glsl
index f168fe7955431869b25f90b8909192453929bcd0..f0338b95f8a10c1f0a9ced28210d59fb345e5d4d 100644 (file)
@@ -21,6 +21,8 @@ virtual float get_shadow_factor(int index)
 {
        if(use_shadow_map)
        {
+               if(shadow_coord.x<0 || shadow_coord.x>1 || shadow_coord.y<0 || shadow_coord.y>1)
+                       return 1.0;
                float shadow_sample = texture(shadow_map, shadow_coord);
                return mix(1.0, shadow_sample, shadow_darkness);
        }