Spring SOP

From TouchDesigner 088 Wiki


The Spring SOP deforms and moves the input geometry using spring "forces" on the edges of polygons and on masses attached to each point.

Geometry is deformed using forces that simulate simple physics on the points and edges. A simulated "mass" is assigned to each point. Its primitive edges act as "springs" which oppose the forces, and pull the points back toward their original positions. When the springs are stretched by the forces, they try to pull the points back. The points do not stop moving when they return to their original positions, however, but continue to oscillate because of their mass, until the oscillation dies out.

Forces which act upon the points are as follows:

external force (gravity)
wind (similar to external force)
turbulence (chaotic forces)

The greater the drag value, or smaller the mass, the faster the oscillation dies out.

PythonIcon.png springSOP_Class

Parameters - State Page

Start Time /timestart - The Start Time is the time at which the simulation starts cooking. Before this, the simulation will be static. If set to some later time, the points will not move until that time is reached. The default is $TSTART (frame one).

Preroll Time /timepreroll - How many seconds of the simulation to bypass, after the reset time is reached. For example, if you put the number 33 into this field (and reset is at $TSTART), frame one will show the simulation that was at a time of 33 seconds. In other words, the first thirty-two seconds have been bypassed, and the time at thirty-three seconds is shifted to frame one. The first thirty-two seconds must still be calculated in order to compute the status of the points, so you will notice some delay upon reset.

Time Inc /timeinc - The Time Inc parameter determines how often to cook the SOP. By default, this parameter is set to 1/$FPS. This means that the SOP will cook once for every frame. When complex dynamics are involved, the SOP may require more frequent cooking for increased mathematical accuracy. To get sub-frame accuracy in the cooking, set the Time Inc to something smaller than 1/$FPS . For example, setting the Time Inc to 0.5/$FPS will mean that the SOP gets cooked twice for every frame.

Note: Never set this parameter greater than 1/$FPS.

Accurate Moves /accurate - This option makes the nodes move more accurately between frames by calculating their trajectories for fractional frame values.

Attractor Use /attractmode

  • All Points - All point attractors affect all particles (or points).
  • Single point per particle - When enabled, each particle is assigned a single attractor point, and is affected by only that point. Assignment is done by point number modulo the total number of attractor points.

Parameters - Forces Page

External Force /externalx /externaly /externalz - Forces of gravity acting on the points. When drag is zero, the points can accelerate with no limit on their speed.

Wind /windx /windy /windz - Wind forces acting on the points. Similar to external force. Using wind (and no other forces, such as turbulence), the points will not exceed the wind velocity.

Turbulence /turbx /turby /turbz - The amplitude of turbulent (chaotic) forces along each axis. Use positive values, if any.

Turb Period /period - A small period means that the turbulence varies quickly over a small area, while a larger value will cause points close to each other to be affected similarly.

Seed /seed - Random number seed for the simulation.

Parameters - Nodes Page

Fixed Points /fixed - This is a point group. All points in the point group will remain unaffected by the forces. Also see the Group SOP for notes on how to specify point ranges.

Fixed Points go to Source Positions /revertfixed - Determines whether or not points in the Fixed Points group should be moved to the positions of the corresponding points in the Source geometry.

Copy Groups from Source /copygroups - Determines if the Spring SOP should copy groups from the Source geometry at each frame. This lets you specify the name of an animating group in the Fixed Points field, and the contents of this group will be kept up to date.

Add Mass Attribute /domass - When selected, the Mass is computed for the deforming geometry.

Mass /mass - Mass of each point. Heavier points take longer to get into motion, and longer to stop.

Add Drag Attribute /dodrag - When selected, the geometry is deformed by the Drag attribute.

Drag /drag - Drag of each point.

Spring Behaviour /springbehavior - How the springs will behave:

  • Hooke's Law - Springs will work according to Hooke's Law. This is generally more stable than Normalized Displacement.
Hooke's Law: Force = Displacement Spring constant
  • Normalize Displacement - Similar to Hooke's Law except that the displacement is normalized to the original length of the Spring.

Spring Constant /springk - The spring constant. How tight the springs are. Increase this value to make the springs tighter and thus make the object more rigid. As this number becomes higher, the springs can oscillate out of control. Decrease the Time Inc if this happens.

Initial Tension /tension - The Initial k constant of the geometry before being deformed by the spring operation.

Parameters - Limits Page

+ / - Limit Plane /limitposx ... /limitposz /limitnegx ... /limitnegz - The points will bounce off the limit planes when it reaches them. The six limit plane fields define a bounding cube. The default settings are one thousand units away, which is very large. Reduce the values to about one to see the effect.

Hit Behavior /hit - Control over what happens when the geometry hits either the six collision planes or the collision object. The options are:

  • Bounce on Contact - Geometry will bounce upon contact with the Collision input.
  • Stick on Contact - Geometry will stick to the Collision input upon contact.

Gain Tangent / Normal /gaintan /gainnorm - Friction parameters which can be regarded as energy-loss upon collision. The first parameter affects the energy loss (gain) perpendicular to the surface. 0 means all energy (velocity) is lost, 1 means no energy is lost perpendicular to surface. The second parameter is the energy gain tangent to the surface.

Inputs / Geometry Types

Spring Source - Any geometry that provides points, e.g. polygon sphere, mesh.

Collision Object - This input defines an object for the nodes to collide with. When this happens, the geometry can either stick or bounce. It is important to note that when the collision object is deforming, collision detection may fail, causing some portions of the geometry to "leak through" the collision object.

Force - The Force input acts accepts input from a Force SOP which uses a metaball shape as a force field allowing forces to be defined in vortices or accelerated along an axis. Refer to the Force SOP for further explanation.

Note: The Spring SOP will use point normals as initial node velocity if point normal attributes exist and there are no point velocity attributes in the incoming data. If you add velocity attributes to the points, the point normals are ignored.

Uses / Works in Relation With

Deforming and moving the Source geometry using "forces" instead of channels.

See Also