Particle System - Rigid Bodies

Your browser does not support the HTML5 canvas tag.
0.00 s
0.00 ms
0

Particle system algorithm:

This example shows a simple particle system where each particle is represented by a rigid body with a rotation and an angular velocity:
  1. remove rigid bodies with age > max. life time
  2. generate new rigid bodies by emitters
  3. compute forces for all rigid bodies
  4. time integration to get new rigid body positions, rotations and velocities

1. Remove rigid bodies with age > max. life time

The life time of each rigid body is set to 0 when a rigid body is generated. In each simulation step the life time is increased by the time step size $\Delta t$. When a rigid body's life time is greater than a predefined maximum life time, the rigid body is removed from the simulation.

Note that the life time can be used for rendering effects. In our case the transparency is increased depending on the life time to fade out the rigid bodies.

2. Generate new rigid bodies by emitters

In each simulation step new rigid bodies are generated at the position of the emitter. Typically they are initialized with some predefined values and sometimes some random values are added to obtain more natural results.

In our simulation the rigid bodies are generated with a velocity pointing upwards. Moreover, the velocity in x- and y-direction is modified by some random values. The starting position of the body is at the emitter and it has a random rotation and angular velocity.

3. Compute forces for all rigid bodies

In each step forces are determined for the rigid bodies, e.g. gravity, wind etc. In our simple example only gravity is applied.

4. Time integration

Finally, the rigid bodies are advected by numerical time integration. In our case we use a symplectic Euler method: $$\begin{align*} \mathbf v(t + \Delta t) &= \mathbf v(t) + \frac{\Delta t}{m} \mathbf f^{\text{ext}} \\ \mathbf x(t + \Delta t) &= \mathbf x(t) + \Delta t \mathbf v(t + \Delta t) \\ \alpha(t + \Delta t) &= \alpha(t) + \Delta t \omega, \end{align*}$$ where $\mathbf f^{\text{ext}}$ are the external forces, $\omega$ is the (in our example constant) angular velocity and $\alpha$ is the rotation angle.