Assignment 4: Cloth Simulation

Stephanie Claudino Daffara

This project tested my knowledge on creating a mass and spring based mesh and then defining and applying the physical constraints on the mesh and simulate how it reacts and moves over time. The mass and spring mesh was rather straight forward to implement as it required simply distributing evenly about a mesh its point masses and then connecting those point masses with springs that can resist both bending and shearing. I used a cloth mesh and also implemented the physical interactions it has with gravity, collisions with other objects, and collision with itself. First I started with collisions with other objects which was also a simple task given that we have worked on sphere and plane intersects in past projects. Last I worked on collisions of the mesh with itself which was probably the most difficult task from this project. Most difficulties came from misunderstanding how to use c++ data structures, pointers and references.

Part 1: Masses and springs

Here I implemented one of the simplest cloth models which uses point masses and springs to represent it's junctions and later on enable realistic movement. Below is the output of creating these structures and implementing the constraints of Structural, Shearing and Bending.

The following is how the model's wireframe looks when I enable and disable certain constraints:

With Shearing Enabled.
With Structural and Bending Enabled.
With Shearing, Structural, and Bending Enabled.

Part 2: Simulation via numerical integration

For this part of the project I implemented the simulate function, which in summary computes the total external force on each point mass using Newton's 2nd law, the spring correction forces applied on each spring's end's masses using Hooke's law, uses Verlet integration to compute the new point mass positions, and finally updates the constrain position to reduces spring deformity using SIGGRAPH 1995 Provot.

Changing the spring constant ks

ks 5000
ks 500
ks 5000
simulation of k changing from 5000 to 50

When we lower the ks constant the spring becomes less constrained and visually drops lower. It is also noticeable that the bottom of cloth also droops more and becomes curved, where as with the default ks set to 5000, the bottom of the cloth seems straight. A Lower value also made the clothes width thinner as you reach the bottom hanging part of the cloth.

Changing the density parameter

density at 15
density at 150
density at 1500
density changing from 15 to 150 to 1500.

It is interesting that the changes in density are actually very visually similar to those in in ks constant. The higher the density, the lower the cloth hangs, and the thinner it gets towards it's bottom. It falls similarly between the 15 and 1500 density, the only thing that changes is how it visually looks at the resting position of the hanging cloth, as seen above.

Changing the damping parameter

The following images were all done with density at 100, steps per frame at 15 and the rest of the configurations at default settings.

damping at 0.862069
damping at 0.022989

The change in the density parameter has the most interesting effect, in my opinion. As seen above, the lower the density value is, the more loose and bendy the cloth is. When I set damping at a very low value the cloth almost looks like liquid, where as when the value is high, it is very rigid, and falls slowly and stiffly. These effects make sense since the damping effects how much the spring "bounces", or how much energy was lost due to friction, heat loss, or other factors. Therefore, the less friction effecting the energy lost, the more fluid looking the cloth becomes.

Part 3: Handling collisions with other objects

ks 500
ks 5000
ks 50000

The ks constant is the springs restoring force. The lower this constant is, the less stiff the spring is, which translates into a thinner, more sleek looking cloth. It seems more malleable, almost even liquid. When the ks constant is raised, then the cloth becomes more rigid cloth. The higher the constant, the higher the restoring force is, meaning that the cloth molds less to the object it falls on, maintaining more of its shape.

And here are some images displaying how my cloth interacts with a plane:

Part 4: Handling self-collisions

Although I implemented collisions in the previous task, collisions with itself had not been handled yet. For this task I accomplished exactly this, self-collisions, by checking if point masses were at a certain threshold distance from each other, and pushing one of the masses a min threshold away. I made use of spacial hashing to increase efficiency. The following 4 images demonstrate a cloth reacting to collisions with itself:

For the following images I modified the damping parameter and observed the changes it made to the cloth self-collision simulation.

density at 1
density at 15
density at 150
density at 1500

As seen above the higher the density constraint, the less the cloth folds out and the more it stays in place. The high density simulation seems to just pile on top of each other over a very thin area of space. I enjoy the lower density simulation the most because it looks the most realistic.

Next I have 4 more images demonstrating how the cloth interacts with itself once we increase the ks constant:

ks at 50
ks at 150
ks at 5000
ks at 50000

The higher the ks constant is, the more stiff the cloth is therefore bending in less locations. As you can see in the lower ks simulation, the cloth folds in way more places and looks thinner. As we increase this constant, the cloth embodies more shape and restorative force which causes it to fold nicely on top of itself.