...
Consider the following simplified line of code and the corresponding evaluation:
|
|
...
In this diagram, "vertex_color" and "Kd" are connected to an OSL node which
executes getattribute(). All the other variables are "folded".
A "drawback" of this method is that one can't easily get the default parameter value if the primitive variable is undefined. But bear in mind that 99% of shader networks are machine generated and this gives us two possible solutions to this problem:
- Don't output the
getattribute()node when the primitive variable is not present. - Output the proper default value in the
getattribute()node in case the primitive variable is not present. This involves shader node interrogation.
...
