# USD Structure

The stage structure of the OpenUSD Digital Twin mostly follows the [Guidelines for Structuring USD Assets](https://github.com/usd-wg/assets/blob/main/docs/asset-structure-guidelines.md) from the USD Assets Working Group.

Flat and accessible hierarchies are a key aspect of the stage structure as shown in the diagram below highlighting the commonly used nodes and their names.

```
/asset                                  (xform) ← No transformation applied
    /geo                                (xform)
        /render                         (scope) ← Purpose: render
            /mesh_1                     (mesh)
                /grip_material          (material) ← Reference to /asset/materials/grip_material + overwrites
            /mesh_2                     (mesh)
                /grip_material          (material) ← Reference to /asset/materials/grip_material + overwrites
            /artwork_mesh_1             (mesh)
                /grip_artwork_material  (material) ← Reference to /asset/materials/grip_artwork_material
            /artwork_mesh_2             (mesh)
                /grip_artwork_material  (material) ← Reference to /asset/materials/grip_artwork_material
            ...
    /materials                          (scope)
        /_artwork_controller            (shader)
        /grip_material                  (material)
        /grip_artwork_material          (material)
```

Each Digital Twin has a root `Xformable` prim, which is specified as the `defaultPrim` and has no transformation applied. Root-level siblings are not allowed because the `defaultPrim` is later referenced into other stages, where sibling prims would be discarded.

## Scope `geo` for all meshes

Under the `geo` `Scope` prim, there is an additional `Scope` prim named `render`. This prim has an [Imageable purpose](https://openusd.org/release/user_guides/render_user_guide.html#render-purpose) named `render`. In the current version of the specification, only the `render` purpose is supported. The structure may be extended in the future to include additional children under the `geo` `Scope` for other purposes.

### Meshes

All `UsdMesh` prims are located in a flat hierarchy beneath the `render` `Scope`. To ensure consistent display, each mesh uses the `subdivisionScheme` value `none`, meaning that it is a non-subdivided polygon mesh. All meshes include a UV set named `st`, with UV coordinates laid out within the 0–1 range.

To support [variant selection](../variants/README.md), some meshes are hidden or inactive based on the selected shape variants in the stage.

### Mesh materials

Each mesh has a single `UsdMaterial` as an immediate child. This material is bound to the mesh and defines its appearance. The material is a reference to the general `UsdMaterial` at `/asset/materials/grip_material`, which contains implementations for all supported render contexts. See the [Universal Material Model](../universalmaterial/README.md) section for more details. To give each mesh an individual appearance, the child material provides overrides for the `UsdUVTexture` prims in the referenced material. Change these overrides to apply different values or attach textures to those inputs.

## Scope `materials` for default materials

Under the `defaultPrim` `asset` is a `Scope` named `materials`. It holds all materials, including their available render-context implementations.

### Material `grip_material`

This `UsdMaterial` contains the shading networks for all current render-context implementations of Grip's [Universal Material Model](../universalmaterial/README.md). Parameters on its child shaders should not be modified here; mesh-specific values are set through the references grouped under each mesh.

### Material `grip_artwork_material`

This is a specialized version of the Grip material for [interchangeable label artworks](../labelartworks/README.md). It automatically uses textures that encode several material properties in one of four quadrants (see the [texture format](../labelartworks/README.md#texture-format)) and feeds them into the standard Grip material embedded within it.

### Shader `_artwork_controller`

This helper shader defines the artwork asset for `grip_artwork_material`, which is embedded in that material's render-context implementations.

## Example structure

The screenshot below shows the stage structure in NVIDIA Omniverse, including all nodes and the deactivation of several mesh prims through shape variant selection.

![Digital Twin OpenUSD structure in NVidia Omniverse](images/structure_omniverse.png)

```{toctree}
:hidden:

files.md
```
