USD Intro
Stage — USD scenegraph (composed view of scene)
Prim
- Named (unique — only one with same name and path), can be geometry, transform etc.
- Hierarchical (ie. /World/Camera)
- Typed (Mesh, Xform, Material) — determines their behavior
- Stores metadata
Properties — attributes and relationships
Composition Arc (see below) — brings things into stage
Layer — usually a file
Schema — IsA or API
In the documentation on SideFX.com, there is a "quick example", however I was not able to use the two_boxes part of it verbatim (perhaps there is a way, however I found a solution that works). Here is what I found works with usda files and hipnc supplied below.
box.usda works great! Here are my versions:
#usda 1.0 is a header.
This "def" defines a new prim called box. The "attributes" now called properties are defined in the curly brace. Coming from a C++ background, I tend to match my curly braces with each on its own line (personal preference). Within the braces is the prim contents.
def is a specified Sphere "IsA" schema.
The two box example as listed in the docs as of this posting I could not get to read in properly. The syntax I used was:
This defines the two boxes by referencing the other usda file where box is defined as a primitive. If you look at the hip file provided with the usda files you will see this can be imported into Solaris with a file node or alternatively into Obj/geo context with a USD import node. Both render perfectly in Karma (ignore the odd looking corners in the Vulcan viewport).
This is a good start to understanding the layering of USD file format. We will delve deeper as we talk about command line rendering. Note that you are more likely to be using usd (or usdc) rather than ascii readable file as binary will be smaller. In addition, you will be generating the usd source from the interface with a usd rop rather than these that were created in notepad++.
In these examples references is the metadata name and the value is the path with target prim. So @./box.usda@ is the reference path and </box> is the target prim.
For more examples see USD and Python.
Take a moment to look at what some of the composition arc possibilities are:
- sublayers — think Photoshop: lighting layer, shading layer, studio departments
- references — automatically loaded (even if not active), enable instancing
- payloads — type of reference that can be loaded or unloaded on demand
- Why not always use it? Smaller project, need assets on opening or immediate access — it requires an extra step
- inherits — a prim inherits the base properties of a prim (similar to OOP)
- variantSets — allow creating alternative versions of a prim or its sub-hierarchy
- specializes — establishes a relationship between a base prim and a derived prim allowing refinement of base
LIVRPS — Local, Inherits, Variants, References, Payloads, Specializes
(Similar to order of operations PEMDAS — parentheses, exponents, multiplication / division, addition / subtraction)