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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-02 21:03:46 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-05-02 21:03:46 +0400
commitd64661b5078cd4781bd58fce6fadedac511c4132 (patch)
tree08abb98017e41cd6f7bfbd1f2ca87a2166f91eea /intern/cycles/render/nodes.cpp
parent89f554fd24abb6c3986090933f771da267345b96 (diff)
Cycles: add Ray Length output to Light Path node. This gives the distance travelled
by the last light ray. One use case for this might be to do absorption. Patch #31232 by Agustin benavidez, see this blog post for details: http://agus3d.blogspot.com.ar/2012/05/blender-cycles-ray-length-node-output.html
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r--intern/cycles/render/nodes.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 7039f5b6412..fd26c552f21 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1623,6 +1623,7 @@ LightPathNode::LightPathNode()
add_output("Is Singular Ray", SHADER_SOCKET_FLOAT);
add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT);
add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT);
+ add_output("Ray Length", SHADER_SOCKET_FLOAT);
}
void LightPathNode::compile(SVMCompiler& compiler)
@@ -1671,6 +1672,13 @@ void LightPathNode::compile(SVMCompiler& compiler)
compiler.stack_assign(out);
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_transmission, out->stack_offset);
}
+
+ out = output("Ray Length");
+ if(!out->links.empty()) {
+ compiler.stack_assign(out);
+ compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, out->stack_offset);
+ }
+
}
void LightPathNode::compile(OSLCompiler& compiler)