Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2015-11-18 20:47:56 +0300
committerThomas Dinges <blender@dingto.org>2015-11-18 20:47:56 +0300
commit0639ba8ea58bc775bfa3436e1ba9831ece78404d (patch)
treebc58bc54aff60d1c9df408d86eb322df271a3f85 /intern/cycles/render/graph.cpp
parent836c69c92fb5992eb83c4311a98f5ffad4a172f5 (diff)
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.
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp16
1 files changed, 15 insertions, 1 deletions
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<ShaderNode*>& nodes, map<ShaderNode*, ShaderNod
}
}
}
+/* Graph simplification */
+/* ******************** */
+/* Step 1: Remove unused nodes.
+ * Remove nodes which are not needed in the graph, such as proxies,
+ * mix nodes with a factor of 0 or 1, emission shaders without contribution...
+ */
void ShaderGraph::remove_unneeded_nodes()
{
vector<bool> 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<bool>& visited, vector<bool>& 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 */