Variants not overriding when sublayering

   291   5   1
User Avatar
Member
8 posts
Joined: 8月 2013
オンライン
Is this another question about sublayers vs referencing? Maybe. But I have yet to see this exact issue addressed.

I'm not understanding why I'm seeing a difference with variants specifically with material overrides between sublayering usd files and referencing usd files.

For this example, I have 4 usd files that assemble into an asset.

I have a cube and a sphere in a geo.usd file


Next, I'm referencing that into a new file, and pruning out the cube or sphere depending on which variant is active.


Next new file I'm creating 2 materials (red, blue), and assigning them to the geo.


My next file, I'm creating a variant where I apply the blue material and set the blue variant.


If I reference all 4 files into my stage/root layer, everything works as expected. However, if I sublayer all 4 files together, the blue variant is ignored, and I can't switch the variant in my scene graph.


What is odd though is that I am still able to switch the shape variant, just not the material variant. My first thought was there was an issue with my sublayer order, however even if I reverse the load order of my sublayers, I still can't get my blue over to take, and I can't set my variant in my scene. I've also tried adding an additional reference after my sublayer.
Edited by tylerart - 2025年12月8日 23:01:57

Attachments:
geo.png (1.1 MB)
geo_variant.png (1.2 MB)
material_variant.png (1.2 MB)
sublayer.png (1.1 MB)
material1.png (1.1 MB)

User Avatar
Member
8 posts
Joined: 8月 2013
オンライン
Using H21, although having this issue in 20.5 as well.
Edited by tylerart - 2025年12月8日 18:29:10

Attachments:
geo.usda (16.8 KB)
geo_variant.usda (878 バイト)
mtl.usda (9.3 KB)
material_variant.usda (958 バイト)

User Avatar
Member
67 posts
Joined: 3月 2017
オフライン
Sounds like a classic LIVRPS [lucascheller.github.io] issue.
There's a strength hierarchy for composition arcs. Local (or sublayered) opinions are strongest. Variant opinions are stronger than References, which is probably why referencing worked but sublayering didn't.

If you dive into the Component Builder nodes you can see they have notes in there about how they set up material variants to avoid LIVRPs issues.
User Avatar
Member
8 posts
Joined: 8月 2013
オンライン
Thanks for the reply! LIVRPS was my first thought as well. I'll dive in and take a closer look at the component builder, but I believe they use referencing over sublayering.

With that said, does it still make sense that my other variant (changing the cube to a sphere) still works in the sublayer setup?
User Avatar
Member
8 posts
Joined: 8月 2013
オンライン
Ok, I actually think I may have this figured out.

Sublayering brings every file into the same layer at the same time, not taking into account layer order, and it figures out strength by LIVRPS. So in my instance, the material over in the variant is weaker than the initial assignment. I was thinking sublayering was evaluating a layer at a time, like referencing does, then flattening the data after evaluating all the layers. If I'm correct, this explains why layer order in my sublayer didn't matter.
Edited by tylerart - 2025年12月9日 16:10:31
User Avatar
Member
67 posts
Joined: 3月 2017
オフライン
Yeah variant sets aren't strong enough to apply if there's an existing local opinion, even for in-memory layers. So if there's already a material assignment you can't assign a new material with a variant set.

There's a couple of workarounds I briefly cover in this video:
https://youtu.be/k-S-MUp6ea4?t=21m6s [youtu.be]

Basically either only author the opinion in the variant set or clear the existing opinion with python (only works for in-memory layers).
  • Quick Links