Closed lanierd-adsk closed 3 weeks ago
What we do in maya hydra is create the scene indices with UsdImagingCreateSceneIndices : https://github.com/Autodesk/maya-hydra/blob/8c5a0ddad971a628e3a1ee75ee18036e981fa908/lib/flowViewport/API/perViewportSceneIndicesData/fvpDataProducerSceneIndexDataBase.cpp#L98 I also tried to remove our overrideSceneIndexCallBack line : https://github.com/Autodesk/maya-hydra/blob/8c5a0ddad971a628e3a1ee75ee18036e981fa908/lib/flowViewport/API/perViewportSceneIndicesData/fvpDataProducerSceneIndexDataBase.cpp#L103 But the same problem was still present. We store the finalSceneIndex in our scene index chain and it gets deleted when we do a "File New" as part of the scene indices chain being deleted.
I also noticed the materialBindings attributes are visible when I select the scene index before the UsdImagingNiPrototypePropagatingSceneIndex in the hydra scene browser, but they are no more in it and not in any following scene index in the chain, the material bindings attributes disappeared after UsdImagingNiPrototypePropagatingSceneIndex .
I did a video to show more info about that, please see : https://myshare.autodesk.com/:v:/g/personal/david_lanier_autodesk_com/ETIo7aDQQnZKskxy3gMzvgEBsJ9ZJ8J4dz88x196F-G4mw?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0&e=KaogL9 But download the video before the 24th of October as this will be deleted at this date.
Filed as internal issue #USD-10189
Hi, I was trying to fix this in OpenUSD and realized it's not a problem in OpenUSD but in our code. So I am closing this issue. Sorry for the noise. Thank you.
Description of Issue
I noticed a problem of not seeing the materials assigned on usd prims in Hydra Storm on the second time I create a stage in maya hydra after a reset. But I don't think it's due to maya hydra unless we delete something we should not...
At maya startup, I create usd stage, add a sphere prim, assign a usd preview surface material then switch to HdStorm and I see the materials in Storm, but only the first time I do this. If I do a "File New" in maya which is deleting everything hydra related including the scene index chain. The same steps as above never display the materials on the prims under Hydra.
After tracing into openusd, I noticed the usd prims have the UsdImagingDirectMaterialBindingsSchema applied, so we pass in https://github.com/PixarAnimationStudios/OpenUSD/blob/59992d2178afcebd89273759f2bddfe730e59aa8/pxr/usdImaging/usdImaging/materialBindingsResolvingSceneIndex.cpp#L191 But only the first time. If we reset maya (doing a file new) which resets everything in hydra and deletes the scene index chain including the stage scene index and such. And we never see the direct material bindings being on usd prims again, meaning we never go again into https://github.com/PixarAnimationStudios/OpenUSD/blob/59992d2178afcebd89273759f2bddfe730e59aa8/pxr/usdImaging/usdImaging/materialBindingsResolvingSceneIndex.cpp#L191
Looking more carefully with the hydra scene browser, I noticed that there is no longer the "directMaterialBindings" attribute on my mesh prims which is present the first time when I convert the scene to hydra. After digging a bit, I think it may come from : https://github.com/PixarAnimationStudios/OpenUSD/blob/59992d2178afcebd89273759f2bddfe730e59aa8/pxr/usdImaging/usdImaging/flattenedDataSourceProviders.cpp#L27 It has a static variable and I am not 100% sure, but I am guessing that this container gets deleted by the fact we delete our scene index chain which is likely linked to this and is never recreated again.
Steps to Reproduce
System Information (OS, Hardware)
All
Package Versions
usd 24.08
Build Flags