Variant Set

Variant Sets provide a mechanism to switch between alternative representations of a prim based on specific criteria or conditions.

A Variant Set in OpenUSD represents a collection of alternative representations or configurations for a prim. For example, a Variant Set could include different material variations, different levels of detail (LODs), or different geometric representations of a model.

Each variant in a Variant Set consists of two components: a variant name and a variant value. The variant name is a unique identifier that represents the type or category of the variant, such as “material” or “LOD.” The variant value represents a specific choice or option within that category, such as “red material” or “high LOD.”

By defining Variant Sets and their corresponding variants, you can represent different possibilities for a prim’s appearance, behavior, or structure. These variations can be accessed and activated at runtime or during the scene authoring process, enabling you to switch between different representations of a prim based on your requirements.

OpenUSD provides methods and APIs to work with variants, allowing you to:

Define Variant Sets

You can define Variant Sets on a prim, specifying the categories or types of variations you want to represent. For example, you can define a Variant Set for different material options, different animation states, or different geometric representations.

Set Variant Selections

You can set specific variants for each Variant Set, choosing the desired variation for a prim and its ancestors. This involves specifying the variant name and its corresponding variant value. For example, you can set the material variant selection to “red material” or the LOD variant selection to “high LOD.”

Query Variant Information

OpenUSD provides methods to query variant information for a prim, allowing you to retrieve the available Variant Sets, the possible choices within each set, and the current variant selection for each set.

Switch Variants

You can switch between different variants at runtime or during the scene authoring process. This enables you to activate different representations or configurations of a prim based on specific criteria or conditions.

Variant Sets offer a powerful way to manage and control the variations within a scene, providing flexibility and efficiency in creating different looks, behaviors, or levels of detail for prims. They enable you to represent alternative options, easily switch between them, and manage complex scene variations with ease using OpenUSD.