A .usda layer is the text form of a USD layer; a .usd file may
hold the same text. The Alliance for OpenUSD defines it in the OpenUSD Core
Specification (version 1.1), whose text format section gives a full grammar; this page
follows it. The format is not sensitive to indentation.
Header line and encoding
The first line is #usda, a space and the version as
MAJOR.MINOR with an optional .PATCH, normally
#usda 1.0. A reader must accept earlier versions with the same major
number. Spline tangent algorithm tokens need version 1.1 or later.
The text is UTF-8; the “a” of the name is historical. Lines may end with CR, LF or CR LF. Spaces and tabs separate tokens, and statements are separated by a line break or a semicolon.
Comments, names and literals
| Element | Written as |
|---|---|
| comment | # to the end of the line; also // to the end of the line and /* … */, which the specification suggests deprecating |
| identifier | a letter (Unicode XID_Start) or underscore, then letters, digits and underscores (XID_Continue); keywords cannot be used |
| namespaced name | identifiers joined by colons, as in primvars:st or xformOp:translate |
| string | '…' or "…" on one line; '''…''' or """…""" across lines |
| string escapes | a backslash then a b f n r t v ' ", or x and one or two hex digits, or one to three octal digits |
| asset path | @texture.png@, with no @ inside; or @@@…@@@, which may contain single or double @ |
| path | in angle brackets: </World/Chair>, </World.size>, <> |
| number | optional minus, digits, optional fraction (a leading .5 is allowed), optional exponent with e or E; and inf, -inf, nan in lower case |
| tuple | (1, 2, 3), values or nested tuples |
| list | [1, 2, 3] or [(0, 0), (1, 0)]; [] is empty |
| dictionary | { string author = "Ann" dictionary inner = { … } }: each entry a type, a key and a value |
None | blocks weaker opinions of an attribute or relationship; also a list operation value |
The grammar does not tell integers from real numbers; a value takes its type from the attribute or field it is assigned to.
Layer metadata
After the header, an optional parenthesised block holds the layer’s metadata: a
documentation string on its own, doc = "…", subLayers = [@a.usda@,
@b.usda@ (offset = 10; scale = 2)], relocates, and any other field
as name = value, such as defaultPrim, upAxis,
metersPerUnit, timeCodesPerSecond,
startTimeCode and endTimeCode. Then come the root prims.
Prims
def Mesh "Floor" (
kind = "component"
references = @floor.usda@</Floor>
)
{
point3f[] points = [(0, 0, 0), (1, 0, 0), (1, 0, 1), (0, 0, 1)]
}
A prim begins with its specifier: def defines it, over
only overrides what another layer defines, and class makes a class for
other prims to inherit. An optional type name such as Xform or
Mesh follows, then the name in quotes, optional metadata in parentheses
and the body in braces, which holds properties, child prims, variant sets and reorder
statements.
Prim metadata includes doc, kind, references,
payload, inherits, specializes,
variants (the selected variant of each set),
variantSets, and any other field as name = value. A reference
or payload item is an asset path, a prim path, or both
(@car.usdz@</models/window>), optionally followed by parameters in
parentheses: a layer offset (offset and scale) for both,
and customData for references.
Attributes
An attribute is declared as an optional custom, an optional
uniform (the value does not change over time; the default is varying),
a type name with [] for an array, and a name, then optionally
= and a default value or None, and optional metadata in
parentheses. Other forms add to it:
| Form | Meaning |
|---|---|
double radius = 0.5 | a default value |
double radius.timeSamples = { 1: 0.5, 24: 2 } | values at time codes |
color3f inputs:diffuseColor.connect = </Mat/Tex.outputs:rgb> | a connection to another attribute |
double radius.spline = { … } | an animation spline: knots with bezier, hermite, held or linear segments, and pre and post extrapolation (none, held, linear, sloped, loop with repeat, reset or oscillate) |
Value types come from the specification’s foundational data types, such as
bool, int, float, double,
half, string, token, asset,
timecode, double3, matrix4d,
quatf, and role names such as point3f,
normal3f, vector3f, color3f and
texCoord2f.
Relationships
rel or custom rel and a name declares a relationship,
optionally assigned None, one path or a list of paths:
rel material:binding = </Looks/Wood>.
List operations
Fields that hold lists, such as references, inherits,
apiSchemas and relationship targets, can be set outright or edited. The
prefixes prepend, append and delete add to the
front, add to the back or remove from what weaker layers say;
add and reorder are legacy forms. Without a prefix the list
replaces the weaker ones.
Variant sets and reordering
variantSet "colour" = {
"red" {
color3f[] primvars:displayColor = [(1, 0, 0)]
}
"blue" {
color3f[] primvars:displayColor = [(0, 0, 1)]
}
}
reorder nameChildren = ["Wheels", "Body"]
reorder properties = ["size", "colour"]
Each variant’s body can hold anything a prim body can, including nested variant sets.
Keywords
| Group | Keywords |
|---|---|
| core | append, class, connect, custom, customData, default, def, delete, dictionary, doc, inherits, kind, nameChildren, None, offset, over, payload, prepend, properties, references, relocates, rel, reorder, rootPrims, scale, subLayers, specializes, timeSamples, uniform, variantSet, variantSets, variants, varying |
| legacy | add, config, displayUnit, permission, prefixSubstitutions, reorder, suffixSubstitutions, symmetryArguments, symmetryFunction |
| splines | spline, pre, post, bezier, hermite, held, linear, sloped, loop, none, curve, repeat, reset, oscillate, custom, autoEase |