Search Shortcut cmd + k | ctrl + k

Query Universal Scene Description (USD) files with SQL

Maintainer(s): brannn

Compatibility Matrix

This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.

Platform 1.4.4 1.4.5 1.5.5 1.5.6 2.0.0
Linux AMD64
Linux ARM64
macOS AMD64
macOS ARM64
Windows AMD64
Windows ARM64
WebAssembly

Installing and Loading

INSTALL usd FROM community;
LOAD usd;

Example

-- Prims of a USD stage
SELECT prim_path, prim_type, kind FROM usd_prims('scene.usda') LIMIT 10;

-- World-space positions
SELECT prim_path, x, y, z FROM usd_xforms('scene.usda') WHERE prim_path LIKE '/World/%';

-- Typed property values
SELECT prim_path, property_name, value FROM usd_properties('scene.usda', authored_only := true);

About usd

The usd extension reads Universal Scene Description (USD) stages - the scene format created by Pixar and used across 3D content, simulation and digital twin pipelines - and exposes their contents as tables:

  • usd_prims: the prims of a stage, with type, kind, activation, instancing, payloads, applied schemas, custom data and asset info
  • usd_properties: attributes and relationships, with typed values (VARIANT)
  • usd_relationships: relationship targets, for graph analysis
  • usd_xforms: world-space positions, rotations, scales and matrices
  • usd_bounds: world-space bounding boxes
  • usd_variants, usd_layers, usd_stage_metadata and usd_composition_errors: variant sets, the layers a stage uses, stage metadata such as units and up axis, and broken references
  • usd_composition_arcs: the references, payloads, inherits and variant selections of each prim, i.e. which assets a scene uses, where and how often
  • usd_material_bindings: the material each prim is bound to, and the binding that decides it
  • usd_time_samples: the values recorded over time - animation, sensor readings, simulation results

Every function accepts a path, a glob or a list of paths, and options to restrict the scan to a subtree, descend into instances or skip payloads; values, transforms and bounds can be read at one or several time codes. Scans are parallel and only compute the columns a query uses, so scenes with millions of prims spread over hundreds of layers can be queried directly.

OpenUSD 26.05 is linked into the extension, with its schemas for geometry, shading, lights, skeletons, physics, semantic labels, volumes, audio, render settings, procedurals and UI. See the function reference and cookbook.

Added Functions

function_name function_type description comment examples
usd_bounds table The world-space axis-aligned bounding box of each imageable prim. NULL [usd_bounds('scene.usda', purposes := ['default', 'render', 'proxy'])]
usd_composition_arcs table One row per composition arc of each prim: references, payloads, inherits, specializes and variant selections, strongest first. NULL [usd_composition_arcs('scene.usda', instance_proxies := true)]
usd_composition_errors table One row per error USD encountered while composing a stage, such as a reference to a missing file. NULL [usd_composition_errors('scene.usda')]
usd_layers table One row per layer a stage uses: the root layer, its sublayers and the layers of references and payloads. NULL [usd_layers('scene.usda')]
usd_material_bindings table The material each prim is bound to, and the binding that decides it. NULL [usd_material_bindings('scene.usda', material_purpose := 'preview')]
usd_prims table One row per prim of a USD stage: its path, type, kind, specifier, activation, instancing, payloads, applied schemas, custom data and asset info. NULL [usd_prims('scene.usda')]
usd_properties table One row per property (attribute or relationship) of each prim, with its type, flags, time samples and typed value. NULL [usd_properties('scene.usda', authored_only := true)]
usd_relationships table One row per target of each relationship. NULL [usd_relationships('scene.usda')]
usd_stage_metadata table One row per stage: default prim, up axis, meters per unit, time codes and custom layer data. NULL [usd_stage_metadata('scenes/*.usd', filename := true)]
usd_time_samples table One row per time sample (or spline knot) of each attribute, with its time and typed value. NULL [usd_time_samples('scene.usda', start_time := 0, end_time := 24)]
usd_variants table One row per variant set of each prim, with its selection and variants. NULL [usd_variants('scene.usda')]
usd_version scalar The version of OpenUSD the extension was built with. NULL [usd_version()]
usd_xforms table The world-space position, rotation, scale and matrices of each xformable prim. NULL [usd_xforms('scene.usda', root := '/World')]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

name description input_type scope aliases typed_value
temp_directory Set the directory to which temporary files are written. VARCHAR GLOBAL [] post.db.tmp
usd_stage_cache Keep opened USD stages in memory between queries, until a file they read changes. Cached stages count toward memory_limit and are evicted when DuckDB needs the memory; turning this off frees them. BOOLEAN GLOBAL [] true