CSCI 4972/6963 - Spring 2008
Advanced Computer Graphics
  Contact Information
  Office Hours



  Assigned Readings

  Lecture notes
  Lab materials
  Test reviews

  Collaboration Policy
    gcc/g++ notes
    GL/glut notes
  Homework Late Policy
  Electronic Submission

Final Project
   Spring '08 Projects
   Spring '07 Projects

Academic Integrity

Assignment 2: Cloth & Fluid Simulation

The goal of this assignment is to implement and experiment with two different physical simulation engines: a spring-mass cloth system and a grid-based fluid system. The bulk of the rendering, visualization, and interaction code including the basic data structures is provided.

In the cloth simulation a 2D grid of point masses are connected with structural, shear, and flexion/bend springs. To mitigate the "super-elastic" effect of these springs without increasing the stiffness (which requires a smaller timestep) you will implement the correction term described in "Deformation Constraints in a Mass-Spring Model to Describe Rigid Cloth Behavior", Xavier Provot, 1995.

For the fluid simulation, you will track a collection of marker particles as they move through a 3D grid of cells, monitoring the cell pressure and velocity through each face of each cell. The implementation requires tri-linear interpolation of the velocities, handling free-slip and no-slip boundary conditions, and adjustment for incompressible flows as described in "Realistic Animation of Liquids", Foster and Metaxas, 1996.


  • Download the provided source code and the sample test datasets. Compile it on your favorite platform and try the command lines below. There are a number of visualization options for the cloth system. Press 'm' to toggle drawing of the masses/particles in the spring-mass particle system. Press 'w' to toggle drawing of the wireframe (springs). Press 's' to toggle drawing of the surface represented by the masses & springs. 'v' and 'f' are used to toggle visualizations of the velocity and forces at each mass position. Finally, 'b' is used to toggle the bounding box of the original mass positions.

  • First implement basic animation of the masses. You'll need to compute the spring forces and track the position, velocity, and acceleration of each particle as time progresses. Simple forward/explicit Euler integration is sufficient. You can access the timestep and gravity from the ArgParser class. Initially test your code on the small example shown below and verify that each of the spring forces (structural, shear, and bend/flexion) and the force due to gravity are correct. Pressing 'a' will toggle the animation on and off. Each loop of this continuous animation will call Cloth::Animate() 10 times and then refresh the screen. To take just one step of animation, press the space bar. You can restart the animation from the beginning by pressing 'r'.
    simulation -cloth small_cloth.txt -timestep 0.001

    You will need to complete the implementation for the force visualization. Your visualization does not need to match the one above (the blue lines), as long as you find its output informative and helpful in your debugging.

  • Once your basic spring-mass system is working, test it on the larger example below. As illustrated by Provot, the springs at the corner will stretch too much. Implement the iterative correction/adjustment method for springs that have stretched beyond the specified threshold. The provided code will visualize the "over-stretched" springs in cyan (shown below).
    simulation -cloth provot_original.txt -timestep 0.001
    simulation -cloth provot_correct_structural.txt -timestep 0.001
    simulation -cloth provot_correct_structural_and_shear.txt -timestep 0.001

  • When you are confident that your implementation is complete, test it on the examples below which use different parameter values to mimic different types of cloth. Now experiment with your system and try adjusting the many different parameters. How stable is the simulation? Discuss in your README.txt. Make at least one interesting new test scene. You may extend the input file format as necessary for your new example(s). Describe your new example and how to run it in your README file.
    simulation -cloth denim_curtain.txt -timestep 0.001
    simulation -cloth silk_curtain.txt -timestep 0.001
    simulation -cloth table_cloth.txt -timestep 0.005

  • In your experimentation, you undoubtedly caused the cloth to "explode" at least once. In theory this instability can always be fixed by u