summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorNick Hahn <nick.hahn@hotmail.de>2018-08-12 12:45:43 +0200
committerNick Hahn <nick.hahn@hotmail.de>2018-08-12 12:45:43 +0200
commit66eba18969587762044825922e4a761c393583a6 (patch)
treed8502025640c924dd3a5938d49f4b2e67662103d /drivers/gles3
parent64595f0f6ad2aab38fb14f85c077c6e147326624 (diff)
Fix handling of normals that approach 1
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shaders/scene.glsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index dee8bcbc58..2d6f42679f 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1700,7 +1700,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)); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
+ normalmap.z=sqrt(max(0.0, 1.0-dot(normalmap.xy,normalmap.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
normal = normalize( mix(normal_interp,tangent * normalmap.x + binormal * normalmap.y + normal * normalmap.z,normaldepth) ) * side;