From ff2d2a6e93d75d24b3f69f2b3690bcac6440961e Mon Sep 17 00:00:00 2001 From: x2048 Date: Sun, 25 Jul 2021 12:35:12 +0200 Subject: 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. --- client/shaders/nodes_shader/opengl_fragment.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/shaders/nodes_shader') 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); -- cgit v1.2.3