Project 4: Cloth Simulator

Overview

We tried to make a realistic looking cloth based on mass and springs system using different kind of springs of different constraints. Part 2 was about applying motion to each of the point masses depending on the external forces like gravity and the spring forces. Cloth can also collide with other objects so we handled collision with two types of objects - sphere and plane using intersection methods that we learned for spheres and planes. Last part was applying self collision when the cloth collides with itself. We have to map each of the positions into a hashmap and see which point masses are close enough ("collide") to fix the distance in between and make sure that cloth doesn't just clip though.

Part I: Masses and springs

shearing is the diagonal X and the other ones are the grid-like ones although bending is overlapping with structural and that's why there are dotted looking lines in the last image because of these overlaps.

cloth with All constraints on
cloth only with shearing constraint on
cloth without just shearing constraint
pinned 4 zoomed in to show the structure of point masses and springs
pinned 4 zoomed in some more to show the structure of point masses and springs

Part II: Simulation via numerical integration

By changing ks into a higher value, you can see that the displacement that each point mass has is lessened - which results in a very smooth cloth as the final state. For a lower value, all the point masses fluctuates a lot and the final state as you can see below is very stretched. Compared to the default value (5000), lower value (which I chose to be 10N/m) is much stretched while a higher value is not. You can barely see the pinned effect (diagonal line) as you go up in ks.

By changing density higher, (1000) there is much more fluctuation. Especially for the middle portion, it fluctuates a lot until it comes to a stop since it is there is so much mass in a limited space. But for lower density (1), there is very little fluctuation - and results in a very un-stretched cloth unlike higher density with stretched cloth.

For damping, if it is lower, much more fluctuation that lasts longer - I don't think it ever stops for a long time - very visible. As you go higher, it stops fluctuating much faster.

Pinned4.json with default params
Pinned4.json with default params (shaded)
pinned4 with high density (1000)
pinned4 with low density (1)
pinned4 with high ks (10000)
pinned4 with low ks (10)
pinned4 with high damping (1.0000%)
pinned4 with low damping (0.000%)

Part III: Handling collisions with other objects

As you can see as you increase the ks, the cloth folds less especially there is much more force given between point masses for each of the spring.

collision with sphere (ks = 500)
collision with sphere (ks = 5000)
collision with sphere (ks = 50000)
collision with plane (with default params)

Part IV: Handling self-collisions

High density causes the cloth to be really wrinkled while low density is much more smooth and folds nicely. ks also has similar effects except that low ks causes the wrinkles and high ks results in nicely folded and pretty well smoothened cloth.

right after it starts colliding with itself
in the process of folding 1(self colliding)
in the process of folding 2 (self colliding)
at the almost done restful state (self-colliding)
final state of selfcollision (density = 1000)
final state of selfcollision (density = 1)
final state of selfcollision (ks = 10000)
final state of selfcollision (ks = 10)