# How can I see the actual numerical output RGB values of the cycles 'Blackbody' node? (preferably through api)

More generally, using the Blackbody node as an example, how can I access the current numerical values of inputs, parameters/settings and outputs of cycles nodes, through the api or by other means?

In this particular case I want to compare the conversion values calculated by the Blackbody node with other color temperature -> RGB algorithms. But I'm interested in the more general situation. If this is not possible, shouldn't it be, and will it be in the future?

Example for the compositor node which is present by default:

import bpy

scene = bpy.context.scene
scene.use_nodes = True

nt = scene.node_tree

#get the node
node = nt.nodes['Composite']

#access by string key in 2.69
input = node.inputs['Alpha'].default_value = 0.5

#older versions of blender might require
#access by index
for index, input in enumerate(node.inputs):
if input.name == "Alpha":
print(index)
break

output = nt.nodes['Render Layers'].outputs['Alpha']


You can hover over the input with python tooltips enabled:

Using python it is only possible to setup the tree and its parameters.

Template Temperature To RGB

shader temperature_to_rgb(
float Kelvin = 1200.0,
output color Color = 0.8)
{
/* Kelvin to RGB */
Color = blackbody(Kelvin);
}


As you can see blackbody is an inbuilt function of the standard library.

• Perhaps I'm missing something, but I thought the OP was asking how to view the values of a node socket? – gandalf3 Feb 22 '14 at 0:29
• Thanks for this. I had more or less figured out this much. By "using python it is only possible to setup the tree and its parameters" I take it that accessing the actual current values of nodes (e.g. the RGB values from the Blackbody node output) is not possible. Why isn't this data exposed to python? – xerula Feb 22 '14 at 0:31
• Because python is quite slow. As written above you can write and use your own OSL shaders in cycles. – pink vertex Feb 22 '14 at 11:50
• OK, thanks. It surprises me that "too slow" is a reason for not being able to simply read off the current values of a node output of something like the blackbody node, which apparently just does some straightforward math / lookup. But I have further questions about the behavior of the blackbody node and will ask about this separately. – xerula Feb 22 '14 at 17:32
• I might be completely wrong, but perhaps the reason for this is the RGB values of the blackbody node are actually computed by cycles at rendertime? – gandalf3 Feb 27 '14 at 9:03