Fix #35505: cycles object space normal mapping did not match blender internal.
Now it uses the same (strange) YZ flipping convention.
This commit is contained in:
parent
833ca58260
commit
601b8c1041
@ -55,10 +55,20 @@ shader node_normal_map(
|
||||
Normal = normal(0, 0, 0);
|
||||
}
|
||||
}
|
||||
else if (space == "Object")
|
||||
else if (space == "Object") {
|
||||
/* strange blender convention */
|
||||
mcolor[1] = -mcolor[1];
|
||||
mcolor[2] = -mcolor[2];
|
||||
|
||||
Normal = normalize(transform("object", "world", vector(mcolor)));
|
||||
else if (space == "World")
|
||||
}
|
||||
else if (space == "World") {
|
||||
/* strange blender convention */
|
||||
mcolor[1] = -mcolor[1];
|
||||
mcolor[2] = -mcolor[2];
|
||||
|
||||
Normal = normalize(vector(mcolor));
|
||||
}
|
||||
|
||||
if (Strength != 1.0)
|
||||
Normal = normalize(NormalIn + (Normal - NormalIn) * max(Strength, 0.0));
|
||||
|
@ -276,13 +276,17 @@ __device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *stac
|
||||
object_normal_transform(kg, sd, &N);
|
||||
}
|
||||
else {
|
||||
/* strange blender convention */
|
||||
color.y = -color.y;
|
||||
color.z = -color.z;
|
||||
|
||||
/* object, world space */
|
||||
N = color;
|
||||
|
||||
if(space == NODE_NORMAL_MAP_OBJECT)
|
||||
object_normal_transform(kg, sd, &N);
|
||||
|
||||
N = normalize(N);
|
||||
else
|
||||
N = normalize(N);
|
||||
}
|
||||
|
||||
float strength = stack_load_float(stack, strength_offset);
|
||||
|
@ -2273,6 +2273,11 @@ void node_object_info(out vec3 location, out float object_index, out float mater
|
||||
random = 0.0;
|
||||
}
|
||||
|
||||
void node_normal_map(float strength, vec4 color, vec3 N, out vec3 result)
|
||||
{
|
||||
result = N;
|
||||
}
|
||||
|
||||
void node_bump(float strength, float dist, float height, vec3 N, out vec3 result)
|
||||
{
|
||||
result = N;
|
||||
|
Loading…
Reference in New Issue
Block a user