From: Mikko Rasa Date: Sat, 24 Apr 2021 12:12:50 +0000 (+0300) Subject: Don't apply shadows outside the shadowmap's range X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e98956208676c77e74462f17932ac530077a0540;p=libs%2Fgl.git Don't apply shadows outside the shadowmap's range --- diff --git a/shaderlib/shadow.glsl b/shaderlib/shadow.glsl index f168fe79..f0338b95 100644 --- a/shaderlib/shadow.glsl +++ b/shaderlib/shadow.glsl @@ -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); }