aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2021-07-25 12:35:12 +0200
committerGitHub <noreply@github.com>2021-07-25 12:35:12 +0200
commitff2d2a6e93d75d24b3f69f2b3690bcac6440961e (patch)
tree8984d4f75d852f07b3cd66fc217febc5603dfd06
parent5d27cc50968260db5cf34726c88dbbc5ed27c941 (diff)
downloadminetest-ff2d2a6e93d75d24b3f69f2b3690bcac6440961e.tar.gz
minetest-ff2d2a6e93d75d24b3f69f2b3690bcac6440961e.tar.bz2
minetest-ff2d2a6e93d75d24b3f69f2b3690bcac6440961e.zip
Add smooth light-shadow transition at noon (#11430)
Node faces with normals pointing East/West (+X/-X) will transition between light and shadow at noon. This code makes the transition smooth.
-rw-r--r--client/shaders/nodes_shader/opengl_fragment.glsl4
1 files changed, 2 insertions, 2 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl
index 9f8a21d09..64a88ebbb 100644
--- a/client/shaders/nodes_shader/opengl_fragment.glsl
+++ b/client/shaders/nodes_shader/opengl_fragment.glsl
@@ -498,8 +498,8 @@ void main(void)
}
- if (f_normal_length != 0 && cosLight < 0.0) {
- shadow_int = clamp(1.0-nightRatio, 0.0, 1.0);
+ if (f_normal_length != 0 && cosLight < 0.035) {
+ shadow_int = max(shadow_int, min(clamp(1.0-nightRatio, 0.0, 1.0), 1 - clamp(cosLight, 0.0, 0.035)/0.035));
}
shadow_int = 1.0 - (shadow_int * f_adj_shadow_strength);