The Copy SOP lets you make copies of the geometry of other SOPs and apply a transformation to each copy.
It also allows you to copy geometry to points on an input template.
Parameters - Copy Page
/sourceGrp - Specifies a subset of input primitives to copy from. Accepts patterns, as described in Pattern Matching in the Tscript article.
/templateGrp - Specifies a subset of template primitives from which to copy onto. Accepts patterns, as described in Pattern Matching in the Tscript article.
Number of Copies
- Sets number of Copies to be made of the source.
- For a template input, it specifies the number of copies to be placed at each point of the template.
Primitives Per Point
/nprims - Defines how many primitives to copy from each point.
Rotate to Normal
/nml - Only used when a template input is specified. If the template is a sphere, and the first input is a circle, a circle is placed at each point of the sphere. With this option on, all the circles will re-orient to face the surface of the sphere (a default sphere has normals radiating outwards from the center).
If an up attribute exists on the template geometry, then this will be used (along with the normal) to fully define the rotates for the copies. An up attribute is created with the Point SOP.
/cum - Each transformation "builds" on the location left by the one before it. Transformations are cumulative as the Copy SOP produces new copies.
/xOrd - Sets the overall transform order for the transformations. The Transform Order determines the order in which transformations take place. Depending on the order, you can achieve different results using the exact same values. Choose the appropriate order from the menu.
/rOrd - Sets the order of the rotations within the overall transform order.
Translate, Rotate, Scale, Pivot - These allow you to specify the Translation (how much it moves over in a given direction), Rotation, and the Scale between each copy. Three columns are given for X, Y, and Z coordinates. Guide geometry is provided for the Pivot's translations. The Pivot is represented by a single red dot in the Viewport. Changing the Pivot parameters moves this point of reference.
/scale - Uniform Scale allows you to shrink or enlarge geometry along all three axes simultaneously.
Normals Maintain Length
/vlength - Vector type attributes (i.e. normals, velocity) maintain the same length under transforms. i.e. When geometry is scaled, the normals remain constant in length.
Create Output Groups / Copy Groups
/newg - If selected, this creates a group for each copy number, and places each primitive created at that stage into it.
/copyg - Defines the base name of the groups created.
/lookat - Orients the copied geometry to lookat, or point to, the object component specified in the parameter.
/upvector[xyz] - When specifying a Look At, it is possible to specify an up vector for the lookat. Without using an up vector, it is possible to get poor animation when the lookat object passes through the Y axis of the target object.
Parameters - Stamp Page
Stamping is allowed in any parameter in TouchDesigner. The only requirement is that the stamped parameter is upstream in some fashion from the Copy SOP doing the stamping.
Stamp Inputs - When enabled, it will Stamp proceeding variables for each input copied.
Param 1 - 10 - Token and value of each stamp variable. Stamped parameters are accessible via the global
fetchStamp() method in the td Module in python, or
param() in tscript. See the example, below.
Parameters - Attribute Page
This page allows you to determine how point attributes on template geometry affect attributes on the source geometry. The template attribute can modify the source in four ways:
- Set - Override the source attribute.
- Multiply - Multiply the source attribute.
- Add - Get Added to the source attribute.
- Sub - Get Subtracted from the source attribute.
The template point attributes are able to affect point, primitive, or vertex attributes in the source geometry simply by entering values in the appropriate fields.
The geometry to be copied has prim. colors, the template geometry has point colors.
By setting the Multiply column of the To Primitive field to the value of
Cd, the point colors in the template will multiply the prim. colors of the source geometry. Each copy will have its colors multiplied by the template point that it's copied to.
A simple grid has texture coordinates, but it's desired to have each copy of the grid offset differently into the texture map.
By assigning a uv attribute to the template geometry, then setting the Add column of the To Point field to the value of
uv, the template texture coordinates will be added to the original grid's texture coordinates.
It is often desirable to take the point color and velocity attributes of a particle system and assign them to the point/primitive attributes of geometry which we copy to each particle. This is trivial since we simply set the Set columns of the To Prim or To Point fields to the desired attribute patterns.
Inputs / Geometry Types
Copy Data - The SOP you wish to make Copies of.
Template - This input is optional. If specified, a copy of the Copy Data is placed at each point in the template.
$CY- The Copy Number
$NCY- The Number of Copies.
$PT- The Point Number of the Template.
$NPT- The number of points in the Template.
$AGE- The number of seconds a particle in the template has been alive.
$LIFE- The ratio of the age of a particle to its expected life. This is a number between 0 (birth) and 1 (death).
$ID- The ID of the particle being sent to the Copy SOP through its template input.
Variables - Which refer to Template Geometry. The following variables refer to the template geometry if there is a template as an input. Otherwise they refer to the input geometry:
$CEX $CEY $CEZ- Defines the centroid of the geometry.
$XMIN $XMAX $YMIN $YMAX $ZMIN $ZMAX- The extents of the bounding box around the geometry.
$BBX $BBY $BBZ- The relative position of the point with respect to the bounding box of the geometry.
$SIZEX $SIZEY $SIZEZ- The size of the bounding box of the geometry.
You can use the
$NCYlocal variable to calculate the degrees of rotation for a given number of copies. For example, if you have 28 copies, you can set the rotation to be:
360/$NCY- this would automatically give you 12.8571 degrees, evenly spacing your 28 copies around the full circumference of the circle.
Using a Particle SOP as the Template object, you can copy objects defined in the Copy Data input to each particle template. This allows you, for example, to copy a Bee to each particle to create a swarm of bees.
Make a series of copies about an axis, and skin them to achieve lathe-like effects, similar to the results achieved with the Revolve SOP.
Creating Stamped Geometry
- Place a Circle SOP, and set its type to Polygon.
- Set the number of Divisions in the Circle to:
param()returns the value of the global parameter sides. If it is not yet defined it will return a value of 3.
- Append a Copy SOP, and set the Number of Copies to
5; and set Translate X to:
- In the Stamp page of the Copy SOP, turn on Stamp Inputs. Set Param 1 to:
- This creates a triangle on the first stamped copy; a square on the next; a pentagon on the third, and so on. The geometry for each copy is cooked separately.
You can set multiple stamp Params at once and they can be used anywhere in the ancestry of the copy's input.