15-462 Programming
Assignment 3: Fun with Particle Systems
DEADLINE: Due
Friday October 31, 2003 midnight (spooky!)
Instructor:Doug James
An Overview
Particle systems
are an important and versatile tool for procedural animation. They can
be used to model a wide variety of phenomena, including explosions,
fireworks, water, smoke, lava, cloth, rigid and deformable objects,
fracture, grass, hair, and many other things. This assignment asks you
to build a particle system,
and use it all to create a "cool"
animation. You are also required to use texture mapping in some way. To
provide a place for your particles to crash on the ground (such as in
Karl Sims waterfall above), you can use your height field (from asst
#1), or you may choose to contain your particles inside (or on) an
object, or let them move freely in space.
Why?
This assignment
is intended as a hands-on introduction to integrating the equations of
motion, i.e., f=ma, for the simplest case of point-mass particles. It's
also intended to give you a lot of room to make something really
cool! The starter code can be from your first assignment, since
you only need basic functionality (to write (and perhaps read) a JPEG
image) and handle mouse and keyboard input. You must write the code
to manage features of the particle system you decide to use (e.g.,
create, delete particles, compute forces, collisions, Euler
integration), perform any and all rendering (including some required
texture mapping), and handle any other functionality you may desire.
We highly recommend the use of GLUT--please see the OpenGL Programming
Guide for information, or, if you chose not to purchase this book,
please see OpenGL.org and a page of OpenGL
tutors or the
on-line red book . You may use an alternate library (FLTK, GTK,
etc) if you desire, but your submission must run in the
graphics cluster, and we will likely be unable to provide support if
you run into problems.
Background
Information
Particle systems
are very very widely used in computer animation and games to create a
variety of effects. Some references (and info on the authors) are:
- W. T.
Reeves, Particle Systems - a
Technique for Modeling a Class of Fuzzy Objects, ACM
Transactions on Graphics, 2(2), pp. 91-108, 1983.
- Karl Sims, Particle animation and rendering using data
parallel computation, ACM SIGGRAPH Computer Graphics, v.24 n.4,
p.405-413, Aug. 1990
- A. Witkin, D. Baraff, M. Kass: Physically-Based Modeling, SIGGRAPH
tutorial course notes. 2001
Your Implementation
For starter code,
you may use any code from your prior assignments, including you height
field implementation. Try to use the particle system programming
abstraction described in Andy Witkin's "Physically Based Modeling" course notes.
Grading Criteria
Your program must:
- Animation:
- Include an animation that displays interesting particle system
behavior.
-
You will receive credit based on your animation's artistic and/or
technical content, whether pretty, funny, or just interesting in
some manner. Let your imagination run wild.
- Particle System:
- Handle at least 100 particles at one time.
- Have particles interacting with either
- one another, e.g., via springs or gravitational forces, or
- with the height field or other collision obstacle, or
- an interesting force field (such as in Karl Sims "Particle
Dreams")
- Texture Mapping:
- As an additional constraint, you must use texture mapping in
your scene to make your animation sequence look more interesting.
You can use the texture to specify any
rendering attributes you desire, e.g., diffuse reflectance.
- Viewing:
- Render as a perspective view, utilizing GL's depth buffer for
hidden surface removal.
- Use input from the mouse to spin the heightfield around using
glRotate.
- Use input from the mouse to move the heightfield around using
glTranslate.
- Use input from the mouse to change the dimensions of the
heightfield using glScale.
- Be reasonably commented and written in an understandable
manner--we will read your code.
- Be submitted along with JPEG frames for the required animation
(see below).
Animation
Requirement
After finishing
your program, you are required to submit an animation, represented by a
series of JPEG images which are screenshots from your program.
Functionality to output a screenshot is included in the starter code,
and assumes you are using a window size of 640x480--your JPEG images
must be this size. Please name your JPEG frames 00.jpg, 01.jpg, and so
on, where 00.jpg is the first frame of your animation, and please do
not exceed 100 frames. Expect a framerate of 15 frames per second. It's
probably a good idea to test your animation by using animate ("man
animate" for information) in the graphics cluster. This program takes a
sequence of images and displays them as an animation, at your desired
framerate.
The method of
generating your frames is left up to you--there is a large amount of
room for creativity. You may use any software you wish to generate the
source images for your height fields or particles. The GIMP is
available on graphics cluster machines (type "gimp" at a terminal
prompt). You may also use your animation to show off any extra features
you choose to implement.
Submission
Please submit your
code along with your makefile to /afs/andrew/scs/cs/15-462/students/your_andrew_id/,
in a sub-directory called asst5. Running "make" in this
directory should compile your program successfully--if not, you've left
out a necessary file. Within this directory, make a sub-directory
called movie, and place the frames for your animation within,
numbered as described above.
Tips
- First try simulating a single particle with unit mass (m=1), then
consider particle systems.
- Collisions (if you decide to implement them) can be handled in
two simple ways:
- Reflection: Reflect
the particle by changing its normal velocity with respect to the
surface, and multiplying by a restitution coefficient, 0 <= k
<= 1 (as discussed in class);
- Penalty method: When a
particle penetrates a surface, use a stiff spring to pull it back toward
the surface. Adding some damping while in contact to help the particles
lose energy--providing an effect similar to a restitution coefficient
<1.
- Beware that stiff springs or strong damping will tend to make
your Euler integration step unstable. Reducing the step size will help.
In general, at any given time for your simulation, there will exist some
maximum allowable time-step before the integrator becomes unstable. You
may find that the midpoint method tends to be more stable than the
forward Euler method.
- Make your particles look interesting. Better than just rendering
points, you can render small geometric primitives, e.g., a sphere, by
placing them in display lists.
- If you choose to just render GL_POINT primitives, you can specify
point size based on depth in the scene by using these OpenGL methods:
- glPointParameterfSGIS, glPointParameterfvSGIS - set point
parameters
- glPointSize - specify the diameter of rasterized points
- Examples from Mark Kilgard are here.
- Finish your program completely before worrying about the
animation (although think of a creative animation to make).
- Don't try to do this at the last minute. This assignment is
supposed to be fun and relatively easy, but time pressure has a way
of ruining that notion.
Extras
You may choose to
implement any combination of the following for extra credit.
- Try combining particle systems. How many different particle
systems can you display? For example, consider having water fall
onto a fire and create smoke... or onto an electrical fire and create
sparks.
- Use the midpoint integration method instead of the forward Euler
method.
- Use the accumulation buffer to cause motion blur effects.
- Render particle trails as splines using evaluators.
- Render a deformable 2D surface, e.g., a piece of cloth, using
splines using evaluators.
- Render your particles using textured billboard quads for more
interesting appearances, e.g., a starburst
or a puff of smoke. The best way to do this is to use blending (chapter
10 of the RedBook) so that the particles look nice when their billboards
overlap. Texturing and compositing is a powerful way to make your
particles look their best.
For the brave or
insane:
- Implement a cloth simulator.
- Reanimate a classic sci-fi sequence, e.g., Wrath of Kahn's
Genesis effect.
- Implement a flocking simulator.
- Hand you assignment in early and
go out for Hallowe'en.