IECoreUSD : Round-trip Material prims with binds.#1521
IECoreUSD : Round-trip Material prims with binds.#1521boberfly wants to merge 1 commit intoImageEngine:mainfrom
Conversation
|
Just to add I know this change is a little flaky for workflows as Gaffer isn't doing referencing from material locations natively, I'm open for ideas on how to improve the approach and was thinking the adapter stuff might work out. This approach benefits more of a pipeline with many DCCs passing materials between them and having the ability to load and save materials mostly consistently between them. |
afb46d5 to
2a34c90
Compare
|
Thanks Alex. While I understand the motivation here, and am glad that this is useful for your workflow, we'll be holding off on looking at this in any detail until such a time as we can consider end-to-end support for this style of material binding natively in Gaffer. While I don't rule out adopting the USD style because it does have its benefits, there are also benefits to Gaffer's methodology, and we need to manage any transition (or coexistence) carefully. |
Generally describe what this PR will do, and why it is needed.
materials/material_<hash>child on the location itself gets created of schema-typesUsdGeomScopecontainer with aUsdShadeMaterialinside and metadatacortex_autoMaterialson the container to inform IECoreUSD to not translate this back to path/prims when loading back the USD scene into Gaffer.usd:schemaTypestring attribute to eitherScopeorMaterialand assign Gaffer ShaderNetworks to this location, and by usingusd:material:bindingstring attribute on the destination shader assignment location of the path to the material location, will correctly do the binding when saving out the USD file, as well as preserving this form when loading back into Gaffer. This also works forusd:material:binding:fullandusd:material:binding:previewwhich corresponds to USD's purpose functionality for material binding.CopyAttributesthis can be emulated (I do this with 2 "Extension" nodes with one node that defines the Material and location of where it'll go and setsusd:schemaTypefor the hierarchy, as well as some ShaderAssignment node plugs promoted - and a MaterialAssign node that uses CopyAttributes and can set the purpose of the copy and create theusd:material:binding*attribute inside).__materialsset is created much like the__lightsset. This is unused at the moment and could be removed from this PR but it could come in-handy at a later stage. I am thinking of this place here is a little fragile and would be best to check if the location is a part of__materials.https://github.com/boberfly/cortex/blob/afb46d5a69a382be806e0d0c5567cea8a7777505/contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp#L1665Related Issues
Dependencies
Breaking Changes
usd:material:bindingattributes will now get created onto locations with material binding, as well as theusd:schemaTypeattribute for onlyUsdGeomScopeandUsdShadeMaterialprims when loading in. There was care in making sure the pure Gaffer workflow/roundtrip isn't affected at all with thecortex_autoMaterials = truemetadata, this would be a change for reading in USDs that are made in other DCCs.cortex_autoMaterials = trueto unit-test .usda 's which are mostly harmless, it helps to not litter the existing checks with additional attributes that the asserts don't account for...Checklist