Particle POP

From Derivative
Jump to navigation Jump to search

Summary
[edit]

The Particle POP is used for creating and controlling motion of "particles" for particle system simulations. A particle is simply a POP point with special attributes that are created by the Particle POP or added/modified manually by the user in a feedback-type loop, making it easy for customization. POPs are able to handle millions+ of points as they fully run on the GPU.

Particles are created with an initial position (P) and a velocity (PartVel) as well as mass (PartMass) that derive from (1) the input POP's points, (2) Particle POP's parameters and (3) attributes feeding back (see below). Particles can be emitted based on a constant emission rate or can be emitted based on an input attribute. When emitting based on an input attribute, the Particle POP checks the emitting attribute for each input point and emits that many particles at that position every frame (the emission value is converted to an integer). The Map page serves to configure initial values for various particle properties, including life span (PartLifeSpan), drag (PartDrag), velocity (PartVel), and mass (PartMass). It also provides options for setting life span variance and applying velocity damping.

The particle system is open and highly customizable. It is based on a feedback loop where the output is sent to standard POP nodes and the Force POP nodes that add forces, constrain points, change states to dying/etc, leading to a Null POP at the end of the chain. That Null POP is used by the Particle POP to retrieve the system's state for the next frame (specified by the Feedback parameter). The Particle POP looks for the attributes PartForce and PartVel to compute the positions for the current frame.

The Particle POP is based on the features and behavior of the Feedback POP. To Initialize, Start, end, pause, speed, pre-roll the particle system, it uses the TouchDesigner "Initialize / Start" standard based on the Timer CHOP. It shares several of the same parameters, and if you attach an Info CHOP to the Particle POP, you will see the same state channels and timer channels as the Timer CHOP.

You can Pre-Roll the simulation some number of seconds when you Initialize, so that when you press Start, the simulation will be already underway and not be adding its first particles.

topic: attributes created / determined when the particle is created. Attributes created / modified every loop cycle.

See examples in POP Examples/ and Overview.toe

See Learning about POPs

See also Feedback POP

PythonIcon.pngparticlePOP_Class


Attributes[edit]

Particles have various attributes that regular geometry do not have. These attributes must be carried with each point in order to carry out the simulation. These attributes are listed below

Particle Attributes
Attribute Name Type Description
PartId uint A unique id for the particle
P vec3 The particle’s position
PartVel vec3 The particle’s velocity in Units per second
PartAge float The particle’s age (in seconds)
PartLifeSpan float The particle’s lifespan (in seconds)
PartForce vec3 The cumulative forces applied to the particle
PartMass float Particle’s mass
PartDrag float The drag factor applied to the particle causing it to decelerate.
PartDeath uint Indicates if a particle should be removed from the simulation (optional attribute)

During simulation, the position is updated based on the applied forces (F), the mass (m), the velocity (V), the position (P) and the delta time (dt).

The PartDrag attribute (D) is used to compute a force () acting on the particles in the direction opposite to their motion (V).

The Velocity Damping parameter simply attenuates the velocity (V) over time using a damping factor ().

Particles can carry additional attributes. These attributes can be copied from the input POP are created with an initial value.

Extending the Particle Simulation[edit]

By default, the particle simulation is very basic. The particles positions are updated based on the PartVel velocity attribute and PartForce force attribute.

Particles that reach their lifespan are removed from the simulation.

To inject forces in the simulation and affect the particles velocities, for example, the particle system has to be extended.

A POP node downstream in the network, typically a Null POP has to be referenced in the Target Particles Update POP parameter. This reference will cause a feedback loop and re-injects the particles next frame with updated attributes in the Particle POP simulation. With this mechanism, it’s possible to extend the simulation to control particles forces, spatial limits, collisions, etc.

This extending mechanism has some limitations. The number of particles reinjected in the Particle POP has to be the same. Points can’t be added or removed downstream and reinjected back. The Particle POP is responsible for creating and removing particles, but it’s possible to control birth with input emission attributes and death with the optional PartDeath attribute. Another limitation is that the reinjected points need to carry the particles' reserved attributes.


Parameters - Particles Page

Target Particles Update POP targetpop - A reference to a POP node downstream in the network. This reference will cause a feedback loop and re-injects the particles next frame

Create Point Primitives createpointprim - Enable creating point primitives

Point Id Reuse pointidreuse - - Point Id recycling mode.
  • Reuse Point Ids in Loop loop -
  • Reuse First Available Point Id unused -
  • Don't Reuse Point Ids none -

Maximum Particles maxparticles - Sets the maximum number of particles.

Emission from emissionmode - - Determines how particles are emitted
  • Birth Rate rate -
  • Birth Attribute attr - Name of sequential block to create new attributes.

Birth Rate birthrate - - Number of particles born each unit of time
  • Birth Rate birthrate -
  • Birth Rate Unit birthrateunit - Unit for birth rate.

Input Birth Attribute birthattr - Input attribute to specify birth rate.

Randomize Input Points rndinputpts - Enable source points shuffling.

Life Expect life - - Life Expectancy average time.
  • Life Expect life -
  • Life Expect Unit lifeunit - Unit for the life expectancy of the particles.

Life Variance (Fraction) lifevariance - Life Expectancy variation as fractoin of life expectancy.

Random Seed randomseed - Life variance and source position random seed.

Initial Velocity initvelocity - - Determines the particle's initial velocity in Units per second.
  • Initial Velocity initvelocityx -
  • Initial Velocity initvelocityy -
  • Initial Velocity initvelocityz -

Initial Mass initmass - Determines the particle's mass.

Initial Drag initdrag - Determines the drag factor applied to the particle causing it to decelerate.

Velocity Damping damping - Sets a multiplicative coefficient applied each frame to the particle's velocity to reduce its speed over time. It scales velocity down each frame exponentially. 

Initialize initializepulse - Initializes the POP from its input and parameters, it indicates it’s ready by turning on the ready channel in an attached Info CHOP, awaiting a Start pulse.

Start startpulse - Start the particle simulation.

Play play - - Pause or play the feedback loop.
  • Play play -
  • Step Pulse steppulse - Help Not Available.

Speed speed - Simulation speed.

Pre-Roll preroll - - Run the loop for this time before it is ready during initialization..
  • Pre-Roll preroll -
  • Pre-Roll Unit prerollunit - Warm-up stage time units.

Go to Done donepulse - Will immediately go to the done state.


Parameters - Attributes Page

In Attributes attrs - - Input attributes to copy to new particles.
  • * * -

Rename to renameto - Change the input attributes to a new name.

Use Death Attribute usedeathattr - Enable using the Death Attribute to force-kill particles.

New Attribute attr - Name of sequential block to create new attributes.
New Attribute Name attr0name - - Choose to create a predefined attribute or a custom attribute.
  • New Attribute Name attr0name -
  • Custom Name attr0customname - The name of the new cutom attribute.

Attribute Type attr0type - - Determines the type.
  • Attribute Type attr0type -
  • Components attr0numcomps - The number of components in the new custom attribute.

Default Value attr0value - - Default values of the attribute components.
  • Default Value attr0value0 - Attribute value(s).
  • Default Value attr0value1 - Attribute value(s).
  • Default Value attr0value2 - Attribute value(s).
  • Default Value attr0value3 - Attribute value(s).


Parameters - Map Page

Mapping map - Start of Sequential Parameter Blocks for attribute-to-parameter mapping.
OP map0op - Source OP for parameter mapping. The default of _in0 means the input POP.

Element map0element - The attribute (or component of an attribute) that will be mapped to a parameter per-point.

Parameter map0parm - - Parameter on the current POP that will be mapped from the Element (the attribute).
  • life (Life Expect) life -
  • lifevariance (Life Variance (Fraction)) lifevariance -
  • damping (Velocity Damping) damping -
  • initvelocity (Initial Velocity) initvelocity -
  • initvelocityx initvelocityx -
  • initvelocityy initvelocityy -
  • initvelocityz initvelocityz -
  • initmass (Initial Mass) initmass -
  • initdrag (Initial Drag) initdrag -

Combine Operation map0combineop - - Combine operation for attribute value with parameter value.
  • Set set -
  • Multiply mult -
  • Add add -


Parameters - Common Page

Bypass bypass - Pass through the first input to the output unchanged.

Free Extra GPU Memory freeextragpumem - Free memory that has accumulated when output memory has grown and shrunk.

Delete Input Attributes delinputattrs - Only output which attributes you specify in this POP - helps isolate attributes into a separate branch.

