Share

OSL Shaders - Arnold for Maya

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.

The Ai OSL shader 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.
Note:

More information about using OSL shaders can be found here.

An example .osl shader and .mtd file can be found here.

If you change the shader code in a text editor while rendering, you will need to "update full scene" in the Arnold RenderView.

Installation

Just like any other third-party shader libraries, OSL shaders placed in the shader search path are automatically registered as Arnold shader nodes. The OSL shader parameters are converted to Arnold parameters. Once loaded, they can be inspected, instantiated and linked in the same way as C++ shaders.

To render OSL shaders directly with Arnold, you must do the following:

  • Put the OSL shader (.osl and .mtd) in a folder, and set ARNOLD_PLUGIN_PATH to point to this folder. For example:
ARNOLD_PLUGIN_PATH=C:\shaders\osl
  • Arnold will automatically compile the .osl file and produce a dll (.oso) file.
Note:

See the Third-party Shaders page for more details.

  • The shader should be visible in the Hypershade window.

.osl shader rendered with MtoA

Was this information helpful?