UsdPrimvarSet
Primvars (short for primitive variables) are particular kinds of attributes that have two main functions:
-
Store data that varies through interpolation - Primvars are used to hold data that varies over the surface of a primitive like UV coordinates or vertex colors.
-
Override attributes on a per-primitive basis - Primvars can override attributes on a particular primitive, meaning you can customize the appearance or behavior of individual primitives within the scene hierarchy independently of others. This lets you change the details on a primitive that may be subject to shared attributes. For example, changing the color of one tree in a forest from green trees to red.
For example, consider a simple line defined by two points (vertices). You could define a color primvar to indicate that the color must change along the line from red to blue and that it is uniformly interpolated:
def BasisCurves "SimpleLine" {
int[] curveVertexCounts = [2] #Number of vertices
point3f[] points = [(0, 0, 0), (1, 1, 1)] #Co-ordinates of the endpoints
# The primvar for color:
color3f[] primvars:color = [(1, 0, 0), (0, 0, 1)] # Red to Blue
uniform token primvars:color:interpolation = "vertex" #Interpolate the color
#between the vertices
}
For more information see Primvar in Pixar’s USD Glossary.
You can set a new primvar, or override the value of an existing one. Alternatively, you may need to remove a primvar’s effect on the stage. These are achieved by selecting Create/Override or Block in the action dropdown.
Like Attributes, the value Primvars can be time-sampled, in that they can vary according to time. For this kind of primvar, set multisample to Yes.
Primvars offer a number of interpolation types to transition data between each data point and one is selected using interpolation. For more details on each, see the table below.
Inputs
Connection Type |
Connection Name |
Function |
input | in | The incoming scene graph data that the node will operate on or modify. |
Controls
Control (UI) |
Default Value |
Function |
---|---|---|
action |
Create/Override |
Choose how you want to apply the primvar update. Create/Override - Create the primvar, or if it exists already, assign the new value. Block - Disable the primvar assignment in the prim(s), removing their effect from stage composition. |
name |
n/a |
Assign a name to the primvar. |
type |
Double |
Choose a data type for the primvar. |
multisample |
Yes |
Select Yes if the data is time-sampled. |
isCustom |
No |
Select Yes if this is a custom primvar. |
interpolation |
constant |
Choose the interpolation type:
Note: The names of these types are different to the convention used by Katana’s arbitrary attributes’ scope. For reference, see Arbitrary Attributes. |
value |
n/a |
Assign a value to the primvar. |