aboutsummaryrefslogtreecommitdiff
path: root/client/shaders/nodes_shader
diff options
context:
space:
mode:
authorDmitry Kostenko <codeforsmile@gmail.com>2022-01-22 17:18:27 +0100
committerx2048 <codeforsmile@gmail.com>2022-01-22 18:52:12 +0100
commit71317b8579385142c2a1cbad70a68cf661408855 (patch)
treedc1df70617d3657c6550d24b09066b3affb1a008 /client/shaders/nodes_shader
parentf8cef52ea07de6a6ccaa6f9a853a8e5ccaaff4ce (diff)
downloadminetest-71317b8579385142c2a1cbad70a68cf661408855.tar.gz
minetest-71317b8579385142c2a1cbad70a68cf661408855.tar.bz2
minetest-71317b8579385142c2a1cbad70a68cf661408855.zip
Make sure nightRatio is always greater than zero.
To avoid underfined behavior of GLSL pow()
Diffstat (limited to 'client/shaders/nodes_shader')
-rw-r--r--client/shaders/nodes_shader/opengl_fragment.glsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl
index 9ee88eb39..762a676c6 100644
--- a/client/shaders/nodes_shader/opengl_fragment.glsl
+++ b/client/shaders/nodes_shader/opengl_fragment.glsl
@@ -512,7 +512,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);
if (f_normal_length != 0 && cosLight < 0.035) {
shadow_int = max(shadow_int, 1 - clamp(cosLight, 0.0, 0.035)/0.035);