diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-20 22:24:40 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-21 19:56:26 +0300 |
commit | 5cc1d5fe17c4d22ae310fc1a74c626c0bb25aef7 (patch) | |
tree | 8a0806ae650f028859a5282617fc8f3b5237af3d /intern | |
parent | 7de387f4b56de3e069cce784c89e520fe77e5f1e (diff) |
Fix T54107: bevel shader + normal map gives wrong result.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/shaders/node_bevel.osl | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_bevel.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/kernel/shaders/node_bevel.osl b/intern/cycles/kernel/shaders/node_bevel.osl index a5b185b6b4c..9c4ca15be17 100644 --- a/intern/cycles/kernel/shaders/node_bevel.osl +++ b/intern/cycles/kernel/shaders/node_bevel.osl @@ -23,9 +23,9 @@ shader node_bevel( output normal NormalOut = N) { /* 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. */ - NormalOut = normalize(N + (NormalOut - NormalIn)); + NormalOut = normalize(NormalIn + (bevel_N - N)); } diff --git a/intern/cycles/kernel/svm/svm_bevel.h b/intern/cycles/kernel/svm/svm_bevel.h index dcfe4ad71b8..6d5a10db98f 100644 --- a/intern/cycles/kernel/svm/svm_bevel.h +++ b/intern/cycles/kernel/svm/svm_bevel.h @@ -216,7 +216,7 @@ ccl_device void svm_node_bevel( if(stack_valid(normal_offset)) { /* Preserve input normal. */ 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); |