Vertex SOP

From TouchDesigner 088 Wiki

Summary

The Vertex SOP allows you to edit/create attributes on a per-vertex (rather than per-point) basis. It is similar to the Point SOP in this respect. It supports two inputs, and will inherit the first input source by default. If the second input have less primitives than the first input, it will cycle through the primitives and match the vertices. If the primitive in the first input has more vertices than the matching primitive in the second input, the extra vertices are ignored.

There are currently three vertex attributes supported:

  • Diffuse Color
  • Alpha
  • Texture Coordinates

When the attribute is defined, it can only occur on either points or vertices, but not both. Thus, if the input geometry has a point attribute for diffuse color, the attribute will automatically be "elevated" to be a vertex attribute (if diffuse colors are added in the Vertex SOP).

The SOP processes every vertex of every primitive. For each vertex processed, there are variables which allow you to know the:

  • Vertex number of the primitive being processed
  • The number of vertices in the primitive being processed
  • The point which is referenced by the vertex
  • The primitive which contains the vertex
  • The total number of points
  • The total number of primitives

There are also local variables to find out the values of some point attributes (i.e. position, normal - if they exist), in addition to vertex attributes. To access the attributes of the second input source, append a 2 to the variable.

PythonIcon.png vertexSOP_Class

Parameters

Group /group - If there are input groups, specifying a group name in this field will cause this SOP to act only upon the group specified. Accepts patterns, as described in Pattern Matching.

Keep / Add / No Vertex Color /doclr /diff - Select from the pop-up menu in order to pass through, create, or remove vertex color attributes from incoming geometry.

Keep / Add / No Alpha /doalpha /alpha - Select from the pop-up menu in order to pass through, create, or remove vertex alpha (transparency) attributes from incoming geometry.

Using the local variables $CA in an expression allows you to alter the existing vertex alpha attribute.

Keep / Add / No Texture /douvw /map - Select from the pop-up menu in order to pass through, create, or remove vertex texture attributes from incoming geometry.

Using the local variables $MAPU, $MAPV, and $MAPW in an expression allows you to alter the existing vertex texture attribute.

Keep / Add / No Crease /docrease /crease - Select from the pop-up menu in order to pass through, create, or remove crease attributes from incoming geometry.

The Crease Weight attribute can be used to set individual edge crease weights for sub-division surfaces (see Subdivide SOP ). This vertex attribute defines the weight for the edge which goes from that vertex to the next vertex in the polygon. For example, with a triangle (which has vertices 0, 1, 2), the attribute for vertex 1 defines the crease weight for the edge (1, 2). The attribute for vertex 2 defines the crease weight for edge (2, 0). The crease weight should be greater than 0. The larger the value for crease weights, the sharper the edge will be when sub-divided.

Crease attributes can be visualized by passing them into a Subdivide SOP.

Local Variables

$PT, $NPT - Point number & total number of points.
$PR, $NPR - Primitive number & total number of primitives.
$VTX, $NVTX - Vertex number & total number of vertices.
$CEX, $CEY, $CEZ - Centroid of the SOP.
$BBX, $BBY, $BBZ - Relative position of point within bounding box. Values are mapped between 0 and 1.
$TX, $TY, $TZ - Point position.
$NX, $NY, $NZ - Point normal directions.
$MAPU, $MAPV, $MAPW - Point or vertex texture coordinates.
$CR, $CG, $CB - Diffuse point or vertex color.
$CA - Point or vertex alpha value.
$PT2, $NPT2 - Point number & total number of points for the second source.
$CEX2, $CEY2, $CEZ2 - Centroid of the SOP for the second source.
$TX2, $TY2, $TZ2 - Point position for the second source.

Examples

Manipulation

 vertex/cr = $BBX
 vertex/cg = $CG2
 vertex/cb = $CB - $CB2

Texture Offsets

You can have set of images in a TOP, and apply all of them in one material to different parts of an object. This allows you to have a pre-rendered animation clip with the clip playing at different speeds and time offsets on different surfaces.

You can adjust the material frame time by the first vertex/point texture W component (texture coordinated are U (horizontal), V (vertical) and W (one of a set of texture images). A texture (W) value of -1 moves back in time 1 frame. This lets you apply different frames to many polygons simultaneously using the Vertex SOP, or Point SOP.

See Also