Skip to content

USD Chunks⚓︎

usd_chunks turns a short Python module into a node in a graph, a panel of widgets, and a command you can run from the terminal. Chunks are .py files that load at runtime from the folders you point it at, in usdview or another host.

New here? The quick start takes you from nothing to a chunk on screen.

Guides⚓︎

  1. Install: quick start, fixing things that don't show up, every environment variable, building the docs. In Houdini or Blender, use Houdini or Blender instead.
  2. Using the node graph: creating and connecting nodes, shortcuts.
  3. Output, View and ChunkGroup: the chunks that organise a graph instead of changing the stage.
  4. Expressions: make one param read another, like @Box.size@ * 2, and use USD's ${NAME} variables.
  5. Scripting: build a network from Python with Scene, in a script or in usdview.
  6. Pipeline examples: CAD to render, a product configurator, URDF for Isaac Sim, batch jobs, scatter, breakage, buildings and water, each a script you can run.
  7. Chunks, params and groups: what a Chunk is, an example, and a list of params and flags.
  8. Writing a chunk: a chunk module's main(), config(), execute() and commit().
  9. Building a chunk at runtime: try an idea in the Python interpreter before making it a module.
  10. Making a chunk fast: author specs in one change block, do the maths in numpy, and what doesn't help (threads).
  11. Undo and redo: what Ctrl+Z covers (chunk edits only, by design), on which hosts, and what to use for the rest.

In short: a chunk is a Python module. main() sets up its params, execute(node) does the work, and config() holds details like its description and category.

The graph is USD⚓︎

usd_chunks has no file format of its own. The saved graph is plain USD:

  • A node is a prim. Each chunk is a Chunk-typed prim. Its params are inputs: attributes on the prim, and its position is stored with UsdUINodeGraphNodeAPI.
  • A wire is a USD connection. Execution order follows inputs:chunk → outputs:chunk. Passing a value from one chunk's param to another is a connection plus an expression.
  • Each chunk writes into its own layer. The layers compose into the final result.

At runtime usd_chunks also keeps a dependency graph in Python (DagNode) to know what needs to recook. It is rebuilt from the USD connections when a scene loads, so saving the stage saves the graph. What a chunk makes is ordinary USD, so a renderer, simulator or another DCC can read the result without usd_chunks installed.

Interactive or headless⚓︎

You write a chunk once and it runs as a panel, as a node, or from the command line with no UI at all:

usdchunks run layout.usda Transform.tx=5 -o result.usda
usdchunks run layout.usda --procedural -o network.usda

The first command flattens the result and removes the Chunk prims. The second keeps them, so the network can be opened again and re-cooked.

Procedural chunks rebuild their output when the file loads, so a saved network stores the steps, not a baked result. Chunks that write files to disk do it in a separate commit function. usdchunks run calls it once, after every chunk has cooked. See commit().

One network, many files⚓︎

usdchunks batch cooks a network once for each file that a glob in it matches:

usdchunks batch proxy.usda Reference.file_path='assets/*.usdc' -o 'lib/{1}/{1}.usda' --relative

The glob that matches files decides how many runs there are. The other patterns are filled from what its wildcards matched. Wildcards are used left to right, and {1} names the first match, so it can be used twice. Above, assets/fern.usdc becomes lib/fern/fern.usda. Patterns are read relative to the network's folder.

--relative writes each file's asset paths relative to it, so the library moves as one folder. A file whose result is a single root prim names it as its default prim, so a scene can reference it without a prim path.

Each run is its own usdchunks run and cooks once. --jobs sets how many run at a time. --dry-run prints the plan, including the folder the patterns were read against and every file matched, and stops there.

Background⚓︎

usd_chunks started as a way to add tools to usdview without writing a plugInfo.json and Qt code for every one. It has grown past that: a chunk works on a USD stage, and usdview is one of several places you can run it.