Class prims, inherits and instancable performance differences?

Hello,

Our pipeline generates usd layers (not really department layers either) on the fly from a recipe list (of sorts). We do not have an asset resolver and I am looking into ways we can enable duplication workflows in Maya. One way we can do this is by creating class prims in the asset layer where all the references/payloads, variant sets etc are stored.

I am unsure what (if any) downsides there are to this kind of workflow? One of the asset layers looks like this:

#usda 1.0

def Xform "set" (
    kind = "assembly"
)
{
    def Xform "benchA" (
        kind = "assembly"
    )
    {
        def Xform "scPlanterA01" (
            kind = "assembly"
        )
        {
            def Xform "main" (
                append inherits = </_class__set_benchA_scPlanterA01_main>
                kind = "assembly"
            )
            {
            }
        }

        def Xform "scTrashCanA01" (
            kind = "assembly"
        )
        {
            def Xform "main" (
                append inherits = </_class__set_benchA_scTrashCanA01_main>
                kind = "assembly"
            )
            {
            }
        }

        def Xform "scPlanterB01" (
            kind = "assembly"
        )
        {
            def Xform "main" (
                append inherits = </_class__set_benchA_scPlanterB01_main>
                kind = "assembly"
            )
            {
            }
        }
    }
}

class Xform "_class__set_benchA_scPlanterA01_main" (
    kind = "assembly"
    append references = [
        @/jobs/testproject/prop/scPlanterA/components/main/usdCache/model/v001/assembly.usda@,
        @/jobs/testproject/prop/scPlanterA/components/main/usdShade/default/v007/assembly.usda@
    ]
)
{
}

class Xform "_class__set_benchA_scTrashCanA01_main" (
    kind = "assembly"
    append references = [
        @/jobs/testproject/prop/scTrashCanA/components/main/usdCache/model/v002/assembly.usda@,
        @/jobs/testproject/prop/scTrashCanA/components/main/usdShade/default/v004/assembly.usda@
    ]
)
{
}

class Xform "_class__set_benchA_scPlanterB01_main" (
    kind = "assembly"
    append references = @/jobs/testproject/prop/scPlanterB/components/main/usdCache/model/v004/assembly.usda@
)
{
}

When an artist duplicates the prim /set/benchA/scTrashCanA01 in maya it will copy the prim spec (is that the right term?) and created /set/benchA/scTrashCanA02. What is the difference between this method and marking something as instanceable? Is there a huge downside to this workflow. Stronger layers in our system are reliant on the asset layer being generated which comes with its own precariousness.

1 Like

Hi Patrick,

Iā€™ve done some presentations about how to define a usd-structure and how the intent (of what you really want to do with the usd-structure at the end) is the most important thing.
There are various ways to work out how to do implicit-instancing (not explicit PointInstancers, but work out what to do with two copies of the same ā€œelementā€ in the scene basically) and there are different approaches that address different aspects of it.
When I was at Weta, we approached it in the way you are describing it, and it has a lot of pros, especially with how we wanted the Lighters to interact with it, how they could apply edits, etc.
There are possibly cons, which we found a couple while I was still there, but I do feel that it is a good starting point.

This is the video of the presentation:

And you can also see that in a similar way, the usd-assets-wg guidelines point to the class but as an ā€œemptyā€ prim, mostly to apply edits globally.

But I do feel that references/variants/etc on the classes has benefits.

1 Like

To add to what @paoloemilioselva said with regard to your question about instancing, it can work really well with the setup you have - just add instanceable = true to each of your class definitions, and then every inherits of the class will be instanced by default.

2 Likes

Thanks to both of you! @spiff I added instanceable = true to those and it works really well as a base starting point for layout.

Thanks!