Summary :
I have a problem when assigning a material to a usd prim that didn’t have any material previously, the material bindings get removed by a scene index.
More context :
This is with usd 24.08 with Hydra 2.0 under Windows.
Under maya, I create a usd stage with one geometry and I am assigning a usd preview surface to it. I use Storm as the renderer in maya-hydra.
It gives the following stage :
The problem I get is that the material is not displayed under Storm because the material bindings (usd and hydra) are “eaten” by one of the scene indices.
To convert the usd stage to hydra with scene indices, I call UsdImagingCreateSceneIndices and use an overridesSceneIndexCallback where we add a UsdImagingRootOverridesSceneIndex.
The code can be seen in :
The problem I see when looking at the stage through the Hydra scene brower is that the material bindings are missing :
Is there a way for us to prevent the material bindings from being removed ?
I haven’t found a way to be sure where this problem comes from, I mean if it could be caused by some of the scene indices we use in maya hydra. I removed the rootoverride scene index and custom prefixing scene index, but it didn’t change anything.
Would someone have any clue about how to fix this ?
Thank you.
Regards,
David
I confirm that the fix is to call : UsdShadeMaterialBindingAPI::SetMaterialBindingStrength(usdrelationship, UsdShadeTokens->strongerThanDescendants);
before : auto bindingAPI = UsdShadeMaterialBindingAPI::Apply(prim);
Currently we still have no solution for this problem as changing the relationship with strongerThanDescendants is not a viable solution, we shouldn’t have to do that.