Pixar's Universal Scene Description (USD) Core Python Library

26.3 · active · verified Mon Apr 13

Pixar's Universal Scene Description (USD) is a robust system designed for scalably encoding and interchanging static and time-sampled 3D geometry, shading, and lighting data across various Digital Content Creation applications. The `usd-core` package, available on PyPI, provides the fundamental Python bindings for authoring, composing, and reading USD data. It is actively maintained by Pixar Animation Studios, with new versions typically released every 3-4 months. The current version is 26.3, continuously evolving the OpenUSD ecosystem.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple USD stage, define a transform (Xform) and a sphere (UsdGeom.Sphere) prim, set an attribute, and save the stage to a .usda file. All core USD Python modules are accessed via the `pxr` namespace.

from pxr import Usd, UsdGeom
import os

# Create a new USD stage in memory or on disk
output_filename = os.environ.get('USD_OUTPUT_FILE', 'HelloWorld.usda')
stage = Usd.Stage.CreateNew(output_filename)

# Define a root transform prim at the path /hello
xformPrim = UsdGeom.Xform.Define(stage, '/hello')

# Define a sphere prim nested under the transform at /hello/world
spherePrim = UsdGeom.Sphere.Define(stage, '/hello/world')

# Set a radius for the sphere
spherePrim.GetRadiusAttr().Set(2.0)

# Save the stage to a file
stage.GetRootLayer().Save()

print(f"Created {output_filename} with a sphere at /hello/world")

view raw JSON →