Working with prims, properties, and primvars: Worked Example — Data Modeling (NVIDIA-Certified Professional: OpenUSD Development)

Working with Prims, Properties, and Primvars in OpenUSD: A Step-by-Step Worked Example In the context of the NVIDIA-Certified Professional: OpenUSD...

Working with Prims, Properties, and Primvars in OpenUSD: A Step-by-Step Worked Example

In the context of the NVIDIA-Certified Professional: OpenUSD Development exam, mastering how to work with prims, properties, and primvars is essential for effective data modeling within the Universal Scene Description (USD) framework. This example illustrates a practical scenario where you create and manipulate these elements to build a simple 3D model representation.

Scenario:

You are tasked with defining a cube prim in a USD stage, assigning it a size property, and adding a primvar to control its color per vertex.

Step 1: Creating the USD Stage and Defining the Cube Prim

First, initialize a USD stage (in-memory or file-based) and define a prim of type Xform to represent the cube's transform node.

This prim acts as a container for the cube's properties and geometry.

Step 2: Adding a Size Property

Next, add a custom float property named size to specify the cube's edge length.

This property can be used by downstream applications to scale or interpret the cube's dimensions.

Step 3: Defining Primvars for Per-Vertex Color

Primvars are specialized properties designed to store per-primitive or per-vertex data. Here, we add a color primvar to define vertex colors.

Example Color Array

colors = [Gf.Vec3f(1,0,0), Gf.Vec3f(0,1,0), Gf.Vec3f(0,0,1), Gf.Vec3f(1,1,0), Gf.Vec3f(1,0,1), Gf.Vec3f(0,1,1), Gf.Vec3f(0.5,0.5,0.5), Gf.Vec3f(1,1,1)]

Assign these colors to the primvar:

colorPrimvar.Set(colors)

Step 4: Saving and Verifying the Stage

Save the stage to disk and verify the structure:

Summary of Key Concepts Applied

This example demonstrates the practical steps to create and manipulate prims, properties, and primvars in OpenUSD, a core skill for the NVIDIA-Certified Professional: OpenUSD Development exam.

More in this topic

Related topics:

#OpenUSD #data-modeling #prims #primvars #NVIDIA-Certified-Professional

Ready to test your knowledge?

Put what you've learned into practice with a quick quiz and track your progress.

Test your knowledge →