OSL - Arnold for Maya
Further Reading |
---|
See Utility Shaders in the Arnold User Guide for the full shader documentation. |
It is possible to create your own shaders using Open Shading Language. OSL shaders can be used to implement anything from simple texture patterns to full materials using closures.
An example .osl shader and .mtd file can be found here.
Limitations
- The shaders must have unique names. If the name conflicts with an existing shader, the OSL shader won't load. You should see a warning in the log in this case.
- No support for exposing input attributes of type Array and Matrix.
- The name of the output attribute (or any parameter) will be different as Arnold adds a param_ prefix to all OSL parameters.
Multiple Outputs
Shader outputs can be linked to inputs of other shader nodes in an .ass file or programmatically via the AiNodeLinkOutput() function by optionally specifying which output is desired when linking. When no output is specified, the node's default output parameter will be chosen, preserving Arnold's existing behavior. Standard OSL language rules apply when specifying multiple OSL shader outputs. An example OSL shader with three color outputs could look like the following snippet and each output could be connected separately:
shader test_shader (output color result = color(1, 1, 1),
output color good = color(0, 0, 1),
output color bad = color(1, 0, 0))
{
}
OSL shader using multiple shader outputs