From e98956208676c77e74462f17932ac530077a0540 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 24 Apr 2021 15:12:50 +0300 Subject: [PATCH] Don't apply shadows outside the shadowmap's range --- shaderlib/shadow.glsl | 2 ++ 1 file changed, 2 insertions(+) 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); } -- 2.43.0