Non-deterministic composition with nested instancing and inherits / specializes arcs
Description of Issue
Hello USD team, big fan!
I've encountered an issue where nested instancing + use of inherits / specializes leads to non-deterministic composition. I'd like to clarify if it's a bug or expected behavior from miss-use of these features.
Steps to Reproduce
Short version (visual check):
- Unzip broadcast_nested_instances.zip (it contains
broadcast_nested_instances.usdz) - Open
broadcast_nested_instances.usdzin USDView and take a look at the viewport - Re-open the same file through
File -> Reopen Stagea couple of times. Without changing anything, the same stage composes differently:
Long version (Stats and variant selection check):
- Download and unzip the same
broadcast_nested_instances.usdzfile - Save this python script and update the stage filepath to where
broadcast_nested_instances.usdzis downloaded:"""This script checks for the current "color" variant selection from an instanced "Window" model, as well as total prototype prim count. Results will differ per script execution. """ from pxr import Usd, UsdUtils stage = Usd.Stage.Open("/path/to/downloaded/broadcast_nested_instances.usdz") window_instance_path = "/Catalogue/Model/Blocks/Block_With_Inherited_Windows/Building1/Windows/Window" window_instance = stage.GetPrimAtPath(window_instance_path) window_color_selection = window_instance.GetVariantSet("color").GetVariantSelection() print(f"Window color: {window_color_selection}") stats = UsdUtils.ComputeUsdStageStats(stage) print(f"Total Prototypes Prim Count: {stats['prototypes']['primCounts']['totalPrimCount']}") - Run the script once to see the output of current color variant selected and total prototype prim count:
Window color: blue Total Prototypes Prim Count: 17 - Run the python script a couple of times; the print output will be different from time to time, e.g in a bash shell:
outputs:for i in `seq 10`;do python /path/to/check_composition.py;doneWindow color: red Total Prototypes Prim Count: 20 Window color: Total Prototypes Prim Count: 14 Window color: blue Total Prototypes Prim Count: 17 Window color: blue ... Total Prototypes Prim Count: 17 Window color: Total Prototypes Prim Count: 14 Window color: blue Total Prototypes Prim Count: 17 - Note how values for window color vary between
red,blue,"", as well as total prototype prim count between14,17,20.
For convenience, I am also attaching a zip with the split usd files (before running usdzip):
broadcast_nested_instances_uncompressed.zip
It contains the following files:
City-Entry-Assembly.1.usda
Model-Blocks-Block.1.usda
Model-Blocks-Block_With_Inherited_Windows.1.usda
Model-Blocks-Block_With_Specialized_Windows.1.usda
Model-Buildings-Multi_Story_Building.1.usda
Model-Elements-Window.1.usda
And the same issue will appear when opening City-Entry-Assembly.1.usda in usdview
Details on the structure
For full context, click for the long description on the composition choices (it's quite long):
Expectations
This is what I would expect to see:
I'm also at SIGGRAPH this week, in case anyone wants to speak in person 😄
System Information (OS, Hardware)
- CentOS-7 & Windows-10
Package Versions
- USD-21.8 to USD-24.8 (tested many releases in between and all have the same behavior)
Build Flags
- Windows: default build
- CentOS: need to check
Thanks!
Filed as internal issue #USD-9919
There should be no way to misuse the composition arcs or instancing that does not produce error output (eg. introducing a reference cycle), so this surely sounds like a bug to me. Thanks for the great report- we’ll have a look!
Hi @chrizzFTD, just wanted to let you know I've been looking into this issue. I've identified the root cause and the team is discussion potential solutions. We'll keep you and everyone posted here -- thanks again!
Hi both, & thanks for the update!