James P. O'Shea
Graduate Student

University of California, Berkeley
Vision Science Program
Visualization Lab
Banks Lab
505 Minor Hall
University of California, Berkeley
Berkeley, CA 94720-2020

joshea (at)

Cloth Simulation

I created a cloth simulation for assignment 4 in CS294-13 (Advanced Rendering). I implemented the cloth as a network of mass nodes connected together using non-zero length springs. My implemention allows the user to interactively manipulate the cloth using the mouse. I wrote the simulation using C++.


* Interactive control of node positions

* Interactive control of spring damping and tension

* non-zero length springs

* Edge springs (to resist folding)

* Simluation of wind

* Floor constraint (simple collision detection)

Demo Movies

I made several screencasts to demonstrate different parameter settings for my cloth simulation. Additional information is provided below, but here are the movies for quick reference:

* Single layer of springs connecting neighboring nodes [LINK]

* Demonstration of "wind" force [LINK]

* Structural springs to resist bending [LINK]

* Additional structural springs to resist bending [LINK]

* Adjusting spring tension [LINK]

* Adjusting spring damping [LINK]

* Edge springs [LINK]

* Large simulation [LINK]

In most of the demos, I hang a sheet from its top corners such that it can move freely in space. The sheet consists of 48x48 nodes, and it is rendered with diffuse shading along with the edges connecting the individual mass nodes of the simulation. My implementation allows the user to interact with the sheet using the mouse to move selected nodes within the x,y plane of the sheet. I also added a floor constraint to simlulate an invisible floor on which the sheet will land if unpinned.

Simple Springs


I first simulated a sheet by implementing an array of nodes connected to each other with non-zero length springs. The springs connect the nodes horizontally, vertically, and diagonally. This configuration resists sheering but the sheet can still easiy fold onto itself and bunch together. This bunching can easily be seen in the movie.

Simulated Wind


I simulated wind by simply adding a small random force along the z-axis. This has the added benefit of keeping the sheet relatively open and smooth.

Additional Springs to Resist Folding


In this demo, I added a second layer of springs, each of which spans 2 nodes. Each node is connected to its immediate neighbors as well as well as the nodes that are 2 spring-lengths away. These additional springs resist bending and keep the sheet smoother. In the movie, the sheet is less likely to bunch up.

Even More Springs to Resist Folding


I also tested the cloth simulation with 3 layers of springs. Each spring in the third layer spans 3 spring-lengths. This demo runs a little more slowly because I have several thousand springs to calculate for each frame, but the sheet is smoother and less likely to bend. This is clearly demonstrated when the sheet is dropped on the floor at the end of the demo movie. Although the sheet initially falls into a pile, the extra springs resist the bending and the sheet slowly unfolds itself to lay flat.

Adjusting Spring Tension


My application allows the user to interactively adjust the spring tension by increasing or decreasing the spring constants. With little tension, the sheet sags and appears similar to a cloth with a loose, stretchy weave. At high tension, the sheet is tighter and appears similar to a rubbery sheet. In this demo, I adjust the tension a couple times from medium to low to high, and you can see the behavior of the sheet change as I interactively move it using the mouse.

Adjusting Spring Damping


My application also allows the user to interactively adjust the damping of the springs. This has the effect of changing how quickly the springs return to their resting state. In the associated demo, I adjust the damping from its initial state to a high value and then a low value. Note how the speed of the sheet changes as the damping increases.

Edge Springs


Another method to reduce out-of-plane bending is through the use of the edge spring, which puts a constraint on the degree to which the two neighboring faces of an edge can bend towards each other. Regular springs apply a force based on the resting length of the spring. Edge springs apply a force based on the resting angle of the edge. In my simulation, I maded the resting angle 180 degrees, which makes the sheet lay flat at rest. In the associated demo movie, I initially start with a cloth using only a single layer of springs. As previously shown, this configuration can easily be bent out-of-plane, and the cloth has a tendency to bunch up. I then alternatively turn the edge springs on and off. When in the "on" state, the edge springs flatten the sheet out and reduce how much it can bend.

Large Simulation


As an additional simulation, I increased the number of nodes in the cloth to be 100x100. This simulation is slower given the high number of springs to calculate, but the effect is that of a much larger and slower moving sheet.