Quirk with Variants + Specializes

I’ve run across an odd result of composition with usd-23.08 which I can’t explain. Given the following layer:

#usda 1.0
class "_class_"
{
    class "asset"
    {
        class "representations"
        {
            class "modelHero" (
                variants = {
                    string lookdev = "v2"
                }
                prepend variantSets = "lookdev"
            )
            {
                def "geo"
                {
                    def "foo"
                    {
                    }
                }
                variantSet "lookdev" = {
                    "v2" {
                        def "mtl"
                        {
                            def Material "myMaterial"
                            {
                            }
                        }

                    }
                }
            }
        }
    }
}

def Xform "element" (
    variants = {
        string mode = "foo"
    }
    prepend variantSets = "mode"
)
{
    variantSet "mode" = {
        "foo" (
            prepend specializes = </_class_/asset/representations/modelHero>
        ) {

        }
    }
}

In the composed stage, the modelHero prim has the mtl/myMaterial prim as expected but the element prim does not.

Using Inherits instead of Specializes gives the expected result but causes strength ordering issues in other places. Adding an indirection between element and modelHero by specializing a different prim which then specializes modelHero also gives the expected result weirdly.

I believe this might have something to do with how Specializes arcs are ignored while recursing but I can’t wrap my head around why the specialize partially works but ignores the “lookdev=v2” variant completely.

Can anyone explain what’s happening here? Is this intended behaviour or is it a bug?

oh also, Specializing the representations parent prim rather than modelHero also gives the expected result, albeit with an extra representations prim underneath the element.

Hi @Tymon, this is a bug in composition where variant sets on the specialized prim aren’t being expanded properly. I’ve confirmed this is still broken on the most recent 24.08 release.

Would you mind filing an issue on the GitHub repository to track this? Thank you for the simple repro case!

1 Like

Thanks @sunya! That’s actually good news for me since it means my mental model of how LIVRPS is supposed to work is not flawed. In the short term we can just remove the “mode” variantSet since it’s not critical to our workflows right now.

I’ve filed an issue on GitHub: Variant sets on the specialized prims aren’t being expanded properly · Issue #3244 · PixarAnimationStudios/OpenUSD · GitHub

1 Like