I am interacting with USD via the Houdini /stage context.
I have an asset that already has a variant set “outfits” defined.
It has different variants (“outfit01”, “outfit02”, “outfit03”, etc).
The variant set is saved on the “/root” primitive.
So far the different variants add new primitives (new outfit geometry).
In a second step I want to now add new materials and assign those to the new outfit primitives, potentially change some existing material assignments on other primitives.
I want to of course add that change to the respective existing variant. I don’t want to create a new variant set or new variants. If the user changes the ‘outfit01’ the geometry should change and the shaders.
From what I can see from the picture there are two problems:
You are writing variant selections into the variants. You need to either put a layer break node after the setvariant5/6 nodes or set the variant before the variantblock_begin1 node.
Remove the assignmaterial1 node as it is writing to the layer directly and will always be stronger than the variants due to LIVRPS ordering.
I wasn’t able to remove the setvariant node because I would miss the primitive to assign the material to (as it is saved in the variant). But in order to no set the variant in the variant I needed to add another layer break node.
I’m fairly certain this is a Houdini bug, we had a similiar issue a while back with the addvariant node, looks like the bug re-appeared. I’d recommend reporting it to SideFX. Looks like they don’t merge the variants into the active layer, instead they just copy the content erasing anything pre-existing. You can also fix it by just starting a new layer before the addvariant node.
The begin variant edit performs a layer break already, so you can also do this: