cos426.jpg (39279 bytes)

Computer Graphics, Spring 2007


Assignment 4: Particle System

Due on Monday, April 21 at 11:59 PM

Art Contest Results


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, or even flocks of birds or schools of fish.

Getting Started

You should use the following skeleton code (COS426_assignment4.zip) as a starting point for your assignment. We provide you with several files, but you should mainly change particle.cpp.

After you copy the provided files to your diectory, the first thing to do is compile the program. If you are developing on a Windows machine and have Visual Studio .NET 2005 installed, use the provided project files to build the program. If you are developing on a UNIX/Linux machine, type make in the assignment4 directory. In either case, one executable will be created: particleview (or particleview.exe).

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 three new commands: particle, particle_source, and particle_sink. We provide the sample scenes from the last assignment; you can add particles to these. We also provide some scenes including particles in the scenes directory of the zip file.


How the Program Works

When particleview is executed, it reads a scene file and spawns a window.
% particleview in.scn
In the provided version of the program, the scene is drawn (with particles shown as white points), but the particles are not animated. Your job is to update the code to generate, update, and render particles at each time step of the simulation (in GenerateParticles, UpdateParticles, and RenderParticles).

As in meshview and rayview, particleview allows the camera to be moved interactively with the mouse -- i.e., dragging with the left, middle, and right mouse buttons down rotates, scales, and translates the scene, respectively. Also, hitting the 'P', 'F', and 'E' keys toggle drawing particles, faces, and edges of the scene, respectively, and hitting the 'S' key saves an image of the window to a file. Of course, you are welcome to create your own program arguments, scene commands, and interactive commands - please provide documentation of them with your writeup.

The particle system should be implemented in particle.cpp. 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: 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, 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.

You should include a screenshot for each implemented feature; features without screenshots will not be graded.

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

You should provide a working program with scripts to run it, along with short movies to demonstrate that your program works. For each movie that you submit, you also have to submit the sequence of commands used to created it, otherwise it will not be considered valid.

It is possible to get more than 20 points. However, after 20 points, each point is divided by 2, and after 22 points, each point is divided by 4. If your raw score is 19, your final score will be 19. If the raw score is 23, you'll get 21.25. For a raw score of 26, you'll get 22.

Extra credit points cannot replace the required features (bold items). Your final score will be calculated by adding 10 to the number of extra credit points you achieve, applying the above formula for diminishing returns, and then subtracting the number of required points that you missed.


What to Submit

Note: The submission materials are slightly different from before
You must submit one archive (zip or tar file). It needs to have the following directory structure inside the zip:

The writeup should be a HTML document called assignment4.html. You will use the writeup to demonstrate the effects of the features you have implemented. List each implemented feature in the format given above, and for each feature, include a screenshot that demonstrates it. The caption must indicate the regions of interest. If it is reasonable to demonstrate multiple features with a single picture, or movie, you may do so.

Features that improve simuluation quality (e.g., midpoint integration and adaptive time steps) will require a comparison of two or more movies. Features that improve speed do not require a picture, but should include a brief comparison of performance on a scene with and without acceleration.

The included script must run the program with parameters and scenes that could generate all movies linked from the writeup. It must run entirely in the script/ directory. Please make sure that you include all input files.

NOTE: Please compress your art contest and writeup movies before submitting them (to save space).

Should you choose to create a video, there are many options for video encoders available, however we have found that FFMPEG works well and runs on both Windows and linux. MEncoder is another option.

Always remember the late policy and the collaboration policy.


Hints

A few hints:

FAQ