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

USDScene : Fix writing of UsdLux lights #1376

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

johnhaddon
Copy link
Member

Companion to GafferHQ/gaffer#5400, allowing Gaffer to author and export UsdLux lights.

@johnhaddon johnhaddon self-assigned this Jul 20, 2023
@johnhaddon
Copy link
Member Author

This still needs a review before I can make a Cortex release @danieldresser-ie.

Copy link
Contributor

@danieldresser-ie danieldresser-ie left a comment

Choose a reason for hiding this comment

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

Apologies this took me a while to get to - all looks good except for one comment that seems to have been pasted in the wrong place.

//
// - The output shader is written as a UsdLight-derived prim rather than a UsdShadeShader.
// - The other shaders are parented inside the light.
// - We don't need to create a UsdShadeOutput to return.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment seems to belong with writeLight, not readShaderNetwork?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for spotting that - fixed in f174f8d.

We were writing them as regular material assignments before, which might have round-tripped back into Gaffer OK, but which were not what other USD clients needed. We need to make sure that the primary shader is written as a `UsdLux*Light` prim, and that any input shaders are stored as children of that prim.

We still share most of the implementation with the generic material-writing code, but with differences in orchestration. It would have been possible to continue to do this with one `writeShaderNetwork()` uber-function internally with a bunch of conditionals depending on whether or not we were writing lights. But I felt that it was clearer and more maintainable to have two small top-level functions that each made appropriate calls to a set of shared utility functions.
These cases occur when writing to UsdLuxLight types where the inputs already exist, and don't need to be defined by us.
@danieldresser-ie
Copy link
Contributor

LGTM

@johnhaddon johnhaddon merged commit b156c83 into ImageEngine:RB-10.5 Aug 4, 2023
4 checks passed
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