...
| Info |
|---|
Note that AOVs can be output in any node of the OSL tree. If two different OSL nodes contribute to the specular_aov variable 3Delight will correctly blend their contribution together in the final output and in the AOV. |
Gone is lockgeomis lockgeom
A remnant of the RenderMan way of doing things is the 'lockgeom' parameter which hints of symbolic linking of data defined on the geometry to parameters defined in the shader. From our point of view, this is feature is useless, as-is, in the OSL world:
- Symbolic linking is weak in that it is ill-defined : what happens if you have many parameters with the same name in an OSL network ?
- In this situation, OSL networks are not completely defined by themselves but are dependant on some external user setting to function. In other words, it is impossible to understand the working of an OSL network just by inspecting it.
- In order to function properly, the lockgeom has to be defined per parameter anyway. Not per shading group.
lockgeomcan be elegantly implemented by a ... connection (explicit linking).
In 3Delight, any parameter with no incoming connection will be optimize out (folded). In order to read any primitive variable from the geometry, the OSL network must contain a reader node that calls the getattribute() function call and outputs it to the input parameter. This clearly states the behaviour of the network.
Most networks are automatically built by intermediate software and such nodes are easy to add automatically.
...
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.
