1
$\begingroup$

I know how to get the default_value from a node socket as described in this answer. But the answer there doesn't answer the question, namely: how to get the actual computed value of a socket.

How can I get the actual value using python?

example node structure

For example, how would I determine the final Roughness value in this node structure assuming the value is constant for the material?

(I'm thinking this is not possible in general since it wouldn't work for values that change over the model, e.g., trying to obtain the Pointiness value from a Geometry node, which isn't a constant.)

$\endgroup$
1

1 Answer 1

2
$\begingroup$

Basically this cannot be done easily. The reason is:

  • The shader node tree is compiled by cycles in SVM or OCL. And here the actual calculation takes place.
  • Also every sample in Cycles can potentially have a different Roughness (for example when connected to a TextureImage along the way). So which sample do you want the result from.

If you have a special case you can mimic the needed nodes in python and evaluate for your needs.

$\endgroup$
1
  • $\begingroup$ If not as a value, can the result of the shader node tree be baked to an image? E.g. would it be possible to implement an exporter that creates a roughness texture from arbitrary node inputs? $\endgroup$ Mar 14, 2018 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .