Material bindings disappear in scene indices

Hi,

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 :

We use quite a big scene index chain which can be seen on :

And by going through them one by one starting at the UsdImagingStageSceneIndex, I can see that the direct material bindings are present :

There are still present in the chain until UsdImaging_NiPrototypeSceneIndex, then they disappear in the Flattening scene index which is highlighted :

And they are no longer present in the chain after that scene index :

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 am guessing this is somehow related to UsdShadeTokens->strongerThanDescendants / UsdShadeTokens->weakerThanDescendants …

I confirm that the fix is to call :
UsdShadeMaterialBindingAPI::SetMaterialBindingStrength(usdrelationship, UsdShadeTokens->strongerThanDescendants);
before :
auto bindingAPI = UsdShadeMaterialBindingAPI::Apply(prim);

Regards,
David