diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-09-02 07:41:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-14 11:26:20 +0300 |
commit | 2c1201502dcac7c3febd7e09c228b05dd16b4fcd (patch) | |
tree | c5181b85d97ce3220dc9502898f12cdc32560b9d /intern/cycles/render/nodes.cpp | |
parent | b67db67b012d688b3f0b4b1d12c45e33ea2ccaab (diff) |
Cycles: Fix bump mapping to use object space when used with true displacement
Bump mapping was happening in world space while displacement happens in object
space, causing shading errors when displacement type was used with bump mapping.
To fix this the proper transforms are added to bump nodes. This is only done
for automatic bump mapping however, to avoid visual changes from other uses of
bump mapping. It would be nice to do this for all bump mapping to be consistent
but that will have to wait till we can break compatibility.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D2191
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 0304d6d95d1..df43863ea7a 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -4762,6 +4762,7 @@ NODE_DEFINE(BumpNode) NodeType* type = NodeType::add("bump", create, NodeType::SHADER); SOCKET_BOOLEAN(invert, "Invert", false); + SOCKET_BOOLEAN(use_object_space, "UseObjectSpace", false); /* this input is used by the user, but after graph transform it is no longer * used and moved to sampler center/x/y instead */ @@ -4800,7 +4801,8 @@ void BumpNode::compile(SVMCompiler& compiler) compiler.encode_uchar4( compiler.stack_assign_if_linked(normal_in), compiler.stack_assign(distance_in), - invert), + invert, + use_object_space), compiler.encode_uchar4( compiler.stack_assign(center_in), compiler.stack_assign(dx_in), @@ -4812,6 +4814,7 @@ void BumpNode::compile(SVMCompiler& compiler) void BumpNode::compile(OSLCompiler& compiler) { compiler.parameter(this, "invert"); + compiler.parameter(this, "use_object_space"); compiler.add(this, "node_bump"); } |