Simulation


Understanding the Simulation Loop

tyFlow’s simulation loop is evaluated in the following way:

For each time step of the simulation:

1) The optimal order of events in the flow is found, by doing a depth-first search of connected events, starting with events that contain birth operators.

2) The ordered events are processed in ascending order, by evaluating the event’s operators from top to bottom.

Certain operators may have their evaluation deferred until later in the loop. Particle Physics operators set to “integration” mode are only evaluated during the bind solver step. Collision operators are also only evaluated after all other operators and non-PhysX solvers have been evaluated.

3) Once the events have been processed, the bind solver is evaluated. Cloth binds, particle binds, and any Particle Physics operators set to “integration” mode are evaluated.

4) Once the bind solver is finished, the wobble solver is evaluated. The wobble solver calculates spring forces applied to particles created with a Wobble operator.

5) Once the wobble solver is finished, the actor solver animates the transforms of any actor rig particles that have animation clips applied to them.

6) Once the actor solver is finished, all accumulated particle velocity and spin values are integrated into the system.

7) After velocity/spin integration, PhysX objects are processed. Internal PhysX rigidbodies have their position/velocities matched to their corresponding particles and the PhysX solver is evaluated.

8) Once the PhysX solver is finished, some final adjustments are made to the simulation. The bind solver checks to see if any particles should be put to sleep, the age of all particles is incremented, appropriate particles are cached, etc.


Simulation Validity

Under normal circumstances with moving particles, the simulation is history-dependent. This means that in order for the simulation state at time [t] to be known, the simulation state at time [t - timestep] must also be known. This also means that any given simulation state in those circumstances will only be valid for one timestep. As soon as the time changes, the simulation state changes, rendering the previous state invalid.

The exception to this case is if there are no changing properties in the simulation. If nothing is changing, then the simulation state at all times will be the same because the simulation is static.

When the simulation is initialized, tyFlow iterates over all operators and queries them for the types of changes they will make to the simulation. If every single operator reports that it does not make changes to particles over time, then tyFlow will recognize that the simulation will remain static forever once all new particles have been birthed. This makes tyFlow a very efficient geometry scattering tool, since static particles that are scattered in a scene will not have to be continually evaluated after they are birthed.

Grey text labeled: “Static: [range]” appears in the bottom left corner of the editor and displays info about which frames of the simulation are static, or tells you if the simulation is never static.