Particle System
|
|||||||||||||||||||
Particle system algorithm:This example shows a simple particle system:
1. Remove particles with age > max. life timeThe life time of each particle is set to 0 when a particle is generated. In each simulation step the life time is increased by the time step size $\Delta t$. When a particle's life time is greater than a predefined maximum life time, the particle 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 particles. 2. Generate new particles by emittersIn each simulation step new particles 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 particles are generated with a velocity pointing upwards. Moreover, the velocity in x- and y-direction is modified by some random values. 3. Compute forces for all particlesIn each step forces are determined for the particles, e.g. gravity, wind etc. In our simple example only gravity is applied. 4. Time integrationFinally, the particles 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), \end{align*}$$ where $\mathbf f^{\text{ext}}$ are the external forces. |