From 66eba18969587762044825922e4a761c393583a6 Mon Sep 17 00:00:00 2001 From: Nick Hahn Date: Sun, 12 Aug 2018 12:45:43 +0200 Subject: Fix handling of normals that approach 1 --- drivers/gles2/shaders/scene.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gles2') diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 9251e21080..3e64c92e96 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -526,7 +526,7 @@ FRAGMENT_SHADER_CODE #if defined(ENABLE_NORMALMAP) normalmap.xy = normalmap.xy * 2.0 - 1.0; - normalmap.z = sqrt(1.0 - dot(normalmap.xy, normalmap.xy)); + normalmap.z = sqrt(max(0.0, 1.0 - dot(normalmap.xy, normalmap.xy))); // normal = normalize(mix(normal_interp, tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z, normaldepth)) * side; normal = normalmap; -- cgit v1.2.3