aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorDmitry Kostenko <codeforsmile@gmail.com>2021-11-10 00:31:02 +0100
committerx2048 <codeforsmile@gmail.com>2022-03-07 23:45:26 +0100
commita684a91bf5ef01dfeb05de517f3550b26ff45995 (patch)
tree9ad06bda711a52753a623d14e241a60ca60cc8af /client
parent1175f48d05888fba705363729ecf5ef2c75f0c5d (diff)
downloadminetest-a684a91bf5ef01dfeb05de517f3550b26ff45995.tar.gz
minetest-a684a91bf5ef01dfeb05de517f3550b26ff45995.tar.bz2
minetest-a684a91bf5ef01dfeb05de517f3550b26ff45995.zip
Fix shadow rendering with filtering disabled
Diffstat (limited to 'client')
-rw-r--r--client/shaders/nodes_shader/opengl_fragment.glsl3
-rw-r--r--client/shaders/object_shader/opengl_fragment.glsl3
2 files changed, 6 insertions, 0 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl
index d3194090c..55c3feac7 100644
--- a/client/shaders/nodes_shader/opengl_fragment.glsl
+++ b/client/shaders/nodes_shader/opengl_fragment.glsl
@@ -187,6 +187,9 @@ float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDist
if (PCFBOUND == 0.0) return 0.0;
// Return fast if sharp shadows are requested
+ if (PCFBOUND == 0.0)
+ return 0.0;
+
if (SOFTSHADOWRADIUS <= 1.0) {
perspectiveFactor = getDeltaPerspectiveFactor(baseLength);
return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS);
diff --git a/client/shaders/object_shader/opengl_fragment.glsl b/client/shaders/object_shader/opengl_fragment.glsl
index 0dcbbd321..3cbf4347a 100644
--- a/client/shaders/object_shader/opengl_fragment.glsl
+++ b/client/shaders/object_shader/opengl_fragment.glsl
@@ -181,6 +181,9 @@ float getPenumbraRadius(sampler2D shadowsampler, vec2 smTexCoord, float realDist
float perspectiveFactor;
// Return fast if sharp shadows are requested
+ if (PCFBOUND == 0.0)
+ return 0.0;
+
if (SOFTSHADOWRADIUS <= 1.0) {
perspectiveFactor = getDeltaPerspectiveFactor(baseLength);
return max(2 * length(smTexCoord.xy) * 2048 / f_textureresolution / pow(perspectiveFactor, 3), SOFTSHADOWRADIUS);