Fix T58694 Eevee: Wrong result when using normal map and face is flipped
This commit is contained in:
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)
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue