]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Add smooth light-shadow transition at noon (#11430)
authorx2048 <codeforsmile@gmail.com>
Sun, 25 Jul 2021 10:35:12 +0000 (12:35 +0200)
committerGitHub <noreply@github.com>
Sun, 25 Jul 2021 10:35:12 +0000 (12:35 +0200)
Node faces with normals pointing East/West (+X/-X) will transition between light
and shadow at noon. This code makes the transition smooth.

client/shaders/nodes_shader/opengl_fragment.glsl

index 9f8a21d09127802f2808141d69c6dd04ddcefd13..64a88ebbb28b1626e35632072eb0bd4c5b1a6f84 100644 (file)
@@ -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);