Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3Delight ShaderNetworkAlgo : Translate UsdPreviewSurface to 3Delight #5822

Merged

Conversation

murraystevenson
Copy link
Contributor

This adds render-time conversion of UsdPreviewSurface shaders to 3Delight, bringing this functionality to all of our natively supported renderers.

@murraystevenson murraystevenson self-assigned this Apr 26, 2024
Copy link
Member

@johnhaddon johnhaddon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Murray!

This seems to be working pretty nicely, at least using 3Delight 2.9.79. I started my initial testing in 2.9.39 and took a while to figure out that UsdPrimvarReader_float2->UsdUVTexture was completely broken in that version for some reason. Not something I think we need to look into further, but something to bear in mind if folks run into problems in other versions. It'd be handy if 3Delight actually had a change log so we weren't left to guesswork...

One small problem I found is an error when rendering https://github.com/usd-wg/assets/tree/main/test_assets/AlphaBlendModeTest, along with the rightmost 3 cards not showing up :

ERROR : 3Delight : ConnectShaders: badly formed source layer/parameter
ERROR :         group: unnamed_group_143
ERROR : 3Delight : ConnectShaders: badly formed source layer/parameter
ERROR :         group: unnamed_group_149
ERROR : 3Delight : ConnectShaders: badly formed source layer/parameter
ERROR :         group: unnamed_group_155

Might be worth digging into that one a little before we merge...

Cheers...
John

python/IECoreDelightTest/ShaderNetworkAlgoTest.py Outdated Show resolved Hide resolved
python/IECoreDelightTest/ShaderNetworkAlgoTest.py Outdated Show resolved Hide resolved
src/IECoreDelight/ShaderNetworkAlgo.cpp Outdated Show resolved Hide resolved
python/IECoreDelightTest/ShaderNetworkAlgoTest.py Outdated Show resolved Hide resolved
Changes.md Outdated Show resolved Hide resolved
@murraystevenson
Copy link
Contributor Author

I started my initial testing in 2.9.39 and took a while to figure out that UsdPrimvarReader_float2->UsdUVTexture was completely broken in that version for some reason.

Thanks for flagging this, I took a quick look at this and narrowed it down to a change in behaviour of the dlPrimitiveAttribute shader used in place of UsdPrimvarReader_float2. Somewhere between 2.9.51 and 2.9.73 dlPrimitiveAttribute changed to default to a new "auto" attribute_type mode, where values would be output to o_uv by default and we were relying on that behaviour. Prior to this, dlPrimitiveAttribute defaulted attribute_type to "float" and would only output values to o_uv when attribute_type was manually changed to "UV".

For maximum compatibility I'm now setting attribute_type to "UV" in 39f0c2e so UsdPrimvarReader_float2->UsdUVTexture should now work in older and current 3Delight versions...

`{param}_meta_colorspace` is a 3Delight convention for declaring the input colorspace of the texture at `{param}`.

From the 3Delight docs:

In NSI `textureName.meta.colorspace` indicates the color space for the texture designated by `textureName`. Any available OCIO color space can be used. The following presets are recognised: linear, rec.709, sRGB.
3Delight doesn't handle the `<UDIM>` convention, which is commonly authored in texture paths in USD assets.
@johnhaddon johnhaddon merged commit cb1ca56 into GafferHQ:1.4_maintenance Apr 30, 2024
5 checks passed
@johnhaddon
Copy link
Member

Thanks Murray! Squashed and merged...

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