CSE 557 Final Project - Winter 2001
Cloth Simulation

Isaac Kunen (zook@cs)
Sarah Schwarm (sarahs@cs)


The Problem:

Rendering realistic images of cloth is a challenging problem in computer animation. For this project, we explored some current methods of rendering cloth using particle systems.

Approach

We used the basic model described in [1] and [2]. In this approach, a sheet of fabric is modeled by a particle system consisting of a grid of particles connected by springs.

The particles are laid out in a rectangular grid. Three types of springs are used:

  1. Structural springs connect adjacent particles horizontally and vertically in the grid. These springs give the fabric its basic shape (a flat sheet). However, this is not enough to produce realistic behavior. The fabric tends to degenerate into a droopy blob under the force of gravity.
  2. Shear springs connect particles to their diagonal neighbors in the grid. These springs help prevent excessive shearing by maintaining the spaces between diagonal particles.
  3. Bend springs connect particles horizontally and vertically, skipping one particle in each direction. The bend springs are typically the loosest springs in the model, since cloth usually bends and folds quite easily. Substantially increasing the stiffness of these springs results in paper or cardboard-like effects.

In addition to the damped spring forces, several external forces act on the particle system. These forces are gravity and a viscous damping force.

At each time step in the implementation of our particle system, we loop over all the particles, accumulating the contributions of the adjacent springs and all the external forces. Then we solve a set of differential equations relating the sum force, position, and velocity of each particle to get a new position and velocity. Initially, we used a simple Euler method to solve the differential equations. Later, we tried a version of the Runge-Kutta algorithm. We never quite got this to work. We achieved the best results using the Euler method and very, very small time steps. For each time step that we actually rendered (30 per second), we stepped the simulation 20 times.

Simulation Framework

We built our cloth simulator as an add-in to the animation program from the last project. As described above, our cloth simulation consists of a grid of particles. Our simulation framework allows us to control the cloth in a number of dimensions.

There are three basic types of springs in our model. We specified 6 different spring constants, one for each direction (horizontal/vertical, or the two diagonals in the case of shear springs) for each type of spring. The spring constants can be controlled by sliders in the user interface (or by drawing curves in the animator's curve mode.)

The viscosity, damping force, and gravity can also be controlled by sliders.

The four corners of the cloth are control points that can be manipulated directly by the user. Each corner can be moved in all three dimensions. By default, these particles are "pinned" to the locations specified using the sliders; they do not move according to the spring forces or external forces. The interface also has checkboxes that allow the user to free any or all of these control points so that they follow the rest of the cloth. The control points can be unpinned and repinned at will. When they are repinned, they jump back to the location specified by the slider values. This creates some interesting and often realistic (though somewhat rubbery) effects, although it occasionally results in unwanted artifacts.

The cloth is rendered by drawing triangles between the particles in the grid. We render the front and back of the cloth in different colors so they are easily distinguished. We also created an option (another checkbox on the interface) to render the fabric in stripes of two different colors. We used horizontal stripes on the front and vertical stripes on the back. The stripes make it easier to see some of the cloth-like effects we were able to achieve with our simulation.

Challenges

Getting the system to render fast enough was a big challege. In order to get realistic results, we had to use very small time steps in our particle system simulation. (If the time step was too large, either the math blew up, or, in less extreme cases, the cloth was very rubbery and droopy.) Finally, we settled on very small time steps, recalculating the velocity and position of each particle 20 times for every single animation time step (30 per second). This resulted in rendering speeds substantially slower than real-time, but the cloth looked more realistic.

We tried to implement the Runge-Kutta algorithm in an attempt to solve the time-step problem. The advantage of Runge-Kutta is that it exhibits O(n^4) convergence instead of O(n^2), allowing us to use larger time steps. Although we spent a long time trying to get this working, we never quite succeeded in getting it to work correctly. For the benefit we did get from it, it was still slower than our original Euler version, so we reverted to that one. We investigated implicit methods for solving the system of differential equations, but we did not have time to impement them.

There was also a trade-off between realism and rending time in terms of the number of particles in the grid. A 10x10 grid rendered quickly, but the result was a highly faceted thing that did not look like cloth. 20x20 is better, but the facets were still visible, and it definitely doesn't render in real time.

Results

We tried to create a few different types of cloth with our model. Although all of our models resemble latex to some extent, we were able to develop some models that vaguely resemble some realistic types of cloth. Here we present a few examples. Of course, since most of the interesting behavior of this system is dynamic, we suggest the reader download and play with the executable.
Silk
Silk is rather light, and bends very easily. It isn't terribly stretchy, however. In addition, due to its lightness, it percieves a higher air viscocity than other fabrics. In our model, we tried to take this into account.

Settings
structural 70000
shear 12000
bend 1000
viscosity .0025
damping 20
gravity -9.8


Silk being dragged slowly by one control point
Knit
A knit is usually rather heavy and stetchy. As such, it feels the effect of air very little if any, and most damping is internal. We modeled this by making it more elastic, eliminating air effects, and increasing the force of gravity on the array.

Settings
structural 35000
shear 20000
bend 26000
viscosity .0
damping 80
gravity -30.0


Knit being hung by two control points
Tissue
Our tissue model drastically reduced the effect of gravity, and increased the structural and shear coefficients. As with silk, we increased the air effect to make the cloth float more. We were able to get a fairly nice-looking tissue model this way.

Settings
structural 100000
shear 100000
bend 65000
viscosity .002
damping 25
gravity -2.6


Tissue in free fall
Canvas
Canvas doesn't stretch too much, but more importantly is rather stiff and heavy. Our model tried to capture this by ignoring air effects, and adding a high rigidity to the fabric.

Settings
structural 80000
shear 55000
bend 100000
viscosity .0
damping 60
gravity -20.0


Canvas being hung from one control point

Executable

Our simulation program runs in Linux. To try it out:

animator
libmodeler.so
libsimple.so

References: