]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Ensure nightRatio is greater than zero in object shader
authorDmitry Kostenko <codeforsmile@gmail.com>
Sun, 13 Feb 2022 18:45:34 +0000 (19:45 +0100)
committerx2048 <codeforsmile@gmail.com>
Mon, 7 Mar 2022 22:45:26 +0000 (23:45 +0100)
client/shaders/object_shader/opengl_fragment.glsl

index 3cbf4347a1e9ff3e417049ec1c602f630d0fcd8e..e1d7a3574015f010e69741c90aa2e91879715ea9 100644 (file)
@@ -508,7 +508,7 @@ void main(void)
        // turns out that nightRatio falls off much faster than
        // actual brightness of artificial light in relation to natual light.
        // Power ratio was measured on torches in MTG (brightness = 14).
-       float adjusted_night_ratio = pow(nightRatio, 0.6);
+       float adjusted_night_ratio = pow(max(0.0, nightRatio), 0.6);
 
        // cosine of the normal-to-light angle when
        // we start to apply self-shadowing