Help with Using Custom OSL Shaders in Arnold for Maya

Hi everyone!

I’m new to shading and rendering in Maya, and I’m trying to create custom OSL shaders for Arnold. I can write and compile the OSL shaders into .oso files using the oslc compiler, but I’m not sure how to actually use and view the shader in Maya.

Here’s what I’m stuck on:

  1. How do I load and apply a custom OSL shader in Maya?
  2. How can I see the result of my custom shader in the render?
  3. How do I connect the OSL shader to a material like aiStandardSurface?

Example:

Here’s an example:

shader simple_shader(
    color color = color(1, 0, 0),
    output color outColor = 0
)
{
    outColor = color;
}

I compile it to simple_shader.oso, but I’m not sure what to do next in Maya to see it in the render.

Any help or advice would be much appreciated!

Thanks!

The standard Arnold documentation describes the OSL workflow and usage examples quite thoroughly:

https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_user_guide_ac_shading_ac_osl_shaders_html

OSL Shaders - Arnold for Maya:
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_for_maya_shaders_am_OSL_Shaders_html

OSL - Arnold for Maya:
https://help.autodesk.com/view/ARNOL/ENU/?guid=arnold_for_maya_utility_am_OSL_html

More:

1 Like