From f6107af4cf4d907495e2e9c18e5866fd1d420650 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Feb 2018 14:32:38 +0100 Subject: Cycles: change Index output of Hair and Particle Info to Random, in 0..1 range. These are used for randomization, so it's convenient if the index is already hashed and consistent with the Object Info node. --- intern/cycles/render/nodes.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'intern/cycles/render/nodes.cpp') diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index d2a03ceb76a..44c807065e4 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -3463,7 +3463,7 @@ NODE_DEFINE(ParticleInfoNode) { NodeType* type = NodeType::add("particle_info", create, NodeType::SHADER); - SOCKET_OUT_FLOAT(index, "Index"); + SOCKET_OUT_FLOAT(random, "Random"); SOCKET_OUT_FLOAT(age, "Age"); SOCKET_OUT_FLOAT(lifetime, "Lifetime"); SOCKET_OUT_POINT(location, "Location"); @@ -3484,7 +3484,7 @@ ParticleInfoNode::ParticleInfoNode() void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes) { - if(!output("Index")->links.empty()) + if(!output("Random")->links.empty()) attributes->add(ATTR_STD_PARTICLE); if(!output("Age")->links.empty()) attributes->add(ATTR_STD_PARTICLE); @@ -3510,9 +3510,9 @@ void ParticleInfoNode::compile(SVMCompiler& compiler) { ShaderOutput *out; - out = output("Index"); + out = output("Random"); if(!out->links.empty()) { - compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_INDEX, compiler.stack_assign(out)); + compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_RANDOM, compiler.stack_assign(out)); } out = output("Age"); @@ -3572,7 +3572,7 @@ NODE_DEFINE(HairInfoNode) #if 0 /*output for minimum hair width transparency - deactivated */ SOCKET_OUT_FLOAT(fade, "Fade"); #endif - SOCKET_OUT_FLOAT(index, "Index"); + SOCKET_OUT_FLOAT(index, "Random"); return type; } @@ -3590,8 +3590,8 @@ void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes) if(!intercept_out->links.empty()) attributes->add(ATTR_STD_CURVE_INTERCEPT); - if(!output("Index")->links.empty()) - attributes->add(ATTR_STD_CURVE_INDEX); + if(!output("Random")->links.empty()) + attributes->add(ATTR_STD_CURVE_RANDOM); } ShaderNode::attributes(shader, attributes); @@ -3627,9 +3627,9 @@ void HairInfoNode::compile(SVMCompiler& compiler) compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_FADE, compiler.stack_assign(out)); }*/ - out = output("Index"); + out = output("Random"); if(!out->links.empty()) { - int attr = compiler.attribute(ATTR_STD_CURVE_INDEX); + int attr = compiler.attribute(ATTR_STD_CURVE_RANDOM); compiler.add_node(NODE_ATTR, attr, compiler.stack_assign(out), NODE_ATTR_FLOAT); } } -- cgit v1.2.3