# Variants

Variants Terminology

Because variants are a novelty introduced by USD, users should understand some of the terminology associated with them:

  • VariantSet: defines the name of a group of possible Variants. Note that at any time you can only have one single Variant selected.
  • Variant: the name of one of the possible Variants in a VariantSet.
  • Variant Selection: the action of specifying which Variant is in use for a VariantSet. Note that Variant Selection cannot be animated by USD design.
  • Default Variant: the optionally specified Variant used by default in a VariantSet (a VariantSet can have an empty default Variant, hence why optional).

Variants are used to represent "switchable alternatives" in USD assets and compositions. Variants are fully self-contained within USD files and are therefore completely portable across a USD pipeline.

Some of the typical use cases for variants are setting alternatives for:

  • different geometries in an asset (cowboy hat, baseball hat, ...)
    • levels of damage of an asset (new, light damage, heavy damage, ...)
  • geometric complexity (think something like "level of detail", ...)
  • character props (sword, hammer, ...)
  • different shading parameters
  • material assignment

# Types of variants

In Multiverse we define two types of variants:

  1. Hierarchy Variants These represent variations in the hierarchy (different hierarchical structure, naming) and/or in the geometry (different model topology).

    They are typically used to provide model and hierarchy alternatives, such as "baseball hat" or "cowboy hat" (see above for other typical uses), to be used in later steps of the pipeline when variations are needed. This includes the lookdev stage as hierarchy variants can introduce different geometry by altering the hierarchy, and will require their own lookdev and material assignment.

  2. Attribute Variants These represent variations of attributes (different attributes names, types, values) and are typically used for lookdev and rendering purposes, such as a look choice between a "wet look" and a "dry look".

    Usually variants for shading are primitive variable attributes ("primvars") with name and value: they can be retrieved in your shading network with a primitive variable reader utility. Non-primvar attributes can also be created, in such case the purpose of attribute variants is arbitrary to the pipeline.

Important

Note that USD variant selection cannot be animated over time: this is by design in USD. If you need to take some decision based on an animated value over time you need to instead use custom attributes.

# Authoring Variants

Authoring is the process of creating VariantSets, associating Variants to them and writing this information to USD files. You can author variants both on Maya geometry data and on USD data in a Multiverse Compound.

Authoring variants is essentially a process of creating attributes on nodes, we will see here how to proceed in the various cases.

Python API

You can also author, select, remove and perform many Variants-related operations using the Multiverse Python API

# Writing Asset with Hierarchy Variants

In Multiverse a USD Asset can be written from a hierarchy of Maya transform and supported Maya shape nodes.

Hierarchy VariantSets and Variants are always defined on transform nodes.

TIP

Although Multiverse allows to author hierarchy variants on any hierarchy, we recommend to use a well structured hierarchy where hierarchy variants are grouped below a common transform (T) parent, such as handle in the example below:

door_grp (T)
├── frame (T+S)
├── door (T+S)
└── handle (T)
    ├── handle_rounded (T+S)
    └── handle_squared (T+S)
1
2
3
4
5
6

While the following, with a flat structure, is not ideal:

door_grp (T)
├── frame (T+S)
├── door (T+S)
├── handle_rounded (T+S)
└── handle_squared (T+S)
1
2
3
4
5

To write an Asset with Hierarchy Variants:

  1. In Outliner select a Maya transform node that is a parent for your hierarchy variants, such as handle in the above example, then in the Multiverse Shelf click on Variant> Define VariantSet to define its name (optionally you may set the default Variant).

    As a result, in the Maya AE for the aforementioned transform node you will find a new "Multiverse" section with the "VariantSet Definition" specifying the VariantSet name and its optional default value.

  2. Always performing a selection in Outliner we will create Variants on the children nodes of the node we created a VariantSet onto. Using the above example the selection would be the handle_rounded and handle_squared, then in Multiverse Shelf click on Variant> Create Hierarchy Variant: select the VariantSet for which you want to assign your variants, and name them accordingly.

    As a result, in the Maya AE you will find, on the transform nodes associated to each node you have selected in Outliner, a new "Multiverse" section with the "Hierarchy Variant" subsection specifying the VariantSet Target name and the Variant name.

  3. Write the Asset.

  4. Read the USD file back and verify in MEOW that your Variants were written as you desired, to do this try to switch Variant Selection in MEOW to see the hierarchy change dynamically in the MEOW tree, in the viewport and when rendering.

