Fix T58694 Eevee: Wrong result when using normal map and face is flipped

This commit is contained in:
Clément Foucault 2019-03-13 23:42:38 +01:00
parent bf8a414237
commit 81531d452c
Notes: blender-bot 2023-02-14 06:54:28 +01:00
Referenced by issue #58694, Wrong result when using normal map and face normal is flipped (Eevee)
1 changed files with 3 additions and 3 deletions

View File

@ -2971,9 +2971,9 @@ void node_normal_map(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 outnorm
outnormal = normal;
return;
}
tangent.xyz = normalize(tangent.xyz);
vec3 B = tangent.w * cross(normal, tangent.xyz);
float fsign = (gl_FrontFacing ? 1.0 : -1.0);
tangent.xyz = normalize(tangent.xyz) * fsign;
vec3 B = tangent.w * cross(normal, tangent.xyz) * fsign;
outnormal = texnormal.x * tangent.xyz + texnormal.y * B + texnormal.z * normal;
outnormal = normalize(outnormal);