Parameter Color Space parmcolorspace - - Controls how all color parameters on this node are interpreted. The color values as treated as being in the selected color space, and are converted to the Working Color Space before they are used as part of the node's operation. Note that this does not change the color space of the node itself, as that is always in the Working Color Space.
  • sRGB srgb - sRGB color space, with sRGB transfer function. Considered an SDR color space with respect to Reference White.


  • sRGB - Linear srgblinear - sRGB color space, with linear transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.601 (NTSC) rec601ntsc - Rec.601 with NTSC primaries color space, with Rec.601 transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.709 rec709 - Rec.709 color space, with Rec.709 (same as Rec.2020) transfer function. Considered an SDR color space with respect to Reference White.


  • Rec.2020 rec2020 - Rec.2020 color space, with Rec.2020 (same as Rec.709) transfer function. Considered an HDR color space with respect to Reference White.


  • DCI-P3 dcip3 - DCI-P3 color space, with D65 white point and 2.6 gamma transfer function. Considered an HDR color space with respect to Reference White.


  • DCI-P3 (D60) dcip3d60 - DCI-P3 "D60 sim" color space, with D60 white point, and 2.6 gamma transfer function. Considered an HDR color space with respect to Reference White.


  • Display-P3 (D65) displayp3d65 - Display-P3 color space, with D65 white point, and sRGB gamma transfer function. Considered an HDR color space with respect to Reference White.


  • ACES2065-1 aces2065-1 - ACES 2065-1 (also known as ACES AP0) color space, with a linear gamma transfer function. Considered an HDR color space with respect to Reference White.


  • ACEScg acescg - ACEScg (also known as ACES AP1) color space, with a linear gamma transfer function. Considered an HDR color space with respect to Reference White.


  • Passthrough passthrough - When selected, the color values will be used as-is in the operation, without any modification or attempt to convert them into the Working Color Space.

Parameter Reference White parmreferencewhite - - When converting a parameter color value to the Working Color Space, this controls how it should be treated with respect to Reference White. If the Working Color Space is the same Reference White, then no adjustment is done. If they are different, then the Reference White level (brightness) of this color will be adjusted to the range expected by the Working Color Space. For example if the project is set to have a SDR Reference White of 120 nits, and the HDR Reference White is 80 nits, then a color of (1, 1, 1), which is 120 nits in the SDR color space, will be converted to be (1.5, 1.5, 1.5), which is 120 nits still in the HDR Working Color Space.
  • Default For Color Space default - Will use either the SDR or the HDR Reference White, based on the color space selected.


  • Use Parent Panel useparent - Will use the Reference White that the parent panel has selected. If the top-level panel also has 'Use Parent' selected, then 'UI Reference White' will be used.


  • Standard (SDR) sdr - Will treat the Parameter Color Space as SDR for it's reference white value.


  • High (HDR) hdr - Will treat the Parameter Color Space as HDR for it's reference white value.


  • UI ui - Will treat the Parameter Color Space as UI for it's reference white value. This uses the 'UI Reference White Nits' value for it's brightness.


Operator Inputs

  • Input 0: -


Info CHOP Channels

Extra Information for the Particle POP can be accessed via an Info CHOP.

Common POP Info Channels

Common Operator Info Channels

  • total_cooks - Number of times the operator has cooked since the process started.
  • cook_time - Duration of the last cook in milliseconds.
  • cook_frame - Frame number when this operator was last cooked relative to the component timeline.
  • cook_abs_frame - Frame number when this operator was last cooked relative to the absolute time.
  • cook_start_time - Time in milliseconds at which the operator started cooking in the frame it was cooked.
  • cook_end_time - Time in milliseconds at which the operator finished cooking in the frame it was cooked.
  • cooked_this_frame - 1 if operator was cooked this frame.
  • warnings - Number of warnings in this operator if any.
  • errors - Number of errors in this operator if any.


TouchDesigner Build:

POPs
Accumulate • Alembic In • Analyze • Attribute Combine • Attribute Convert • Attribute • Blend • Box • Cache Blend • Cache • Cache Select • CHOP to • Circle • Connectivity • Convert • Copy • CPlusPlus • Curve • DAT to • Delete • Dimension • DMX Fixture • DMX Out • Extrude • Facet • Feedback • Field • File In • File Out • Force Radial • GLSL Advanced • GLSL Copy • GLSL Create • GLSL • GLSL Select • Grid • Group • Histogram • Import Select • In • Limit • Line Break • Line Divide • Line Metrics • Line • Line Resample • Line Smooth • Line Thick • Lookup Attribute • Lookup Channel • Lookup Texture • Math Combine • Math Mix • Math • Merge • Neighbor • Noise • Normal • Normalize • Null • OAK Select • Out • Particle • Pattern • Phaser • Plane • Point File In • Point Generator • Point • Points, Vertices and Primitives in s • Polygonize • POP • Primitive • Projection • Proximity • Quantize • Random • Ray • Rectangle • ReRange • Revolve • Select • Skin Deform • Skin • SOP to • Sort • Sphere • Sprinkle • Subdivide • Switch • Texture Map • TOP to • Topology • Torus • Trail • Transform • Trig • Tube • Twist • ZED