diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-29 19:47:02 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-29 19:48:22 +0300 |
commit | d2e526a82d5535311b552988a3a0318540a9e494 (patch) | |
tree | 9393c0ab00f25bb8b40128d7b7604d7510c3bdf4 /intern/cycles/kernel/svm | |
parent | a0e8b98b6102ac19f0724b390d9decbc077fcf8f (diff) |
Cycles: Fix for bump node not working with object texture mapping
This was intended to be in the original patch of texco copy from object.
Diffstat (limited to 'intern/cycles/kernel/svm')
-rw-r--r-- | intern/cycles/kernel/svm/svm.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_tex_coord.h | 52 |
2 files changed, 46 insertions, 10 deletions
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h index f1dfeb45265..6a673d318f3 100644 --- a/intern/cycles/kernel/svm/svm.h +++ b/intern/cycles/kernel/svm/svm.h @@ -399,10 +399,10 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, Shade break; #ifdef __EXTRA_NODES__ case NODE_TEX_COORD_BUMP_DX: - svm_node_tex_coord_bump_dx(kg, sd, path_flag, stack, node.y, node.z); + svm_node_tex_coord_bump_dx(kg, sd, path_flag, stack, node, &offset); break; case NODE_TEX_COORD_BUMP_DY: - svm_node_tex_coord_bump_dy(kg, sd, path_flag, stack, node.y, node.z); + svm_node_tex_coord_bump_dy(kg, sd, path_flag, stack, node, &offset); break; case NODE_CLOSURE_SET_NORMAL: svm_node_set_normal(kg, sd, stack, node.y, node.z ); diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h index dcaa488ed31..a399acf3c0f 100644 --- a/intern/cycles/kernel/svm/svm_tex_coord.h +++ b/intern/cycles/kernel/svm/svm_tex_coord.h @@ -99,16 +99,34 @@ ccl_device void svm_node_tex_coord(KernelGlobals *kg, stack_store_float3(stack, out_offset, data); } -ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint type, uint out_offset) +ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, + ShaderData *sd, + int path_flag, + float *stack, + uint4 node, + int *offset) { #ifdef __RAY_DIFFERENTIALS__ float3 data; + uint type = node.y; + uint out_offset = node.z; switch(type) { case NODE_TEXCO_OBJECT: { data = sd->P + sd->dP.dx; - if(sd->object != OBJECT_NONE) - object_inverse_position_transform(kg, sd, &data); + if(node.w == 0) { + if(sd->object != OBJECT_NONE) { + object_inverse_position_transform(kg, sd, &data); + } + } + else { + Transform tfm; + tfm.x = read_node_float(kg, offset); + tfm.y = read_node_float(kg, offset); + tfm.z = read_node_float(kg, offset); + tfm.w = read_node_float(kg, offset); + data = transform_point(&tfm, data); + } break; } case NODE_TEXCO_NORMAL: { @@ -162,20 +180,38 @@ ccl_device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, in stack_store_float3(stack, out_offset, data); #else - svm_node_tex_coord(kg, sd, stack, type, out_offset); + svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); #endif } -ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, int path_flag, float *stack, uint type, uint out_offset) +ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, + ShaderData *sd, + int path_flag, + float *stack, + uint4 node, + int *offset) { #ifdef __RAY_DIFFERENTIALS__ float3 data; + uint type = node.y; + uint out_offset = node.z; switch(type) { case NODE_TEXCO_OBJECT: { data = sd->P + sd->dP.dy; - if(sd->object != OBJECT_NONE) - object_inverse_position_transform(kg, sd, &data); + if(node.w == 0) { + if(sd->object != OBJECT_NONE) { + object_inverse_position_transform(kg, sd, &data); + } + } + else { + Transform tfm; + tfm.x = read_node_float(kg, offset); + tfm.y = read_node_float(kg, offset); + tfm.z = read_node_float(kg, offset); + tfm.w = read_node_float(kg, offset); + data = transform_point(&tfm, data); + } break; } case NODE_TEXCO_NORMAL: { @@ -229,7 +265,7 @@ ccl_device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, in stack_store_float3(stack, out_offset, data); #else - svm_node_tex_coord(kg, sd, stack, type, out_offset); + svm_node_tex_coord(kg, sd, path_flag, stack, node, offset); #endif } |