[Bf-blender-cvs] [a43d00d] master: Cycles: Fix displacement code creating cyclic dependencies in graph
Sergey Sharybin
noreply at git.blender.org
Tue Mar 17 15:39:37 CET 2015
Commit: a43d00d51e15a311dfab1b87c7c9065f4081e625
Author: Sergey Sharybin
Date: Tue Mar 17 19:36:29 2015 +0500
Branches: master
https://developer.blender.org/rBa43d00d51e15a311dfab1b87c7c9065f4081e625
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.
===================================================================
M intern/cycles/render/graph.cpp
===================================================================
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 9896eab..5b81a2c 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 */
More information about the Bf-blender-cvs
mailing list