Stage Composition and Layer Stacking
Composition is where most NCP-OUSD marks are won: given several plausible USD files, you must predict exactly what the stage reports.
The strength order (LIVRPS)
Opinions rank strongest to weakest as Local (the stage's own layer stack), Inherits, VariantSets, References, Payloads, Specializes. Inside one layer stack the root layer is stronger than its sublayers, and earlier subLayers entries are stronger than later ones. A payload is a reference that can be loaded and unloaded, so payload opinions always lose to plain reference opinions on the same prim.
Practical rules
- A
referencepulls a subtree onto a prim; the referencing prim's local opinions still win unless an inherit or variant overrides from above. - Variant opinions beat references because V outranks R. This is why variants are the standard mechanism for asset variations.
inheritsbeats variants, so class prims can silently shadow variant choices.- Composition is per-property, not per-prim: a prim can come from a reference while one of its attributes comes from local opinion.
- Inspect with
prim.GetPrimStack()(all opinions, strongest first),Usd.PrimCompositionQuery, and theusdviewComposition tab.
Worked example
/World/Chair references chair.usd, which authors size = 1. The variant colorways in the root layer authors size = 2, so the stage shows 2 because V beats R. Authoring size = 3 directly on /World/Chair in the root layer gives 3, because L is strongest of all.
Traps
Assuming a sublayer outranks the root layer; forgetting that a layer's sublayer paths resolve relative to that layer, not the stage; and calling Flatten() to simplify, which bakes every arc and destroys instancing and unloaded payloads.