CS 184: Computer Graphics and Imaging, Spring 2017

Project 4: Cloth Simulator

Jennifer Hsu, CS184-abn



Overview

Project 4 is composed of 4 parts:

Part I: Masses and Springs

Model cloth with masses and springs. Masses are distributed evenly on a grid. Three types of strings are created: Structural, Shearing and Bending.

Part II: Simulation via numerical integration

Apply forces to the masses of the cloth. Ex: gravity

Part III: Handling collisions with other objects

Compute the intersection of a cloth and sphere. When a point is in a sphere, we correct the mass position to the surface of the sphere. The same logic is applied to the collision of a cloth and a plane.

Part IV: Handling self-collisions

When a cloth falls freely, there are collisions between the cloth's masses. To minimalize the amount of computation, it is easier to store point masses in small boxes and only calculate possible collisions within the small box.

Part I: Masses and springs

Model a piece of cloth with evenly distributed masses and 3 different type of springs connecting them. The three types of springs are structural, shearing and bending.

Structurla: between a point mass and the point mass to its left and point mass to above it.
Shearing: between a point mass and the point mass to its diagonal upper left and point mass to its diagonal upper right.
Bending: between a point mass and the point mass two away to its right and the point mass above it.

Wireframe of a cloth.

Without any shearing constraints
With only shearing constraints
With all constraints

Part II: Simulation via numerical integration

The idea is to apply forces (characterised by acceleration) to each point mass. The forces include gravity and forces from the spring(characterised by ks)

Default

Animation of cloth falling forwith two corners pinned. (default ks: 5000)

Effect on cloth with change of ks.

ks is the spring constant. According to Hooke's Law: F = -kx. Under the condition that the displacement is the same, the larger the spring constant(ks), the larger the force the spring is pulling on the masses.

Animation of cloth falling with two corners pinned. (ks: 500)

We can see that the cloth with a higher ks has more wrinkles compare to the cloth that has a lower ks.

Effect on cloth with change of density.

The higher the density, the stronger the springs pull on the masses.

Cloth with different density: 5, 15, 50

Density: 5
Density: 15
Density: 50

Effect on cloth with change of dampling.

Dampling reflects how much the positions of the masses should be corrected.

Cloth with different dampling

Dampling: 0.0
With no dampling, the cloth continues to ripple after a long period of time.
Dampling: 0.2
With 0.2 dampling, the cloth still ripples, but eventually comes to a stop.
Dampling: 1
With 1 dampling, the cloth stops moving when the lower two corners reach the bottom

Shaded cloth with four sides pinned

Cloth pinned at four corners

Part III: Handling collisions with other objects

Effect on cloth-sphere collision with change of ks.

Similar to the reasoning above, the larger the ks, the greater the force the spring pulls on the masses its connected to.

Collision of cloth and sphere.

We can see from the images below that the smaller the spring constant, the more the cloth is wrapped around the sphere.

Cloth with ks: 500
Cloth with ks: 5000
Cloth with ks: 50000

Cloth resting on a plane.

Cloth lying on a plane.

Part IV: Handling self-collisions

For easier comparison, the following screenshots are taken at equal time intervals.

Sequence of images of a cloth falling to a plane. (Focus on self colliding)

Sequence of images of a cloth with different density falling to a plane. (density: 100)

In comparison with the cloth above, the cloth has more ripples.

Sequence of images of a cloth with different spring constant falling to a plane. ks: 500)

In comparision with the cloth in the first sequence, this cloth has less wrinkles