Skip to content

IECoreUSD : Add option to write OSL shaders conformant with RenderMan#1540

Open
johnhaddon wants to merge 1 commit into
ImageEngine:RB-10.6from
johnhaddon:usdOSLShaderCompatibility
Open

IECoreUSD : Add option to write OSL shaders conformant with RenderMan#1540
johnhaddon wants to merge 1 commit into
ImageEngine:RB-10.6from
johnhaddon:usdOSLShaderCompatibility

Conversation

@johnhaddon

Copy link
Copy Markdown
Member

This means writing the info:id attribute without our osl: prefix, and omitting any directories in the shader name. Since this is a breaking change, it is gated behind an IECOREUSD_WRITE_CONFORMANT_OSL_SHADERS environment variable for folks to opt in via.

Unfortunately Arnold doesn't support shaders exported in this format, but it didn't support the old format either. Since the new format seems to be "blessed" by Pixar, perhaps we can contribute support for it to arnold-usd in the future. Alternatively, we could write OSL shaders as arnold:osl shaders, but only when assigned via an arnold: prefixed material binding. This is left as future work though.

Adopting the RenderMan-style formatting for OSL shaders implies a few things for our own small shader library in Gaffer :

  • We should move to a flat directory structure, so we don't need to save the full name in the cortex:shaderName sidecar metadata.
  • We should prefix the shader names with "Gaffer", since the likelihood of collision is much greater without the directory names.

This is also left as future work though.

This means writing the `info:id` attribute without our `osl:` prefix, and omitting any directories in the shader name. Since this is a breaking change, it is gated behind an IECOREUSD_WRITE_CONFORMANT_OSL_SHADERS environment variable for folks to opt in via.

Unfortunately Arnold doesn't support shaders exported in this format, but it didn't support the old format either. Since the new format seems to be "blessed" by Pixar, perhaps we can contribute support for it to `arnold-usd` in the future. Alternatively, we could write OSL shaders as `arnold:osl` shaders, but only when assigned via an `arnold:` prefixed material binding. This is left as future work though.

Adopting the RenderMan-style formatting for OSL shaders implies a few things for our own small shader library in Gaffer :

- We should move to a flat directory structure, so we don't need to save the full name in the `cortex:shaderName` sidecar metadata.
- We should prefix the shader names with "Gaffer", since the likelihood of collision is much greater without the directory names.

This is also left as future work though.
@johnhaddon johnhaddon force-pushed the usdOSLShaderCompatibility branch from dcb0d8d to efe1c67 Compare June 17, 2026 14:32
@danieldresser-ie

Copy link
Copy Markdown
Contributor

I've looked through this code, and it seems like a valid implementation of this idea, though I know we've got a conversation going about whether this is the right approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants