What You Can Author in USD#
Everything SPG reads from a scene. Attributes not listed here are not read by SPG.
Ports#
A node is one unit of GPU work with named ports. Ports are declared in the USD shader definition and come in three kinds.
Kind |
Declared as |
Carries |
|---|---|---|
Resource-input |
|
An AOV or a buffer another node produced. |
Value-input |
a typed attribute, such as |
A number, vector, matrix or token authored in USD. |
Resource-output |
|
What this node writes. |
The port name is the contract. It is what the scene connects to, and what the launch script keys on. Nothing is matched by position at this level; position only matters inside a launch script, where the GPU code’s parameters or declarations are matched in order.
The Shader Prim#
Attribute |
Meaning |
|---|---|
|
|
|
The GPU source. The extension selects the language. May be a path, a file inside a package, or a URI; refer to Where Assets May Live. |
|
The entry point to invoke. Must match the GPU source and the Lua function name. Optional:
without it the prim’s own name is used, so a prim named |
|
The built-in node, as |
|
A resource-input: an AOV, a buffer, or a sensor composite. |
|
A resource-output the node writes. |
a typed attribute, such as |
A value-input. The types are below. |
The launch script is not authored. It is found by appending .lua to
info:spg:sourceAsset, so the pairing is by file name and cannot be redirected.
Shader prims must not be nested under a Material prim, and a shader under an instance
prototype is ignored.
params:X is accepted in place of inputs:X and maps to it. It is the older spelling, kept so
existing scenes load; author inputs:. Where a scene has both, inputs: wins, and inputs:X
is the only name that can be written at runtime either way. Refer to Change Values and Rewire.
Value-Input Types#
A value-input is any attribute under inputs: that is not opaque. Its USD type decides what
the launch script is handed and what the GPU code has to declare.
USD type |
Arrives as |
Notes |
|---|---|---|
|
|
|
|
the matching integer |
The 64-bit forms bind on CUDA and not on Slang. Refer to The slang Lua Table. |
|
the matching float |
|
|
|
|
|
the matching vector |
|
|
|
USD has no float matrix type, so a shader’s |
|
|
Four components. The text order is not the memory order: USDA writes |
|
a null-terminated |
Bound with |
|
the file’s raw bytes, read as the dtype you name |
SPG resolves the path and uploads the contents. It may be a path, a file inside a package, or a URI; refer to Where Assets May Live and Upload Your Own Data. |
an array, such as |
a buffer |
Read on Slang as a |
Types that share a base type behave alike, so color3f, point3f, normal3f and
texCoord3f all arrive as a three-component float, exactly as float3 does. A type whose base
type is none of the above is not read, and the log says so by name.
Where Assets May Live#
Two things a shader prim can name are files: info:spg:sourceAsset, the GPU source, and any
asset value-input, which is data to upload. Both are resolved the same way, and either may
come from any of three places.
Written as |
Reads from |
|---|---|
|
A path, resolved relative to the file that names it. |
|
A file inside a USD package, alongside the scene that references it. |
|
A URI. |
The launch script follows its source. It is found by appending .lua to whatever
info:spg:sourceAsset says, so a kernel loaded from a server takes its script from that same
server. Inside a package the suffix goes within the brackets, so pkg.usdz[Kernel.cu] pairs
with pkg.usdz[Kernel.cu.lua].
A data file is read as raw bytes wherever it came from. Nothing parses a format, so the location changes nothing about how the launch script reads it. Refer to Upload Your Own Data.
The RenderVar Prim#
Attribute |
Meaning |
|---|---|
|
The AOV name. Required, both to publish a new AOV and to name an existing one. |
|
Exposes a renderer AOV as connectable, for a node to read. |
|
Connects a node output to this RenderVar, publishing it. |
|
For a sensor composite, which channels it carries. Refer to Read a Sensor Composite. |
The RenderProduct Prim#
Attribute |
Meaning |
|---|---|
|
The camera, or the sensor, this product renders from. |
|
Which RenderVars the product produces. Every RenderVar a graph consumes or publishes belongs here; intermediates do not. |
|
The product’s resolution. |
Connections#
The pattern a graph is wired with, in order:
RenderVar.omni:rtx:aov -> Shader.inputs:X
Shader.outputs:Y -> Shader.inputs:Z (chaining, stays internal)
Shader.outputs:Y -> RenderVar.omni:rtx:aov.connect (publishing)
A shader-to-shader connection groups both prims into one graph. A node output can be bound to one RenderVar at a time.