Project 4: Cloth Simulation

By Alana Li

Overview

This project simulated real-time cloth, modeled with masses and springs. Three types of springs were included, structural, shearing, and bending. Simulation of how the cloth would fall due to gravity was implemented, and computation of cloth self-collision and collisions with other objects were also added. Lastly, shaders for the cloth were implemented.

Part 1: Masses and Springs

2 Pins

Wireframe with 2 Pins (Gravity Included)

A square piece of cloth was modeled with masses and structural, shearing, and bending springs.

Structural Springs: Between a point mass and the point mass to its left as well as the point mass above

Shearing Springs: Between a point mass and the point mass to its diagonal upper left as well as the point mass to its diagonal upper right

Bending Springs: Between a point mass and the point mass 2 to the left as well as the point mass two above

All Constraints

All Springs

No Shearing

No Shearing

Only Shearing

Only Shearing

Part 2: Simulation via Numerical Integration

Modifications to Gravity (m/s²)

Less Gravity

Less Gravity (-5)

Default Gravity

Normal Gravity (-9.8)

More Gravity

More Gravity (-15)

With less gravity, the cloth falls slower, with more gravity the cloth falls faster. It also takes longer for the cloth to settle at an equilibrium state with lower gravity than with higher gravity.


Modifications to Spring Constant (N/m)

Less ks

Less ks (2500)

Default ks

Normal ks (5000)

More ks

More ks (7500)

With a lower ks value, the cloth is more elastic. There is a much more visible bounce during and after the fall as compared the the higher ks value. The cloth simulated with a high ks value stretches a lot less in comparision.


Modifications to Density (g/cm²)

Less Density

Less Density (5)

Default Density

Normal Density (15)

More Density

More Density (25)

Density is involved in the calculation of the mass of the points in the cloth. With a lower density cloth there isn't much movement when the cloth falls, the curve at the top is much less dramatic than with higher density. With higher density the cloth falls with thicker folds.


Modifications to Damping

Less Damping

Less Damping (0.1%)

Default Damping

Normal Damping (0.2%)

More Damping

More Damping (1%)

Damping is the variable that controls how much energy is lost. With a lower dampening value, less energy is lost so the cloth stays in motion more after it falls, swinging back and forth. With a higher dampening value the cloth comes to a stop quickly.


4 Pin Cloth

4 Pin Cloth (Normal Paramenters)

Shaded 4 Pin Cloth

Shaded 4 Pin Cloth (Normal Paramenters)

Part 3: Handling Object Collisions

Sphere Collision (50000ks)

Sphere Collision (50000ks)

Sphere Collision (5000ks)

Sphere Collision (5000ks)

Sphere Collision (500ks)

Sphere Collision (500ks)

As shown above, with a higher ks value the cloth is less tight around the sphere while lower ks values have the cloth more draped and close-fitted to the sphere. This makes sense because ks effects the stiffness of the cloth. The more stiff the cloth is, the less it is prone to move and drape around the sphere.

Cloth on Plane

Cloth on Plane