CS4621 PPA3 Particle System
Out: Monday November 9, 2015
Due: Thursday November 19, 2015 at 11:59pm
Work in groups of 2
In this short assignment you will implement a particle system, specifically a fountain-style emitter.
A fireworks and fountain particle system using billboarding
- Forward Euler timestep and forces accumulation
- Particle emitter
- Orienting billboards
- Visualize velocity vectors
We have marked all the functions or parts of the functions you need to complete for the assignment with TODO#PPA3 in the source code. To see all these TODO#PPA3 annotations in Eclipse, select the Search menu, then File Search and type TODO#PPA3 (They can also be viewed through the Task List). You only need to modify the sections marked with TODO unless of course you want to add some additional cool shader or user interface functionality for extra credit. All other parts have been implemented for you.
Task 1: Forward Euler timestep and forces
Update the age of the particle as well as the acceleration, velocity and position for the current timestep in the animate() method of the Particle class. You should obtain the acceleration (using the forces and mass); Update the particle velocity based on the acceleration and proceed to update the position based on the velocity. Implement the relevant pieces in animate() under ParticleSystem to compute new particle velocities and positions at each timestep using forward Euler integration.
Implement 3 forces: gravity, wind, and viscous drag (air resistance) according to the equations we have seen in lecture. See the inline comments in ParticleSystem for the expected force specification and more details. The provided ParticleScreen class allows the strength of these forces to be adjusted from the keyboard, and your implementation must respect these settings. Animate the alive particles and recycle the expired particles based on their age using the provided LinkedLists.
Task 2: Particle Emitter
In the animate() method of ParticleSystem at each frame, if a certain time delay (e.g. 5 milliseconds) has elapsed, the particle system should emit a new particle. You should randomize the initial velocity and the appearance of each particle when it is emitted, since a system in which every particle behaves identically is pretty boring. Remember to restrict the range of randomness, though your particles should all go in the same general direction to maintain a ''fountain-like'' shape.
Screenshot of the reference solution with randomly colored particles
Task 3: Orienting Billboards
Figure 3: Billboarding coordinate system
Particles will be rendered as textured camera-facing quads, known as ''billboards''. We can support translucent objects, since most particles will be alpha-blended using the alpha channel of the provided texture, but you will need to implement the billboarding code yourself. Billboarding creates the illusion that the flat geometry is actually a (symmetric) 3D object. The ParticleScreen class will call the billboard() method on each particle system before it renders the system. Each particle is responsible for orienting itself towards the camera, and you are responsible for making this happen. You can use information from the camera view matrix to achieve this effect. Figure 3 above is a diagram of the relevant geometry.
Viewing the billboard quads from different viewpoints. Note that the quads are always facing the camera
Task 4: Visualize velocity vectors
Modify the draw() call in ParticleScreen to visualize the velocity vectors of individual particles as colored lines that start at the center of each of the particles and point towards the direction of motion with a length proportional to their current speed. Use the boolean flag showVelocities and the corresponding keyboard mapping to toggle drawing of the velocity visualization. Check the inline TODO comments in ParticleScreen for more details.
Visualizing the particle velocities
You must take care to implement your particle system storage efficiently. Do not allocate/destroy memory on the fly. Instead of creating a new particle when one needs to be emitted, you should create a ''particle pool'' at initialization, draw particles from this pool to emit them, and replace particles into the pool when they are destroyed. If multiple particles use the same geometry, same material, or same texture, make sure to share the relevant objects between particles.
Modularity: it is important to have modular code, particularly if you will use a similar particle system in your final project. While we only require one type of particle system in this assignment, think about how you could most easily support multiple types of particle systems for different aspects of your project. David Baraff's SIGGRAPH course notes, (particularly, the ''Differential Equation Basics'' and ''Particle Dynamics'' sections), at http://www.pixar.com/companyinfo/research/pbm2001/ could also be useful.
What to Submit
Submit a zip file containing your solution organized the same way as the code on Github. All the code you have written should be well commented and easy to read. The header comments for all modified files should indicate the appropriate authorship. Include a readme in your zip that contains:
- You and your partner's names and NetIDs
- Feedback on the assignment
- Explanation of any implementation choices you made
- Any problems with your solution
- Anything else you want us to know