diff options
author | x2048 <codeforsmile@gmail.com> | 2021-07-25 12:35:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-25 12:35:12 +0200 |
commit | ff2d2a6e93d75d24b3f69f2b3690bcac6440961e (patch) | |
tree | 8984d4f75d852f07b3cd66fc217febc5603dfd06 | |
parent | 5d27cc50968260db5cf34726c88dbbc5ed27c941 (diff) | |
download | minetest-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.glsl | 4 |
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); |