From 0639ba8ea58bc775bfa3436e1ba9831ece78404d Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 18 Nov 2015 18:47:56 +0100 Subject: Cycles / Shader graph: Fallback to Sharp closures for very small roughness. We fallback to Sharp closures for Glossy, Glass and Refraction nodes now, in case the Roughness input is disconnected and 0 (< 1e-4f to be exact). This way we gain a few percentages of performance, in case the user did not manually set the closure type to "Sharp" in the UI. Sharp will probably be removed from the UI as a followup, not needed anymore with this internal optimization. Original idea by Lukas Stockner(Differential Revision: https://developer.blender.org/D1439), code implementation by myself. --- intern/cycles/render/graph.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'intern/cycles/render/graph.cpp') diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index a342eaed373..6a9b7244ced 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -354,7 +354,13 @@ void ShaderGraph::copy_nodes(set& nodes, map removed(num_node_ids, false); @@ -550,6 +556,14 @@ void ShaderGraph::remove_unneeded_nodes() } } +/* Step 3: Simplification.*/ +void ShaderGraph::simplify_nodes() +{ + foreach(ShaderNode *node, nodes) { + node->optimize(); + } +} + void ShaderGraph::break_cycles(ShaderNode *node, vector& visited, vector& on_stack) { visited[node->id] = true; @@ -590,7 +604,7 @@ void ShaderGraph::clean() /* TODO(dingto): Implement */ /* 3: Simplification. */ - /* TODO(dingto): Implement */ + simplify_nodes(); /* 4: De-duplication. */ /* TODO(dingto): Implement */ -- cgit v1.2.3