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
Add a
define_usd_prim
node to the graph, and connect its output directly to anadd_to_stage
node or to thechildren
port of anotherdefine_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.Right-click on the
variant_set_definitions
port and choose Usd::VariantSet::define_usd_variant_set.In the
define_usd_variant_set
node, setvariant_set_name
to the name to use for the variant set, such as "shape".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.)Right-click on the
children
and choose an option from theCreate Node
menu to create a prim definition for each variant in the set. In the child prim definition nodes, set thevariant_set_name
to the name of the variant set that you created and thevariant_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.To create additional variant sets, add additional
define_usd_variant_set
nodes to thevariant_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.