diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-17 17:36:29 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-17 17:39:09 +0300 |
commit | a43d00d51e15a311dfab1b87c7c9065f4081e625 (patch) | |
tree | 34dc99f42a756f16578b6843a59f4ccaaa5e12b0 /intern/cycles | |
parent | dd38dce7f0ae604396d1e96bc49500369fdedf29 (diff) |
Cycles: Fix displacement code creating cyclic dependencies in graph
Bump result was passed to set_normal node and then set_node was connected
to all unconnected Normal inputs, including the one from original Bump
node, causing cycles.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/render/graph.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 9896eaba89b..5b81a2ccb9e 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -727,10 +727,18 @@ void ShaderGraph::bump_from_displacement() /* connect bump output to normal input nodes that aren't set yet. actually * this will only set the normal input to the geometry node that we created * and connected to all other normal inputs already. */ - foreach(ShaderNode *node, nodes) - foreach(ShaderInput *input, node->inputs) + foreach(ShaderNode *node, nodes) { + /* Don't connect normal to the bump node we're coming from, + * otherwise it'll be a cycle in graph. + */ + if(node == bump) { + continue; + } + foreach(ShaderInput *input, node->inputs) { if(!input->link && input->default_value == ShaderInput::NORMAL) connect(set_normal->output("Normal"), input); + } + } /* for displacement bump, clear the normal input in case the above loop * connected the setnormal out to the bump normalin */ |