Cycles / Wavelength to RGB node:
* Added a node to convert wavelength (in nanometers, from 380nm to 780nm) to RGB values. This can be useful to match real world colors easier. * Code cleanup: ** Moved color functions (xyz and hsv) into dedicated utility files. ** Remove svm_lerp(), use interp() instead. Documentation: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/More#Wavelength Example render: http://www.pasteall.org/pic/show.php?id=53202 This is part of my GSoC 2013. (revisions 57322, 57326, 57335 and 57367 from soc-2013-dingto).
This commit is contained in:
@@ -2953,6 +2953,30 @@ void WireframeNode::compile(OSLCompiler& compiler)
|
||||
compiler.add(this, "node_wireframe");
|
||||
}
|
||||
|
||||
/* Wavelength */
|
||||
|
||||
WavelengthNode::WavelengthNode()
|
||||
: ShaderNode("Wavelength")
|
||||
{
|
||||
add_input("Wavelength", SHADER_SOCKET_FLOAT, 500.0f);
|
||||
add_output("Color", SHADER_SOCKET_COLOR);
|
||||
}
|
||||
|
||||
void WavelengthNode::compile(SVMCompiler& compiler)
|
||||
{
|
||||
ShaderInput *wavelength_in = input("Wavelength");
|
||||
ShaderOutput *color_out = output("Color");
|
||||
|
||||
compiler.stack_assign(wavelength_in);
|
||||
compiler.stack_assign(color_out);
|
||||
compiler.add_node(NODE_WAVELENGTH, wavelength_in->stack_offset, color_out->stack_offset, NULL);
|
||||
}
|
||||
|
||||
void WavelengthNode::compile(OSLCompiler& compiler)
|
||||
{
|
||||
compiler.add(this, "node_wavelength");
|
||||
}
|
||||
|
||||
/* Output */
|
||||
|
||||
OutputNode::OutputNode()
|
||||
|
@@ -457,6 +457,11 @@ public:
|
||||
bool use_pixel_size;
|
||||
};
|
||||
|
||||
class WavelengthNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(WavelengthNode)
|
||||
};
|
||||
|
||||
class MathNode : public ShaderNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(MathNode)
|
||||
|
Reference in New Issue
Block a user