Add SOP

From TouchDesigner 088 Wiki

Summary

The Add SOP can both create new Points and Polygons on its own, or it can be used to add Points and Polygons to an existing input.

If an input is specified, this SOP adds points and polygons to it as specified below. If no input is specified, then it generates the points and polygons below as a new entity. It can read points and vertices from DATs. See also DAT to SOP.

PythonIcon.png addSOP_Class

Parameters - Points Page

Points Table - Path to a Table DAT containing point data. By default, x, y, z, and w can be defined in the first 4 columns of the table using un-named columns.

If the Named Attributes parameter below is turned on, the following attributes can be defined in the Points Table DAT using named columns:

  • P(0) P(1) P(2) P(3)
  • N(0) N(1) N(2)
  • Cd(0) Cd(1) Cd(2) Cd(3)
  • uv(0) uv(1) uv(2)

Any other columns are added as single-float attributes.

NOTE: Turn off Compute Normals on the Polygon parameter page when supplying N(0) N(1) N(2) in the Points Table DAT.

Named Attributes - Allows extra attributes to be defined in the Point Table DAT above.

Point [0-5] - The three input fields represent the X, Y and Z coordinates of the point. The last input field represents the spline weight of the point. If the point is later used to create a spline (nurbs or Bezier) primitive, the weight will influence the shape of the primitive and may cause that primitive to become rational. Polygons and metaballs are not affected by this weight. These values can be constants (numbers) or variables. Below are three examples:

0.2   0.42   1.3
0.2   par("xform1/tx")   1.36
point("grid1",5,"P",0),   point("grid1",5,"P",1),   point("grid1",5,"P",2)

In the third example, we are reading the sixth point (first point is 0) from the SOP, grid1.

Delete Geometry But Keep the Points - Use this option to remove any unused points. When checked, existing geometry in the input are discarded, but the polygons created by this SOP are kept, as well as any points in the input.

Parameters - Polygons Page (By Pattern)

Polygons Table - Path to a Table DAT containing polygon data. Accepts rows of polygons specified by point number in the first column. The second column indicates if the polygons are closed (1) or open (0).

Polygon [1-6] - Create a fixed number of polygons by specifying a point pattern for each polygon. Enter connection lists here to add polygons. These consist of a list of point numbers to define the order in which the points are to be connected. The form is: {from}-{to}[:{every}][,{of}].

Examples of Valid Connection Lists:

1 2 3 4 - Makes a polygon by connecting point numbers 1,2,3,4.
1 3-15 16 8 - All points from 3-15 are included.
1-234 820-410 235-409 - Points from 1-820 are included, in the specified order.
0-15:2 - Every other point from 0 to 15 is included.
0-15:2,3 - Every 2 of 3 points are included (i.e. 0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15).
!4 - Every point except 4 is included.
!100-200 - Every point <100 and >200 is included.
* - Include all points.
9-0 - The first ten points are included in reverse order.
!9-0 - All but the first ten points are included in reverse order.
Closed - To create a closed polygon, check the Closed button beside it.

Remove Unused Points - Keep only the connected points, and discard unused points.

Parameters - Polygons Page (By Group)

Create as many polygons as determined by the group field and by the grouping / skipping rules.

Group - Subset of points to be connected.

Add - Optionally join subgroups of points:

  • All Points - Adds all points just as if you added them manually in the Points page.
  • Group of N Points - Adds only the number of points specified.
  • Skip every Nth Point - Adds points, buts skips every Nth one.
  • Each Group Separately - Creates separate polygons for each group specified in the Group parameter. For example, if you have a Group SOP creating a group called group1 and using the Create Boundary Groups option, you can connect this to an Add SOP and enter group1__* in the Group parameter. If Each Group Separately is chosen, polygons will be created for each boundary on the surface.

Tip: The Each Group Separately option is useful when pasting surfaces. Boundary groups can be created for the boundaries of two adjacent surfaces, and then the PolyLoft SOP (using the Points option) can be used to stitch these surfaces together.

N /inc - Increment / skip amount to use for adding points.

Closed - Closes the generated polygons.

Uses

Used in conjunction with a point expression, the Add SOP can be useful for extracting a specific point from another SOP. For example, to extract the X, Y and Z value of the fifth point, from a Grid SOP in geo1:

point("geo1/grid1",5,"P",0),
point("geo2/grid1",5,"P",1),
point("geo3/grid1",5,"P",2).

Points added in this way are appended to the end of the point list if a Source is specified. Middle-mouse click on the SOP node to find out how many points there are. For example, if you have added two points and there are 347 points (from 0 to 346), you have added the last two point numbers: 345 and 346.

Local Variables

$N - Returns the index of the last point in the geometry including the points created in this SOP.

$PT0 - $PT5 - These variables represent the point index numbers added in the Point page. This is useful because you can refer to the points in the connection list with: $PT0-$PT5 rather than using absolute index numbers, which change with every new input source.

$CEX, $CEY, $CEZ - Defines the centroid of the input geometry.

$X-$Y-$ZMIN, $X-$Y-$ZMAX - Defines the extent of the bounding box for the input geometry.

$SIZEX, $SIZEY, $SIZEZ - The size of the bounding box of the input geometry.

See Also