Share

Work with variants in Bifrost-USD

A variant is one of several variations of a prim, such as any of a set of characters used to populate a crowd. A prim can have multiple variant sets, for example, one variant set for the base mesh, another for the costume, and so on. Within each variant set, a variant is a named choice that is available for selection.

Create a variant set and populate it with variants

  1. Add a define_usd_prim node to the graph, and connect its output directly to an add_to_stage node or to the children port of another define_usd_prim node.

    This prim will serve as the container for the resolved variant. You can leave the type as "Xform" to easily move the resolved variant.

  2. Right-click on the variant_set_definitions port and choose Usd::VariantSet::define_usd_variant_set.

  3. In the define_usd_variant_set node, set variant_set_name to the name to use for the variant set, such as "shape".

  4. Set selection to the name of the variant within the set to use as the default. (Note that you haven't created a variant with this name yet.)

  5. Right-click on the children and choose an option from the Create Node menu to create a prim definition for each variant in the set. In the child prim definition nodes, set the variant_set_name to the name of the variant set that you created and the variant_name to the name of the individual variant that the child prim represents. One of the individual variant names should be the name of the variant that you set as the default.

  6. To create additional variant sets, add additional define_usd_variant_set nodes to the variant_set_definitions port of the container prim definition, as well as additional prim definitions as children.

Switch between variants

To select a variant procedurally, use a set_variant_selection node. Specify the path of the affected prim, the variant set name, and the name of the variant to select.

You can also select the variant on-the-fly in the host scene. Right-click on the variant container in Maya's outliner (its icon has an overlaid badge to show that it has variants), and select an option from the Variant Set menu. Like any other change made in Maya, this is not stored in the stage output from the graph.

Selecting a variant in Maya's Outliner

Was this information helpful?