Fix T54107: bevel shader + normal map gives wrong result.

This commit is contained in:
Brecht Van Lommel 2018-02-20 20:24:40 +01:00
parent 7de387f4b5
commit 5cc1d5fe17
2 changed files with 3 additions and 3 deletions

@ -23,9 +23,9 @@ shader node_bevel(
output normal NormalOut = N) output normal NormalOut = N)
{ {
/* Abuse texture call with special @bevel token. */ /* Abuse texture call with special @bevel token. */
NormalOut = (normal)(color)texture("@bevel", samples, Radius); vector bevel_N = (normal)(color)texture("@bevel", samples, Radius);
/* Preserve input normal. */ /* Preserve input normal. */
NormalOut = normalize(N + (NormalOut - NormalIn)); NormalOut = normalize(NormalIn + (bevel_N - N));
} }

@ -216,7 +216,7 @@ ccl_device void svm_node_bevel(
if(stack_valid(normal_offset)) { if(stack_valid(normal_offset)) {
/* Preserve input normal. */ /* Preserve input normal. */
float3 ref_N = stack_load_float3(stack, normal_offset); float3 ref_N = stack_load_float3(stack, normal_offset);
bevel_N = normalize(sd->N + (bevel_N - ref_N)); bevel_N = normalize(ref_N + (bevel_N - sd->N));;
} }
stack_store_float3(stack, out_offset, bevel_N); stack_store_float3(stack, out_offset, bevel_N);