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:
authorLukas Stockner <lukas.stockner@freenet.de>2016-09-03 23:40:07 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-09-09 02:39:09 +0300
commit1558f5b6602ebe8ba31455b1837b2594d5c7f264 (patch)
tree7cc89f0098577099d916e4f3e27d2e2885444252 /intern/cycles/render/shader.h
parent6de08f6cd1cb9e50736a0a43bf37d621c6eb2b87 (diff)
Cycles: Don't run full shader evaluation for constant emission lamps
Most of the time, Lamps in Cycles are just a constant emission closure, no texturing etc. Therefore, running a full shader evaluation is wasteful. To avoid that, Cycles now detects these constant emission shaders and stores their value in the lamp data along with a flag in the shader. Then, at runtime, if this flag is set, the lamp code just uses this value and only runs the full shader evaluation if it is neccessary. In scenes with a lot of lamps and with "Sample all direct/indirect" enabled, this saves up to 20% of rendering time in my tests. Reviewers: #cycles Differential Revision: https://developer.blender.org/D2193
Diffstat (limited to 'intern/cycles/render/shader.h')
-rw-r--r--intern/cycles/render/shader.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 696e22bc3c9..7d896652196 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -139,6 +139,10 @@ public:
Shader();
~Shader();
+ /* Checks whether the shader consists of just a emission node with fixed inputs that's connected directly to the output.
+ * If yes, it sets the content of emission to the constant value (color * strength), which is then used for speeding up light evaluation. */
+ bool is_constant_emission(float3* emission);
+
void set_graph(ShaderGraph *graph);
void tag_update(Scene *scene);
void tag_used(Scene *scene);