# Writing Asset with Attribute Variants

In Multiverse a USD Asset can be written from a hierarchy of Maya transform and supported Maya shape nodes.

VariantSets can only be defined on transform nodes, while Attribute Variants can be defined both on shape (default) and transform nodes. Such attributes are often named with the primvars: prefix to be queried in shading networks.

Let's use the following example hierarchy:

chair_grp (T)
├── back (T+S)
├── legs (T+S)
└── leather_cushion (T+S)
1
2
3
4

To write an Asset with Attribute Variants:

  1. In Outliner select a Maya transform node that is a parent for your hierarchy variants, such as chair_grp in the above example, then in the Multiverse Shelf click on Variant> Define VariantSet to define its name (optionally you may set the default Variant).

    As a result, in the Maya AE for the aforementioned transform node you will find a new "Multiverse" section with the "VariantSet Definition" specifying the VariantSet name and its optional default value.

  2. Always performing a selection in Outliner we will create Variants on the children node(s) of the node we created a VariantSet onto. Using the above example we will select leather_cushion, then in Multiverse Shelf click on Variant> Create Attribute Variant: select the VariantSet for which you want to assign your attribute variants and finally create your variant names, for example you we could set the variant names to be "new" and "ruined" leather.

    As a result, in the Maya AE you will find, on the shape node which you selected in Outliner, a new "Multiverse" section with the "Attribute Variant Nodes" subsection specifying a node for each variant you have created. For each variant we'll have the VariantSet target, the Variant name and a button that links to the connected node - that will hold the attributes which will be filled in the next step.

  3. Click on the aforementioned button to open the mvUsdVariantAttributes node: here under "Multiverse> Usd Attributes" you can create your attributes, specifying name, type and value. Repeat this step for each attribute variant that you have created.

    TIP

    Remember you can use the primvars: prefix in the name so to make a Attribute Variant that can be queried in shading networks.

  4. Write the Asset.

  5. Read the USD file back and verify in MEOW that your Variants were written as you desired, to do this use the MMB-click to see your "item info" for the selected item: you should see the attribute type/name/value you have set. You can use attributes for pipeline workflows, conditional logic, and for shading purpose (see an example below in this document).

# Writing Composition with Hierarchy Variants

In Multiverse a USD Composition is a hierarchy of Maya transform and Multiverse Compound shape nodes.

Hierarchy VariantSets and Variants are always defined on transform nodes.

In case you already have generated USD files and want to use them to define Hierarchy Variants, Multiverse offers the possibility to do so by letting you read them as Compounds, organize them into a hierarchy, specify variant attributes on them and finally write the result as a composition. Here are the steps to follow:

  1. Read some USD files, you will see some Compound Shapes (CS) nodes in Outliner.

  2. Select the compounds and group them: you can organize them into any hierarchy of transforms and Compounds, such as:

    animal (T)
    ├── dog (T+CS)
    ├── cat (T+CS)
    └── mouse (T+CS)
    
    1
    2
    3
    4
  3. Select a Maya transform node that is a parent for your hierarchy variants, such as animal in the above example, then in the Multiverse Shelf click on Variant> Define VariantSet to define its name (optionally you may set the default Variant).

    As a result, in the Maya AE for the aforementioned transform node you will find a new "Multiverse" section with the "VariantSet Definition" specifying the VariantSet name and its optional default value.

  4. Always performing a selection in Outliner we will create Variants on the children Compound nodes of the node we created a VariantSet onto, using the above example the selection would be the dog, cat and mouse, then in Multiverse Shelf click on Variant> Create Hierarchy Variant: select the VariantSet for which you want to assign your variants, and name them accordingly.

    As a result, in the Maya AE you will find, on the transform nodes associated to each Compound you have selected in Outliner, a new "Multiverse" section with the "Hierarchy Variant" subsection specifying the VariantSet Target name and the Variant name.

  5. Write the Composition.

  6. Read the USD file back and verify in MEOW that your Variants were written as you desired, to do this try to switch Variant Selection in MEOW to see the hierarchy change dynamically in the MEOW tree, in the viewport and when rendering.

