# CS 184: Computer Graphics and Imaging, Spring 2018Project 4: Cloth Simulator

## Zhuo Lu (Seth), cs184-aea

### Part 1: Masses and Springs

Below is a screenshot of scene/pinned2.json with structural, shearing and bending constraints displayed.

Below is a breakdown of each type of constraints; each row has, for one type, what the wireframe looks like with and without it.

### Part 2: Simulation via Numerical Integration

There are several variables in the simulation that we can change. The spring constant $k_s$ changes the stiffness of the material. A cloth with a higher spring constant may not be as stretchy as one with a lower spring constant.

To show the effects from varying the spring constant, below is a series of screenshots of the final resting state of different parameters.

Varying the density of the material gives changes to how the cloth stretches under a gravitational pull. As the weight grows heavier, we can observe that the cloth stretches downwards more.

While not introducing much difference to the final resting state, varying damping affects the animation curve of how the cloth arrives on it. A lower damping gives more swinginess of the cloth.

To show how swingy the animation may look like with little damping, below are screenshots made at $damping = 0.05$. Note that there is a lot of oscillations even at the surface level.

Below is a screenshot of the shaded cloth from scene/pinned4.json in its final resting state with the default parameters.

### Part 3: Handling Collisions with Other Objects

Below is a series of screenshots of the shaded cloth interacting with a sphere at its final resting state.

We can see that as $ks$ increases, there are less folds on the cloth and more stiffness to the material. A smaller $ks$ leads to more stretchiness; at $k_s = 500$, the cloth wraps around the sphere better and we can see the shape of the covered geometry better.

The cloth can also interact with a plane while simulating. Below is a screenshot of it at its final resting state.

### Part 4: Handling Self-Collisions

With self-collision on the cloth, we observe that it folds on itself as it falls under gravity. Below is a series of screenshots showing how the cloth animates under the default parameters $\rho = 15, k_s = 5000$.

As we vary the density of the material, we can observe differences of how much the cloth folds onto itself, since the gravitational force of each point mass can play a greater or a smaller part to the internal force constraints due to Hooke's Law. Below is a series of screenshots when we increase its density to $\rho = 150$ while keeping the same $k_s = 5000$. We can see the resting state being more flatten than the reference.

We can also vary its spring constant. With a greater spring constant, we can observe more stiffness in the material. Below is a series of screenshots of the cloth with its spring constant $k_s = 50000$, density staying at $\rho = 15$ as in the reference.

### Part 5: Additional Features!

I also experimented with a spatially varying force that acts as some wind in the simulation. Below are some screenshots of the result produced, where wind is applied at various spatial regions.