Close

Attribute

Attributes make up the numeric data blocks of POPs. Each POPs has three blocks of data: a Point List which includes the P Position attribute, a Primitive List and a Vertex List. Each of these lists are made of any number of attributes. Each attribute is given a name.

Position (P) is the standard point attribute, and built-in optional attributes include normals (N), texture coordinates (Tex), color (Color), etc. A Color primitive attibute enables each primitive to have a separate color. A N vertex normal attibute enables each vertex to have a separate surface normal vector.

A POP's point list has a length numPoints which is the length of all point attributes, similar for Primitive and Vertex lists.

A point attribute can be a scalar point attribute which is a single number for each point, or a vector point attribute which is 2, 3 or 4 numbers per point, such as the P (X Y Z position) attribute which is a float3 (3-numbers) vector attribute.

A primitive attribute is a list of numPrimitives single scalar numbers or 2- 3- or 4-value vectors.

A vertex attribute is a list of numVertives scalar numbers or vectors for the total vertices of all primitives of a POP.

Each attribute is a separately-allocated list of numbers, so that when one attribute is created or deleted, nothing else is touched.

See Attribute Data Types below. In addition attributes can have a Qualifier, such as a float4 being a Color, or a float3 being an XYZ direction, or a float4 being a rotation quaternion.

For attributes of SOPs see SOP Attribute as this page is focused on POPs.

Attribute Terminolgyedit

  • Built-in Attributes - Attributes that are strictly reserved, like P, PointScale, N and Tex.
  • Common Attributes - Attributes that are commonly used but not strictly controlled by TouchDesigner, like PartMass and PartVel.
  • Read-Only Attributes - attributes that are pre-computed by TouchDesigner (like normalized point number _PointU) that can be used in Math POP. Math Mix, Math Combine POPs and others.
  • Components of Attributes - For attributes that are vectors, a flaot3 has 3 "components", and referred to as P(1) or P.y or P.i2 (see Swizzling)
  • Attribute Class - refers to Point, Primitive and Vertex classes of POP data.
  • Array Attribute - an attribute type that has per-point multiple float or float2 etc
  • Scalar Attribute vs Vector Attribute - single-component, multi-component.

Common Attributesedit

Normals (N)edit

See Normals. A normal is a directional vector associated with a particular geometric entity, commonly perpendicular to it. The normal to a surface at a given point is a vector perpendicular to the surface at that point, and is computed as the cross product of the tangent vectors at that point.

Color (Color)edit

Surface color and alpha specified by RGBA. Values range from 0 to 1. The alpha component Color.a controls the transparency of a given element, where 1 is fully opaque, and 0 is fully transparent.

Texture Coordinates (Tex)edit

Items are located spatially by XYZ values. To differentiate texture coordinate space from XYZ space, the labels U and V and sometimes W are used instead of X and Y and Z. ​ In order to place texture maps (images) onto geometry, we must assign texture coordinates to the geometry. A texture map resides in its own (U, V) texture coordinate space. When assigned to the geometry, the (U, V) coordinates determine how to map the image onto the geometry, where U,V of 0,0 uses the bottom left of the texture image, and 1,1 use the top-right. ​ Most generator POPs like Sphere POP and Plane POP have texture coordinates already assigned to each point or vertex. ​ Texture coordinates can be visualized in the following manner: Texture maps have their own coordinate space. If the texture were a table cloth with a grid pattern, the color at location 3, 4 on the table cloth remains at location 3, 4 even when the cloth is wrapped around an irregularly shaped object. The color at location 3, 4 can be said to be in the table-cloth's coordinate space. ​

Order of Attribute Precedenceedit

The order of precedence for attributes from highest to lowest is:

  1. Vertex Attributes
  2. Point Attributes
  3. Primitive Attributes

Attributes with a higher order of precedence override the same attributes with a lower order of precedence. (Only the Bone Group SOP has Detail attributes from skeletons imported externally.)

Point and vertex attributes are interpolated across primitives, allowing more local flexibility than primitive attributes (e.g. Color). Vertex attributes deal with the situation where shared points need different values for the attributes at the boundary of primitives, like the longitudinal seam of a polar texture map for example. Primitive colors typically take us less memory point colors, and point colors less than vertex colors.

Custom Attributesedit

Below are the Attributes which are currently reserved for TouchDesigner use.


Point Attributesedit

Point Attributes are Attributes on Points in a POP.

Name Type Size Description SOP to Create SOP where Used Notes
P float 3 Point position
Weight float 1 Point weight
N vector 3 Surface Normal Normal POP, Facet POP
Tex float 3 Texture Coordinates Texture Map POP
Color (Color.rgb and Color.a) float 4 Surface color and alpha
PartVel vector 3 Particle Velocity
PartMass float 1 particle mass Particle POP, Force Radial POP
PartDrag float 1 Drag Particle POP, Force Radial POP
PartLife float 1 Life Expectancy Particle POP
PartAge float 1 Age Particle POP
PartId float 1 Particle Identifying Tag Particle POP
PartInitP vector 3 Rest Position
PointScale float 1 Scale of point for rendering

Vertex Attributesedit

A Triangle, Quadrelateral or Line Strip is made of a set of Vertices, and each Vertex refers to a Point.

Name Type Size Description SOP to Create SOP where Used Notes
N vector 3 Surface normal Facet SOP, Attribute Create SOP
uv float 3 Texture coordinates Texture SOP
Cd float 4 Surface color and alpha
creaseweight float 1 Crease weights used in sub-division surfaces. See Subdivide SOP.
T float 4 Tangents Attribute Create SOP two 2D vectors = 4 values
pCapt float 2 Capture data contains index and weight for a transform. See Deforming Geometry (Skinning)

Primitive Attributesedit

You can use the Primitive SOP or the SOP to DAT and DAT to SOP pair to add or modify primitive attributes.

Name Type Size Description SOP to Create SOP where Used Notes
N vector 3 Surface normal
Cd float 4 Surface color and alpha
creaseweight float 1 Crease weights used in sub-division surfaces. See Subdivide SOP.
mat index 1 Material Material SOP

plus Force dir, fedge, fvortex, fspiral xxx


Attribute Data Typesedit

There are three different attribute data types. Each is handled slightly differently internally.

Vector Data This data type represents a 3D vector in space. When any transforms occur on the detail, this attribute will also be transformed. Examples of a vector attribute are normals (N) or velocity (PartVel).
Floating Point Data This data type represents an array of floating point values. The values are not transformed when the geometry gets transformed. Some examples of this type of attribute are diffuse colors (Cd), and texture co-ordinates (Tex).