Fix #109679: incorrect handling of negative Z normal maps after recent fix
Implement clamped scaling on the Z-axis, so that strength zero means the normal map has no effect. Ref #109763
This commit is contained in:
committed by
Brecht Van Lommel
parent
5b80d9bbaf
commit
5a9128af25
@@ -39,6 +39,7 @@ shader node_normal_map(float Strength = 1.0,
|
||||
/* apply strength */
|
||||
mcolor[0] *= Strength;
|
||||
mcolor[1] *= Strength;
|
||||
mcolor[2] = mix(1.0, mcolor[2], clamp(Strength, 0.0, 1.0));
|
||||
|
||||
Normal = normalize(mcolor[0] * tangent + mcolor[1] * B + mcolor[2] * ninterp);
|
||||
|
||||
|
||||
@@ -316,6 +316,7 @@ ccl_device_noinline void svm_node_normal_map(KernelGlobals kg,
|
||||
/* Apply strength in the tangent case. */
|
||||
color.x *= strength;
|
||||
color.y *= strength;
|
||||
color.z = mix(1.0f, color.z, saturatef(strength));
|
||||
|
||||
/* apply normal map */
|
||||
float3 B = sign * cross(normal, tangent);
|
||||
|
||||
@@ -11,6 +11,7 @@ void node_normal_map(vec4 tangent, float strength, vec3 texnormal, out vec3 outn
|
||||
|
||||
/* Apply strength here instead of in node_normal_map_mix for tangent space. */
|
||||
texnormal.xy *= strength;
|
||||
texnormal.z = mix(1.0, texnormal.z, saturate(strength));
|
||||
|
||||
outnormal = texnormal.x * tangent.xyz + texnormal.y * B + texnormal.z * g_data.Ni;
|
||||
outnormal = normalize(outnormal);
|
||||
|
||||
Reference in New Issue
Block a user