This is a real time particle simulation with vortex choreography and rigid collisions. This was written in C++ and uses OpenGL for rendering. The choreography is based on Karl Sims' Particle Animation and Rendering Paper . The simulation utilizes the Mersenne Twister Random Number Generator class for distributing random particle attributes. Also I utilize the Kixor.net Obj Loader for reading in collission object .OBJ files.

A particle simulation must have a particle structure. In this simulation I created an external chunk of particles that required no constructor, since calling the constructor for thousands of particles would be slow. All particles have a start position which is used when a particle needs ro be reborn. Tests were performed with initiating a random position everytime a particle needed to be reborn but significantly slowed the sim. Instead I change the size when a particle is reborn to achieve the same visual effect of random birth and just use the initial random distribution of particles created during world spawn. Also included is an emitter class that sets the various attributes for the paritcle chunk when either the world spawns or when a particle's state needs to be updated.
The simulation loop was optimized to allow special computations for all emitters in the scene. Integration and forces are only computed for a live particle. Collission detection is only carried out if a particle is not in the safe zone, which is computed to be the area in the the world that has no collission objects. Checking to see of a particle is in range of vortex influence which vortex to use, but speeds up the sim as well. Making sure that we arent doing unnecesary computation is the key to making a particle sim run good.
Copyright 2001-2012 Benjamin Bertka. All Rights Reserved