# Writing Override with Attribute Variants

In Multiverse a USD Override is a set of USD attributes that are applied to a compatible hierarchy that is encapsulated in the USD file you are overriding. Overrides can be set in MEOW and then written as USD files.

VariantSets can be defined on any item encapsulated in a Compound, however we suggest to define VariantSets on xform nodes. Attribute Variants can also be defined on any item encapsulated in a compound, however remember that only shapes items can hold "primvars" attributes for lookdev / rendering.

In case you already have generated a USD file and want to define some Attribute Variants in it, Multiverse offers the possibility to do so on Compounds directly from MEOW, where you specify VariantSets, their attributes and finally write the result as a override, here are the steps:

  1. Read a USD files, you will see a Compound Shapes node in outliner.

  2. Select it and open MEOW, expand the hierarchy (double click on the root) to choose the item where to create your VariantSet (we suggest a transform).

  3. RMB on the item and click on "Variants> Define VariantSet": give it a name and, optionally, a default value.

    As a result a single mvUsdVariantAttribute node will be created and connected to the Compound node. In the Attribute Editor under the "Multiverse> VariantSets" subsection you will see your VariantSet Name and Default.

  4. Always in MEOW select the item where you want to add your Attribute Variant (we suggest a shape), then RMB on the item and click on "Variants> Create Attribute Variant": select the VariantSet and give a name to your Variant.

    As a result two mvUsdVariantAttribute nodes will be created and chained together:

    • In the Attribute Editor of the first node, under "Multiverse> Attribute Variant Nodes" you will see the VariantSet Target, Name and the associated secondary node that will old the attributes, along with a button to open its AE.
    • When clicking the aforementioned button the AE of the second node will be presented.
  5. On the second mvUsdVariantAttribute node, under "Multiverse> Usd Attributes" click on the "Add New Item" button and create the attribute that will be used by your Variant: specify name, type and value. Do this for each attribute variant that you have created.

    TIP

    Remember you can use the primvars: prefix in the name so to make a Attribute Variant that can be queried in shading networks.

  6. Select the Compound and Write Override (make sure the Variant Definition option is on in case you are writing selective overrides).

  7. If you had the "auto-sync" option ON in the previous step the Compound will automatically refresh with the override, otherwise just add it as a layer on top in the Compound Attribute Editor.

  8. Now you can verify in MEOW that your Variants were written as desired, to do this use the MMB-click to see your "item info" for the selected item: you should see the attribute type/name/value you have set. You can use attributes for pipeline workflows, conditional logic, and you can also query them from shading networks if their attribute name is prefixed with the primvars: keyword.

# Selecting Variants

Once data is written into USD files, Variants can be easily selected in MEOW and the MEOW item tree will show icons hinting at the presence of Variants, simply RMB and follow the menu to switch your variants:

  • Hierarchy Variants will be visible in the viewport, when rendering and in the MEOW item tree itself as they may alter the hierarchy.

  • Attribute Variants are USD attributes and will be visible in MEOW's "item info" window ("RMB> View Item info", or MMB on item) where you can verify the name/type/values of attribute variants.

    Attribute variants names that have are prefixed with the primvars: keyword can also be queried from shading networks using the various renderer's primvar nodes.

Last Updated: 10/9/2020, 1:22:27 PM