Fix handling of normals that approach 1
This commit is contained in:
parent
64595f0f6a
commit
66eba18969
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue