Close

Experimental:POP


Experimental - Skipping Glossary

Summary

POPs (Point Operators) is a new Operator Family of TouchDesigner that runs on the accelerated GPU graphics card or chips, and creates/modifies 3D data which in turn gets rendered by the Render TOP or gets passed to other devices like LED arrays, lasers or other external systems.

See also Category:POPs for a full list of articles related to POPs.

Every POP contains a set of points with a set of Attributes. The most common attribute is Position (P), the position in 3D space of the points. The POP may have other attributes like Color (Color) (always with a red, green, blue and alpha component) and Normal (N) which is a direction vector (with 3 components). The points can also have extra user-defined attributes, or will get attributes automatically-generated from certain POP operators.

Points are the building blocks of polygons, lines, line strips, spline curves, point clouds, particle systems, any 3D geometrical shape and any form of data points. A POP is made of a points list, a vertex list, and a primitive list.

The types of "primitives" include

  • Point (1 point))
  • Line (2-point)
  • Line Strip (1 or more points)
  • Triangle (3 points)
  • Quad (4 points)

Each primitive has a list of vertices. Vertices are indexes into the points list. So a quad primitive is 4 vertices which is a set of 4 indices of points in the point list. Vertices and Primitives can also have attributes, like Color can be a primitive attribute whih applies color to the entire primitive.

Like the other TouchDesigner families of operators, POPs include "generator" operators that create new shapes or import them from files or other systems, plus "filter" operators that modify the data coming from other POPs and may generate complex shapes and data from simpler inputs.

POPs are a replacement and re-think of TouchDesigner's historically first operator family, SOPs, with many new features and advantages. Like SOPs, POPs are a procedural family of operators that create and affect points, and primitives like triangles, quads and lines. POPs implements point clouds and particles, and it imports FBX, obj , Alembic files and more.

POPs are placed in Geometry COMPs to get rendered with the Render TOP. Materials (MATs) are applied to the Geometry COMPs (as with SOPs), the Geometry COMPs are provided to the Render TOP, which renders the raster images. POPs can also go directly to CHOPs then to lasers, DMX or other external systems.

3D operators running on the GPU gives us:

- Speed due to high parallelism. - Less memory: It is highly memory-optimized as only the attributes that change gets created. - (re-use of memory?)

POPs implement a lot of features of CHOPs so that it's not necessary to convert to CHOPs to do a lot of math/logic/mixing operations on 3D data and attributes.

POPs fits in with USD and FBX data structures including bones and weights - optionally creating POPs in the USD or FBX components.

POPs vs SOPs

If you know SOPs already:

  • POPs run on the GPU as highly-parallelized compute shaders. SOPs run on the CPU.
  • POPs give better, more modern workflow than SOPs: It takes the best of SOPs, CHOPs and TOPs.
  • All point cloud-relevant TOPs are implemented in POPs and more, without the limitation of mapping to 4-channel image formats.
  • You can retrieve point clouds from TOPs (TOP to POP), Point File In POP, and there are native point generators in POPs.
  • `particlesGPU` is (being) re-implemented in POPs. Particle systems are enabled with Feedback POP and general data manipulation.
  • POPs has much more powerful creation and manipulation of attributes.
  • POPs does not follow SOPs directly. For example, the Normal POP creates surface normals and tangents whereas SOPs do it in a Facet SOP.
  • You can render SOPs and POPs in the same Render TOP.
  • right-click on a POP and select a Geometry COMP to create a POP-in-a-Geo..
  • Geometry Instancing is done in the same way as SOPs/CHOPs/DATs, where POP attributes can be used on the Instancing pages.
  • POPs implement features of spline curves (but as spline-divided line strips): Bezier, BSpline, and Cardinal splines.
  • What POPs doesn't do presently: Meshes (grids where rows/columns are defined), tracing, full extrudes on any linestrip, booleans, or triangulation of closed linestrips. to come.
  • Alembic data is now editable as POPs. (no Alembic POP yet)
  • SOPs has some functionality that is more doable on the CPU, but more and more of that will be ported to POPs.

Some POP Features and Concepts

Compute Shaders is the programming language within POPs, and in the C++ compute shader sample POPs, there are numerous helper functions and pre-built examples.

Math with no Coding - Several POPs like Transform, Math, Math Mix and Normalize give fundamental manipulation capabilities without need for coding. POPs eliminate a lot of the need for coding.

Creating New Attributes - Some POPs allow for easy creation of new attributes simply by specifying an existing/new attribute in the Output Scope parameter. TouchDesigner will auto-choose a size and type of attribute. (in Math POP, Math Mix POP, Limit POP and numerous others)

Setting Attribute type and Size - Where you see >>> it lets you specify attribute type and size.

Attributes Feeding Rendering - POPs is better-tied to rendering as attributes are more extensive and controllable. Like glowing lines are a combination of geo and shading. In some cases hidden POPs generate the polys to render glow or lines.

GLSL POPs - A growing set of POPs let you code in GLSL-style compute shaders.

Multi-POP Inputs with Sequential Blocks - The POPs that allow unlimited inputs, like Merge, Switch, Math Mix, Blend, Attribute Combine etc. share a new flexible way of specifying inputs. You can (1) wire them in one-by one as before, or you can (2) specify multi-inputs like "box*" using pattern matching in a parameter. And you can (3) add a sequential block per input, where each block has a POP path parameter. The latter is most flexible as each sequential block can have extra parameters, like for the Attribute Combine POP, which attributes you want to extract from each input, or for the Merge POP, which groups you want to merge in for each input. For each wired-input, it auto-creates a sequential block. (You can use pattern matching in each sequential block). You can mix wired and unwired inputs if needed.

Multi-Component Attributes - An attribute can be one number per point, but also can have 2, 3 or 4 components, such as vec4 Color: multiple "components" Color(0), Color(1), Color(2) and Color(3). On top of that, "arrays" are for example multiple vec3 in one attribute, which you can create in an Attribute POP.

Multi-columns of Parameters (Parameter Size parameter): Most POPs give one set of parameters that apply to all components of a vector. You will see “Parameter Size” on some POPs that give you 1, 2, 3, or 4 sets of parameters, which then give you one parameter set for each component. For example, this enables you on a Math POP to apply a different re-range for each of the X Y ad Z components of a position, which previously required several OPs.

Memory Reduction via References - Each POP only allocates memory for attributes that it is modifying or creating anew. If it is not modifying Position, for example, it will use the Position from an POP that is flowing into the POP. This saves a lot of memory. Tip: At the bottom left corner of the POPs viewers it shows which attributes it is creating/modifying in that POP, The rest of the attributes are being passed through from POPs upstream (references). Also, the middle-click info popup on a node shows the attribute names, and if they are followed by a (r) it is a reference to memory in another node.

Single-Component menu - where a single component of an attribute needs to be specified, (like for an index) there is single-component menu that is used everywhere, which lets you choose one from all the POP's attributes' components.

Line Strips are primitives (like triangles, quads etc) made of multi-points, and can be created via most generator POPs, the Line POP or the Create POP.

They can also be created from any point list that has a linebreak attribute, which in the Line Strip POP takes the point list in its order, and splits it into line stripp primitives based on 0 or 1 in the linebreak attribute.

Line MAT is implemented with an POP underneath and does a conversion into a Line Thick POP. More aspects of lines are controllable per-point using attributes. More Line MAT features are controlled using POP attributes via the Line MAT’s Attributes page.

Weights - Several POPs generate 0-1 value weights per-point, and others use those weights to blend between two states, like the Transform POP which can partially transform each point.

High Precision - User-defined attributes can be single or double precision floats, also 32-bit or 64-bit integers.

Sorting with the Sort POP is implemented with modern fast sorting algorithms. Sort can be based on any attribute component.

Over-Allocation Caveat of GPUs - If a POP's number of points, primitives or vertices cannot be determined at the start of cooking, it needs to allocate a max number of thee entities and not use some memory. So they have to sometimes over-allocate. Some POPs have parameters that let you set the max amount of things you expect in the POP.

Conversions - To transfer from Point Attributes to/from Vertex Attributes to/from Primitive Attributes, use the Attribute Convert POP. Use the Convert POP to convert between primitive types.

GPU - You can keep your computing on the GPU and not break the parallelism caused by sending/receiving form the CPU. Since TOPs are GPU-based too, interactions between them are also optimized. POPs are all GPU except when CPU absolutely needed (like loading files).

Primitives

Primitive Types

Primitive types in POPs are:

  • Point primitive - has one index into the point list
  • Line primitive - a set of two points in the point list
  • Line Strip primitive - a set of any number of points in the point list
  • Triangle primitive - a set of three points
  • Quad - primitive - a set of four points

Tip: POP to DAT using its Extract menu shows it all.

Line Strips Open or Closed

Line strips can be open or closed. Closed line strips have their last vertex pointing to the same point as the first vertex.

Points without Primitives (and why points alone don’t render)

You can have a set of points without a primitive.

Instancing only looks at the point list. Copy SOP templates don’t care. Many POPs don't care - they go through the points in the point list and mod something and that's it.

But you can’t render (Render TOP) points themselves unless they have a point primitive at least. (is this true with Line MAT?)

The generators (Circle, Torus, Tube, Point Generator and soon Sphere) (when Connectivity is set to None, where applicable) all create points, each with a corresponding point primitive.

The Create POP, like the Add SOP, can strip off primitives and leave you with no primitives unless you create them in the Primitives tab.

Order of primitives in POPs

Primitives are re-grouped with this specific order: Triangles, Quads, Line Strips, Lines and Points.

Attributes

Standard Attributes

Fixed-purpose built-in attributes - Every point has a position, that is called the P attribute (now you can have a POP without a P attribute). P has 3 components including P(0)P(1) and P(2)  for the X, Y and Z dimensions. P is a “vec3”.

Each point can have other optional attributes that are added using various POPs. N is for normals and is a 3-float vector (vec3). Color is the point color and always has 4 components , for red, green, blue and alpha. Often you will see Color(0) Color(1) Color(2) for changing the RGB only. Tex is the texture coordinates for point and is always a 3-float vector which includes the 3rd dimension of a 3D texture.

You can create and modify color and texture attributes in many places in POPs, like in Normalize, Math, Math Mix, Pattern, Noise, Random, Projection, Lookup*, Line and more.

Common Attributes

There are other attribute names that are commonly used in TouchDesigner that you should use as a habit unless there is a reason not to do so. These include Tan(tangent), Pointscale, LineWidthDirDist, VelDisp, SpeedAccel, WeightCurv (curvature), Index (general index) Nebr (neighbor indexes).

Point, Vertex or Primitive Attributes

Points have attributes, but also primitives and vertices can have attributes. Most often point attributes are desirable. For example, the Sphere POP optionally produces vertex attributes as textures to typically handle textures that wrap around.

Where to create Attributes

Yu can create attributes with the Attribute POP, but you can create attributes on the fly with most POPs by specifying a new name where you would give the output attribute name.

Attributes data types

Attributes can be any name and any size if they are floats. An Attribute can be float (32-bit), double (64-bit double-precision floats), integer (32-bit), or uint (unsigned 32 bit integers). Attributes can be 1-component floats, or 2+ component vectors (vec2, vec3 or vec4), and up-to 4x4 matrices. You can also have arrays, like an array of 5 floats, for example, represented as MyArray[0] to MyArray[4]. POPs that have counters like Ray POP, Line Metrics POP or Neighbor POP create unsigned integer attributes.

Attribute names

Attribute names can contain only alphabetic characters A-Z lower and upper case. Attribute names will always start with a letter. Standard and Common attributes defined by Derivative are named with the first letter capitalized like Weight. User-defined attributes can start with lower or upper case, but to avoid future conflicts and be more recognized as user-defined, it’s recommended you start them with lower case.

List of Attributes

You can get a list of all point attributes: in python op('pop1').pointAttributes() with pattern matching. Or you can look at the middle-click Info popup. Also in each POP viewer at the bottom left it shows which attributes are added or changed. Check the section Python Members and Functions.

POPs without a P attribute

It is possible to create and manipulate a POP without the P attribute - a point can represent any data and not necessarily something with a position. Or on a POP chain, the P doesn’t matter. A point without a P attribute is given a P value of (0, 0, 0) when, for instance you want to display a P-less point in 3D. You can strip a P off using an Attribute Combine POP, for example.

Creating new Custom Attributes

  • An Attribute POP can be used to create any new attributes on points, vertices or primitives, and initialize it with constant values.
  • But many POPs like Math POP or Limit POP take one attribute in, and you can create any new attribute in which to put the results. By default, the output attribute is the same type as the selected input attribute. But where you Output to an attribute you can specify a new attribute name and type.
  • If the Output Attribute name is in italics, it means it will auto-fill the attribute of that name.
  • POPs like the Field POP or Line Metrics POP generate new attributes with suggested default names.
  • There are numerous specialized POPs that give more complex settings, like Noise and Pattern.
  • Parameter set for specifying a new output attribute - Click the >>> icon.
    • Five parameters help you to: (1) put values on same attribute input, (2) another attribute that exists in the POP already, (3) a new attribute (both reserved-name attributes or entirely new attributes).
  • Multi-component parameters - A float3 is said to have three “components”. The POP parameters, depending on their settings, cause 1, 2, 3 or 4 components of an incoming attribute to be passed to the output stage. If it's 1 component, it gets passed to all output components. Otherwise the number of components (2, 3 or 4) of an output must match the number of components of the input.
  • If the output is a new attribute, and all components don't get filled then it uses the default values.
  • Custom attributes can be 64-bit floats or 32-bit integers, and can be manipulated as such. (built-ins are 32-bit)
  • Output Attributes are standardized - auto-name creation, output attribute block, split menu of attr choices or attr component choice,. must start with an alphabetic character.
  • standard error/warning checking when combining - there is an Error/Warning menu that lets you choose what to do.

Selecting Components of Attributes

For an attribute made of 2 or more numbers, like Position or Color, each number is called a “component” of the attribute. (yes, components are other thing in TouchDesigner too, we’re referring to “components of attributes here.)

When selecting which attributes to operate on, or which attributes to output, you can select some of the components of an attribute. Whereas the attribute Color is the same as Color(0) Color(1) Color(2) and Color(3) together, you can select Color(0) Color(2) to get and use the red and blue components only.

Re-Ordering or “Swizzling” Attribute Components

If an input attribute scope is P(1) P(0), it is not the same as P(0) P(1). Since P(0) and P(1) are the X and Y values and the position, P(1) P(0) gives two values, the Y value followed by the X. If you then output the results (say in a Math CHOP) to P(0) P(1), then you have swapped the X and Y components. This is a powerful mechanism to mix and re-order components of Attributes.

Matching input components to output components, and Parameter Size 1 to 4: See Overview.toe /components_of_attributes.

Reserved and Common Attribute Names

The standard reserved-name attributes

  • P position (3-float)
  • N normal (3-float)
  • T tangent (4-float, last on is polarity)
  • Color ((diffuse) color and alpha (was Cd in SOPs)
  • Tex (3-float) (was uv in SOPs)
  • LineWidth (line width)
  • LineBreak (a break in a line strip (int))
  • PointScale (float)
  • BonePaths, BoneBindPoses (for skeletons)
  • new: Weight (from Field POP, used in Transform POP and elsewhere)

Names generated / used in some POPs

  • Dir Direction (3-float) (found in Line Metrics POP). also DistDirDispTan
  • upcoming: Vel Velocity (3-float) (future Slope POP, see Cache Filter POP)
  • upcoming: Accel (acceleration)

Other Considerations

  • other colors, like interior color vs reflected color, or specular... ?
  • new: something for Angular speed? etc
  • Up = ? tbd
  • the attributes for metaballs
  • the attributes if we represent SDFs here

Groups

Groups (of Points, Vertices or Primitives) are represented internally with a bit flag, where 32 groups per POP are possible in a 32-bit GPU word. Groups are created with the Group POP. The Group POP can also convert a group to an attribute which is less limited but takes more memory.

Numerous operators are able to affect points, vertices or primitives that are in a specified group and not affect other points, vertices or primitives. For example the Transform POP for affecting certain points, or the Merge POP for extracting parts of other OPs into its output, use groups.

Other POPs may create groups automatically. (Extrude / Copy / TBD)

Some POP Common Features

Every POP may have some combination of these features:

Input Selection

  • For multiple inputs
    • for each input, one sequential block is created
    • inputs can be references to other POPs also
    • you can do pattern-matching to do multi-POPs in one block
    • for each input you can select which attributes or groups that you want to work on (like Attribute Combine, Math Mix, Merge POPs)

Scope

  • choose which type of attribute: operates on Point, Vertex or Group attributes (menu)
  • Scope or Group to determine effect or not
  • Affect based on Attribute component value
  • may use weight to determine degree of effect (any component of an attribute as weight)

Selecting Attributes

  • Select any attribute from the input POP that you want to use, commonly through the Input Attribute Scope.
  • Select any components of an attribute. P(0) P(1) gives only X and Y
  • re-order components - P(2) P(0) P(1) in the input will give Z Y X to the next stage.
  • Select any attribute as Reference (like in Noise)

Operation

  • (modify an array of 1 to 4 components)
  • For multi-component attributes (float2, float3, etc), one set of parameters can be used for all the components, or you can get one set of parameters for each component. (using the Parameter Size par)

Some math

  • Basic Arithmetic and simple functions like in Math, Rerange POP, Limit POP
  • no Function POP - see the menus in Math POP or Math Mix POPs.
  • generative functions like in Pattern POP
  • 1, 2 or 3 attribute components are used as lookup indexes in the Lookup Texture POP, Lookup Channel POP and Lookup Attribute POP.
  • Some POPs generate normalized attributes: Normalize POP (like a bounding box), Texture, Projection POPs

Topology

  • some operations that alter topology or generate new topology

Post-Process

  • Re-range values
  • Collapse down to subset of points/primitives
  • Quantize menu to logic on-off, integer Floor, Round, Ceiling menu
  • generate a Group or new attribute

Output Attribute

  • Direct the output to any existing or new Attribute (built-in or custom)
  • The components of an attribute can be re-ordered on output, and be routed to any other existing or new attribute. (specify P(1) P(0) P(2) to swap X and Y on input or output, for example.)
  • standard parameter set for specifying the output attribute format >>>

Connectivity

  • In POPs where a grid (rows and columns and sometimes slices) of points is created, you usually can choose how they are connected - like rows of line strips, triangles, quads, none.

Particles

See Learning About POPs / POPs Wiki / Particle to get a current description of the Particle POP.

The following is other general information about points as particles.

What is a particle? - A Particle is simply a single POP point - the minimum is a P attribute for its position. But they can be extended with attributes…. velocity, direction, speed, age, mass, force, even with a full 3x3 or 4x4 transform per-point.

Note that a point is not rendered as a dot. You need to create a Point primitive in order for points to be visible. Most generators will do that when Connectivity is set to Point Primitive.

A time-history of a point can be created with the Trail POP which creates a line strip for each point. So a particle can be visualized as a multi-point line strip.

Alternately you can render geometry per-point without creating new data via instancing in a Geometry COMP (classic SOPs method).

Another way to represent a particle is with any geometry as it would be created with a Copy POP. This create new geometry in a POP that can be further manipulated/animated before rendering.

However with the Copy GLSL POP, you can, at every point, run a compute shader code to warp a geometry based on the point’s attributes, so you can generate, for example, birds on the fly, so to speak. (Examples are in the Examples folder.)

Further rendering of stuff at each point is the domain of special rendering shaders rendering on surfaces instanced at each point… like point sprites or the Line MAT.

Particle motion is done through integrating over time. So aside from the Particle POP, a Feedback POP can be used to accomplish this involving a loop that involves multiple POPs. The example from Roy & Tim Gerritsen and Peter Sistrom component are illustrations of that.

Alternately you can do all the simulation within one GLSL operator. There is currently not much example code in POPs to help with this.

Forces - can be represented as a POP with parameters specifying the force by creating or adding to a float3 PartForce attribute of a POP. Ultimately the force has to be added to the particles and converted to new velocity and positions. (Clarify:) Alternately a set of points of primitives, each which defines force properties via its attributes. It’s up to the force integrator to interpret that. Regular POPs and operators with custom parameters can be used to build these. New POPs will be added that act as generic forces, but now you create the m from existing POPs.

To be clarified:

Particle Generator / Emitters - where and what attribute do you launch with. birth/death

Collisions -

Point Clouds

Point clouds in POPs have the same functionality as they do in TOPs.

Any POP with connectivity (triangle, quad, line, linestrip) removed can be considered a point cloud.

There are two forms of point clouds:

  • a set of points with no primitives.
  • a set of points, with a set of “Point Primitives” where each point primitive is the index number of a point in the point list. Only these can be rendered directly in the renderer.

Yu can read in files containing point clouds using the Point File In POP, or the File In POP.

How to write out point cloud files.

Why pointclouds in POPs is better than doing pointclouds in TOPs:

  • No need to think of matching XYZ position values to RGB color channels.
  • No dividing into groups of 4.
  • No need for Active channel as in the square textures.
  • unlimited attributes per-point.
  • Easier to collapse into subsets (via groups in POPs, or via Delete POP)
  • POP-created groups: special group names reserved (start with _ ?)
  • SOPs and point clouds are no longer separated - all integrated in POPs.
  • Same stuff as particles, and as points.

Lines and Curves

There is no curve primitive yet, but linestrips can be linear- or spline-subdivided, smoothed and resampled with the Line POP and the Line Divide POP (latter subdivides any Line Strip).

Line POP divides the curve right in the Line POP, or outputs control points with extra attributes that define the curve shape: Weight, Tension, Interpolation Type, Bezier tangents In and Out, tangent continuity (3 cases). These attributes, no matter where they are generated, can be used by the Line Divide POP with a bit of hand-setup.

Read-Only Build-In Attributes

Convenient internally-generated variables can be used where specifying POP attributes. They behave like normal attributes. They includes basic constants like pi (3.14158), plus numbers like a point’s index number, or the point index normalize between 0 1nd 1, which was previously hard to get (via a Pattern POP and Normalize POP).

They are used most commonly in Math and Math Mix POPs, the Lookup* POP*, and in Delete, Group and others.

All read-only attribute names start with _. They are all reserved names. Some built-ins are generated per-point, per-primitive or per-vertex, depending on what you are modifying.

Where to find the read-only attributes: They appear on a secondary menu to the attribute name menu you see in Math, Math Mix and the Lookup POPs. Roll over the > at the bottom of the attribute menu to choose a built-in.

These variables are not passed to the next POP.

List of built-in variables: Some of them are:

  • _PointI - the integer point index
  • _PointU (point index normalized 0 to 1)
  • _PointCy (point index normalized cyclical going from 0 to (N-1)/N ) (so when _PointCy is 1, it is the first point of the point list.
  • _PrimI - the primitive index
  • _PrimU (primitive index normalized 0 to 1)
  • _PrimCy (primitive index normalized cyclic…)
  • _VertI - the current vertex number, when working on vertices.
  • _VertU ) (vertex index normalized 0 to 1)
  • _VertCy) (vertex index normalized cyclic…)
  • _DimI[] - every point has a position in its multi-dimensional array - the col/row/slice/etc that a point is in. _DimI[1] would be the row number of a point in a 3D grid, for example.
  • _StepSeconds - the step in seconds since the last time the network was cooked (the Time Slice)
  • _StepFarmes - the step in frames

Input Output from/to Files, Streams, Shared Memory

Files: ... Drag-Drop: Streams:

Shared memory:

Texture Mapping

The common attribute that we use for texture coordinates in POPs is Tex (formerly uvw), which is always a float3 attribute type, where the 3rd value is used for 3D textures where applicable, and unused otherwise. But you can use any attribute name when you assign it to a material (via the >>> icon in parameters). Some materials use several sets of texture coordinates, you can call them anything, like TexA, TexB, etc ...

The Tex attribute can be created on all the generator POPs, and created/adjusted with the Texture POP, but also in many other POPs that give greater control, like Normalize, Math, Math Mix, Projection, Noise, Pattern, Transform, Lookup* and more.

Texture coordinates are created on points or on vertices of primitives, so you have to keep an eye on where they are. They are put on vertices when there is texture wrapping like on a sphere or a torus, but on points in other cases (like grids).

Dimension

A POP’s point list may have an implied structure within it. For example, a Grid POP is a list of points arranged in columns and rows that are not known if they are connected as a set of triangles, quads or point primitives. A Grid POP has two dimensions by default (the rows and columns), and three if you increase the number of slices. When you pass a POP to another POP, you may want to preserve what is known about its structure.

Dimension is the metadata that describes the structure.

NOTE: This replaces the concept of meshes in SOPs.

For example, when converting a POP to a TOP, you want to create the corresponding width and height of pixels in the TOP. The dimension is used for this. When converting a TOP to a POP, you will was to preserve its width and height resolutions, again generating the correct dimensions.

”Dimension” is the concept of points organized as columns and rows of points, or cols/rows/slices, or generally N-dimensions, where each dimension has some number of elements, as you would get by copying a 2-dimensional grid onto each point of a circle to give a 3-dimensional data structure.

Middle-click on a POP to see its popup info: You will see numbers for Dimension, for example, dimension 20 40 12, indicating a 12 x 40 x 20 point arrangement. If you multiply them you will always get the total number of points in the POP.

DimensionPOPPopupInfo.png

Some generator POPs are multi-dimensional (Torus (2 dimensions), Tube (2 dimensions), Grid (2 or 3), sometimes Sphere….), some POPs always preserve the dimensions (Math POP), some POPs increases the number of dimensions (Copy POP, Trail POP and sometimes Merge POP), and some POPs destroy multi-dimensions (Delete).

A Grid POP is no longer 2-dimensions if you, for example, delete a point. It becomes a 1-dimension whose size simply is the total number of points.

All POPs have at least 1 dimension.

Built-In Attributes for Dimension

You can use the dimensions when working with attributes like in Math Mix POP or Lookup Channel POP.

_NumDim is the number of dimensions of the input.

_DimSize[0] would be the number of columns in a grid or torus or tube. _DimSize[1] ia the number of rows.

_DimI[1] is the column number of a point, _Dim[1] is the row number.

_DimU[0] is the point’s column represented as a normalized number between 0 and 1. _DimU[0] is 1 for the last point in an a grid columns. These numbers are useful for all the Lookup* CHOPs.

pro tip: _DimCy[0] is similar to _DimU[0] but is cyclic: The last point has _DimU[0] == 1, but the last point has DimCy[0] == ( 1 - 1/numcols ), so with 10 columns, the last column has DimCy[0] == .9. Therefore if you give a Lookup POP an index value of 1 and it’s cyclic, it’s referring to the first point.

Python for Dimension

In python, OP.dimension is the list of sizes of each dimension, for example [10, 20, 8]. It is the map of points arranged in memory.

len(OP.dimension) is the number of dimensions, 3 in this case. Always the number of points in a POP is the product of all the dimensions.

NOTE: We use “array” to define attributes with more than one float3 for instance.

For the Grid POP, in python, POP.dimension[0] is the number of columns, POP.dimension[1] is number of rows, POP.dimension[2] is number of slices if there is more than 1 slice.

And if you copy this 3D grid to points of a circle, POP.dimension[4] is the number of circle points you stamped to.

POP.numPoints = POP.dimension[0] * POP.dimension[1] * POP.dimension[2] * POP.dimension[3]

len(POP.dimension) is the number of dimensions = 3.

Python Members and Functions

These functions will give you values on the CPU. If you need them on the GPU, look at the Analyze POP. To avoid stalls, use the delayed=True directives below, though data will be a frame behind.

  • OP.computeBounds(delayed=False, display=True, render=True, selected=False, recurse=True)
  • OP.numPoints(delayed=False) # size of point list
  • OP.numVerts(delayed=False)
  • OP.numPrims(delayed=False)
  • OP.points(attributeName, startIndex=0 (optional), count= (optional), delayed=False) as of 2023.32010
  • OP.verts(attributeName, startIndex=0 (optional), count= (optional), delayed=False)
  • OP.prims(attributeName, startIndex=0 (optional), count= (optional), delayed=False)
  • OP.pointAttributes
    • len(OP.pointAttributes) # get the number of attributes
    • [x for x in OP.pointAttributes] # a way to get it in a list
    • [*OP.pointAttributes] # another way to get it in a list
  • list = [x for x in OP.pointAttributes]; list[1].name, list[1].size, list[1].type # attribute definition print( l[2].name )
  • OP.vertAttributes
  • OP.primAttributes

lists of attributes that were changed or created in the operator:

  • OP.pointAttributesChanged[]
  • OP.vertAttributesChanged[]
  • OP.primAttributesChanged[]

That is, it will not include any attribute in the output that has not changed in any way. Attributes that were deleted are not included.

how POPs are structured as grids:

  • OP.dimension an array of integers describing number of columns, rows, …

Driving Parameters per-point using Attributes

Transform POP, Noise POP - me.inputs[0].pointItr(AttName, 0)

Advanced Features and Topics

Indirect POPs and Memory Management

  • or certain POPs operations, the number of resulting points/prims/verts is only known on the GPU. The resulting POPs are called “Indirect POPs ” in TD (examples: Delete POP, Proximity POP…).
  • For these indirect POPs, the memory allocated is the maximum memory the POP could use.
  • Downloading the actual topology info (number of points, primitives, vertices) for these POPs from the GPU causes a stall.
  • For the downstream POPs compute shaders, the topology info is passed through a buffer to avoid the stall and unnecessary work: this is called indirect dispatch of compute shaders.
  • The middle click info popup does the download and show what is used versus what is allocated
  • Some OPs (POP to DAT, copy topology back to CPU on GPU POP) as well as the python functions allow a “next frame” asynchronous download that prevents the stall but introduces a 1 frame latency. Copy topology back to CPU turns the POP back into a regular POP, only allocating necessary memory again downstream.
  • Currently there is no way to manually allocate memory for indirect POPs , so the memory lost cannot be reclaimed without a stall.
  • The Feedback POP has a toggle to limit the memory allocated to a multiple of the input memory to prevent the memory used from blowing up when geometry is created inside the feedback loop.
  • For integrated GPUs, CPU and GPU share memory so the download of information from the GPU doesn’t cause a stall (still to be done automatically)

New Concepts in POPs

This is compilation of things you will see in POPs that do not (yet) appear in other parts of TouchDesigner.

  • management of POP inputs on multi-input POPs using sequential parameter blocks - one block per input.
  • Parameter Size letting you use separate parameters on each component of an attribute. Setting to to 3 gives 3 columns of parameters.
  • turning on options to change what pars are in a sequential parameter blocks. Line POP and Create POP have this.
  • sequential parameter block whose parameters are user-defined (not custom pars)
  • disabling of inactive parameters of a multi-parameter set

POP Lingo Glossary, Miscellaneous

point, vertex, primitive, triangle, quad, linebreak, line, line strip (linestrip)

attribute

parameter vector size

input block

dimension

uniforms

neighbors

group, buffer, compute shader, instance

Linestrips are closed if the last vertex index is the same as the first one for example `10 11 12 13 10`