COS 426:
Computer Graphics
Spring 2014


General | Syllabus | Assignments | Final Project


Overview

In this assignment, you will implement a basic particle system. The program will read in a scene file with particle commands and then draw particles as they move over time in an interactive viewer.

At its simplest, your program will be able to spawn particles, apply forces such as gravity and drag to them, and bounce them off of scene geometry. Once you have the basic system in place, you have a broad selection of options to improve your system. You can choose to focus on the rendering or the physics of the particles. Improved rendering will allow for more convincing simulation of phenomena such as smoke, fire, and sparks. Improved physics will allow simulation of rope and cloth, solid objects, or even flocks of birds or schools of fish.



Running the Program

When particleview is executed, it reads a scene file and spawns a window.
% particleview in.scn
As in meshview and rayview, particleview allows interactive viewing of the scene with the mouse and keyboard. Dragging with the left, middle, and right mouse buttons down rotates, scales, and translates the scene, respectively. Hitting keyboard keys toggle display of particles (P), particle springs (R), particle source and sinks (S), faces (F), edges (E), node bounding boxes (B), lights (L), and the camera (C). Hitting the SPACE key prints the current camera parameters (in a format that can be included in another .scn file), Q quits, and F1 saves a screenshot in an image (in "imageN.jpg", for N=1,2,etc. increasing each time an image is dumped in the same session). Some of these commands are also available via a menu that pops up when the right mouse button is pressed. Of course, you are welcome to modify the source code in particleview.cpp in any way you want to produce new displays, but please keep the semantics of the existing user interface, and please provide documentation of new features with your writeup.

In the skeleton code, the scene is drawn, but the particle system is not implemented. Your job is to fill in the code in particle.cpp to generate, update, and render particles at each time step of the simulation. For every refresh of the window in particleview.cpp, the DrawParticles function is called. It reads the current time (in seconds since the start of the program) and calls three functions that you must implement (in particle.cpp): UpdateParticles, GenerateParticles, and RenderParticles. UpdateParticles should update the position (and possibly other parameters) of every particle at the current time. GenerateParticles should create new particles for every particle source. RenderParticles should use OpenGL commands to draw every particle on the screen. Shells are provided for these three functions in particle.cpp, but you must fill in the details.



What You Have to Do

The assignment is worth 20 points. The following is a list of features that you may implement (listed roughly from easiest to hardest within each group). The number in front of the feature corresponds to how many points the feature is worth. The features in bold face are required. The other ones are optional.

By implementing all the required features, you get 13 points. There are many ways to get more points:

It is possible to get more than 20 points. However, after 20 points, additional points will incur diminishing returns, as on past assignments.


Getting Started

You should use the following skeleton code (cos426_assignment4.zip) as a starting point for your assignment. Compiling the skeleton code will create particleview (or particleview.exe). particleview is like rayview, but also calls functions from particle.cpp for simulation and drawing of particle systems.

The skeleton code is able to read scene files (like in assignment 3) augmented to support particle systems. Specifically, the scene file format now supports five new commands: particle, particle_source, particle_sink, particle_spring, and particle_gravity.

We provide several scenes with particles in the input subdirectory of the zip file that you can use to test your program along with a set of examples. However, you should definitely create your own files for testing, demonstration, and artistic purposes.



Submitting

You should submit your solution using one zip file named cos426_assignment4.zip via CS dropbox at this submission link. The submitted zip file should have the following internal directory structure:

cos426_assignment4/

The writeup.html file should be an HTML document demonstrating the effects of the features you have implemented and would like scored. You can start from the writeup.html provided with the distribution as a template -- simply add/delete sections to that HTML file for the features you implement.

The src directory should have all code required to compile and link your program (including the files provided with the assignment), along with a Visual Studio Solution file and a Makefile to rebuild the code. We will not attempt to grade assignments that neither build in Visual Studio nor with GNU Make under Mac OS X.

The output directory should contain animated gifs that you have captured to demonstrate the features of your program.

Note that you are expected to use good programming style at all times, including meaningful variable names, a comment or three describing what the code is doing, etc. Partial credit may not be assigned for code without comments.



FAQ

Answers to frequently asked questions: