From 85c18f1033952f2186432cdb62214501443611ef Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 6 Sep 2019 10:57:54 -0700 Subject: [PATCH] Adding a clamp to 0 to the computed y coordinate while unpacking the normal map --- libraries/graphics/src/graphics/MaterialTextures.slh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/graphics/src/graphics/MaterialTextures.slh b/libraries/graphics/src/graphics/MaterialTextures.slh index bf0416c7bf..278057b01a 100644 --- a/libraries/graphics/src/graphics/MaterialTextures.slh +++ b/libraries/graphics/src/graphics/MaterialTextures.slh @@ -111,7 +111,7 @@ vec3 fetchNormalMap(vec2 uv) { // unpack normal, swizzle to get into hifi tangent space with Y axis pointing out vec2 t = 2.0 * (texture(normalMap, uv, TAA_TEXTURE_LOD_BIAS).rg - vec2(0.5, 0.5)); vec2 t2 = t*t; - return vec3(t.x, sqrt(1.0 - t2.x - t2.y), t.y); + return vec3(t.x, sqrt(max(0.0, 1.0 - t2.x - t2.y)), t.y); } <@endif@>