Skip to content

Conversation

@johnhaddon
Copy link
Member

No description provided.

- Simplify `readShaderNetwork()` public interface, and move "does the output have a connection?" logic from USDScene into ShaderAlgo.
- Introduce `readShaderNetworkWalk()` overload which takes an output and returns a handle for that output. This removes the repetition of the `DEFAULT_OUTPUT` special case.
- Simplify connection handling by building `vector<Connection>` directly, rather than packing and unpacking a recipe for making a connection.
- Remove unused `inputs` variable.
- Remove bogus comment - there is no such variable as `handles[0]`.
We only support this for USD 21.11 and greater, because that version introduces UsdLuxLightAPI which lets us load lights using the same UsdShadeConnectable API that we use for materials.

At this point we're making no attempt to conform the lights to Gaffer's conventions for Arnold (or any other renderer), so in the short term this is mostly useful for "data smithing" - converting stuff manually after loading. An upcoming ShaderQuery node in Gaffer should provide a useful tool for doing that.
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.

Looks good, with one question about naming.

I wouldn't have necessarily expected it to be a reasonable requirement that all shading groups can be referred to by an output they're connected to, as an API for readShaderNetwork, but it's definitely cleaner, and appears to cover all use cases, so LGTM.

}
}
return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming of this compared to the previous function doesn't feel particularly clear ( I guess we do need both, we need to check for cameras being a schema vs lights having a schema, rather than using HasAPI for both? ).

I'm wondering about something like readDescendentsMatchSchema vs readDescendantsHaveSchema?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, we definitely need both - IsA() won't consider mix-in API types like UsdLuxLightAPI, and HasAPI has static asserts that limit it to mix-in API types. I've tried something along the lines of what you suggested in 798e7af.

Copy link
Member Author

Choose a reason for hiding this comment

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

How's this looking to you now @danieldresser-ie? OK to merge?

@danieldresser-ie
Copy link
Contributor

LGTM

@johnhaddon johnhaddon merged commit 3bb0325 into ImageEngine:main Apr 21, 2022
@johnhaddon johnhaddon deleted the usdLights branch April 27, 2022 09:06
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