From 7e71be261bb88d0a7c1dcef7b19995317fdb51ef Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 20 Nov 2015 18:18:27 +0500 Subject: Cycles: Fix filter glossy being broken after recent changes Basically we can not use sharp closure as a substitude when filter glossy is used. This is because we can not blur sharp reflection/refraction. This is quite quick and not really clean implementation. Not really happy with manual handling of original settings, but this is as good as we can do in the quick patch. It's a good acknowledgment and we now can re-consider some aspects of graph simplification to make such cases more natively supported. P.S. This failure would have been shown by our regression tests, so please, bother a bit to run Cycles's test sweep before doing such optimizations. --- intern/cycles/render/graph.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'intern/cycles/render/graph.cpp') diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 749640040f5..7e6e960d585 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -266,7 +266,10 @@ void ShaderGraph::relink(vector inputs, vector outpu } } -void ShaderGraph::finalize(bool do_bump, bool do_osl) +void ShaderGraph::finalize(Scene *scene, + bool do_bump, + bool do_osl, + bool do_simplify) { /* before compiling, the shader graph may undergo a number of modifications. * currently we set default geometry shader inputs, and create automatic bump @@ -274,7 +277,7 @@ void ShaderGraph::finalize(bool do_bump, bool do_osl) * modified afterwards. */ if(!finalized) { - clean(); + clean(scene); default_inputs(do_osl); refine_bump_nodes(); @@ -293,6 +296,9 @@ void ShaderGraph::finalize(bool do_bump, bool do_osl) finalized = true; } + else if(do_simplify) { + simplify_nodes(scene); + } } void ShaderGraph::find_dependencies(set& dependencies, ShaderInput *input) @@ -557,10 +563,10 @@ void ShaderGraph::remove_unneeded_nodes() } /* Step 3: Simplification.*/ -void ShaderGraph::simplify_nodes() +void ShaderGraph::simplify_nodes(Scene *scene) { foreach(ShaderNode *node, nodes) { - node->optimize(); + node->optimize(scene); } } @@ -588,7 +594,7 @@ void ShaderGraph::break_cycles(ShaderNode *node, vector& visited, vectorid] = false; } -void ShaderGraph::clean() +void ShaderGraph::clean(Scene *scene) { /* Graph simplification: * 1: Remove unnecesarry nodes @@ -604,7 +610,7 @@ void ShaderGraph::clean() /* TODO(dingto): Implement */ /* 3: Simplification. */ - simplify_nodes(); + simplify_nodes(scene); /* 4: De-duplication. */ /* TODO(dingto): Implement */ -- cgit v1.2.3