Particles are emitted using a fountain effect from bottom to top using a given spread, an initial speed and direction. Particles’ life is equal to 5.0 seconds. Once a particle is dead it is recycled, i.e. its vertex is moved to the end of a containing buffer. There is an evolution of appearance parameter too. When a particle is close to the end of its life the colour fades away. Linear interpolation on the alpha channel has been used to achieve this effect.
The first demo shows the effect of gravity, which is an adjustable parameter, and the collision with three planes: one parallel to the x axis and positioned at (0,0,0). The other two are respectively at 45 and -45 degrees in respect of the x axis.
The last part of the video shows the effect of three forces using 200k particles: air drag, wind and gravity. There are collisions with three infinite planes. Collisions are obtained using the dot product between the difference of particle position and one of the plane’s point and the plane normal. . The second part of the video points out effect of elasticity, or coefficient of restitution. For this demo only 2k particles are used for a matter of visual convenience. Post-processing and a variable coefficient of restitution between 0.1 and 0.9 has been used for plane collisions. Elasticity and post-processing apply as already mentioned above.
Two integration methods have been implemented: Euler and Runge-Kutta4 (RK4). In the last part of the video concerning particles effect it is possible to see a difference when a wind force is applied on the particles. RK4 results in a slower framerate but an apparently higher precision. As for the last effect a spinning source has been implemented to show another force component.
20k Particles – Elasticity, Gravity, Collision with planes
200k Particles – Three Forces: air drag, wind and gravity