Particle effect engine

Static Badge Static Badge

Graphical effects are usually simulated with particles (fluid dynamics, smoke, fire, etc..). The usual particle system is made of the following:

In the system, a particle is a fully independent construct. It is able to compute its position and draw it self. Every particle has a directional vector and speed. Particles have a limited lifespan (time to live). The time to live is used to increase the transparency of the particle when drawn. When the particle's TTL is expired, the particle is removed. All particles start at the position of the emitter. The emitter emits new particles depending on the effect type (burst all particles at once, emit \(n\) particles per second, etc..). The window is also a bounding box where particles collide and bounce off.

There are a number of optimization techniques that can be employed to handle a larger number of particles. For fluid dynamics a enormous number of particles is needed. Additionally, the particles must follow basic rules of physics (gravity, collision, etc). It is encouraged for students to implement their own 2d collision detection and basics physics in parallel. However, should this prove to be infeasible, a 2d physicist engine can be used but the source code should be changed to compute the physics in user-defined threads. This project should be considered by students are comfortable with more research oriented tasks.

Implementation guidelines

  1. Implementation of the graphical interface:

    • The graphical interface must be implemented using the Java Fx library.

    • The drawing of the graphics should be done independently of the computational threads.

    • The default size of the window is 800x600px but must allow manual adjustment.

    • The drawing of particles should be be synchronized with the update (usually not the case).

  2. Running the program:

    • The program can be ran in different modes (sequential and parallel) by specifying a parameter.

    • User can specify the number of particles with a parameter.

    • User can specify the size of the window and position of the emitter

    • User can specify the type of emitter used (burst particles, emit over time).

    • The program measures run-time needed to complete.

  3. Problem specific implementation requirements

    • Special care should be given to instantiation of particle objects and reuse. Avoid burning CPU for garbage collection.

    • The implementation must adapt automatically to the hardware it is being ran on (Physical CPU's, Cores, Memory, etc..);

Testing

All three versions must be tested. The parameter that influences computation run-time is the number of particles in the simulation. Start testing with a 100 particles and increase it by a 100 to obtain the next configuration. For each configuration measure the average frames per second (100 measurements should give a good average).\ The second round of testing must increase the number of particles as long as the average number of FPS does not fall below 60.\ Draw the respected data in informative charts and discuss the results.