COL865: Physics-Based Animation
Assignment 0: Setting Up

This assignment is not worth any points, and you do not have to submit anything. It is only to make sure you can produce animated results from your computer graphics code, which you will need to be able to do for future assignments. You should get this set up now, so you won’t have to waste time later worrying about rendering instead of working on the actual simulation problem.


The following procedure makes a rudimentary animation of a waving flag. Consider a rectangular array of vertices indexed by \(i=0,\dots,3n\) and \(j=0,\dots,2n\). At time \(t\) seconds, let the \((i,j)\)th vertex be at the position \[\begin{aligned} x &= u, \\ y &= v, \\ z &= \frac1{20}\,u \sin(2\pi(u + v - t)),\end{aligned}\] where \(u = i/n\), \(v = j/n\). The surface of the flag is constructed by connecting these vertices via polygons: either quadrilaterals of the form \((i,j),(i+1,j),(i+1,j+1),(i,j+1)\), or two triangles for each such quadrilateral.

Write a program to create this animation. Generate renderings in two styles:

  1. A basic particle view where each vertex is drawn as a dot or a sphere, with edges (drawn as lines or cylinders) connecting adjacent pairs of vertices \((i,j),(i+1,j)\) and \((i,j),(i,j+1)\).

  2. A surface view where the vertices themselves are not drawn, but the flag is drawn as a continuous surface by connecting the vertices using quadrilaterals or triangles. Make sure you add some lighting so that the waves in the surface can be easily seen.

To add some context to the animation, you could also draw a flag pole along the \(y\)-axis, and a floor plane at some negative \(y\).

Create videos of your animation in both rendering styles. In future assignments in this course, one of the things you will have to submit with each assignment is the video(s) showing your results, so make sure you are able to generate such videos of your program. Some suggestions for how to do so are given below.

Implementation Advice

You may implement your program any way you like, as long as you are doing the animation part entirely within your own code instead of e.g. using a 3D graphics package to define the vertices and the wave motion. Here are some possible approaches:

Choose whichever strategy with which you feel confident that you will be able to extend it to more complex programs. If you don’t have significant experience with graphics programming, here’s a simple example program with OpenGL rendering in C++ that you can use as a starting point.