top of page

Particles!

Simulation is incredibly important in any type of visual effects work.  Here are some examples from a real time particle engine I wrote using openGL and C++ in 2015.

For the collision detection each particles position is stored prior to being moved.  Once the acceleration and velocity of the particles are determined the distance from the old position and the new position are checked against the distance from the old position and the closest point to the nearest polygon.  If the distance to the new particle is greater than the distance to the closest point then it has crossed the plane and a collision has occurred.  If not then we continue to the next time step.

In this version the particles are aware of the other particles around them.  They are all initiated in the origin with very small random position offsets. The velocity and acceleration are all initialized at 0. The first noticeable behavior is that they don't want to be next to each other and will try to steer away from those closest to them.  If they get to far from the ones closest they will begin to pull towards those closest in proximity.  This can be used to create a flocking like effect.

Near the end of the video a few of the particles start to drift away from each other. This is due to the integration method.  Euler integration is fairly unstable without a high number of sub steps.  Increasing the number can help with this problem but also slow the simulation.  Another alternative would be to use a 4th order Runge-Kutta integration method.

This last version shows particles emitting from a point darting back and forth that are only effected by a gravitational pull in the center.

bottom of page