Cloth Sim

Project Details

In this project, we are focused on running physical simulations. First we built out the data structures to support our simulations, and then focused on making movement possible. Rather than using numerical integration, we performed approximation in order to make our method more efficient. We handled collisions between objects appropriately by applying a correction vertex to a vector if its distance from an object is too short (below a specified threshold distance). We only moved certain loose vertices through this approach, and then finalized our assignment by implementing shader functions that use OpenGL in order to process vertex positions and color.

Simulation via numerical integration

With a low ks, the cloth falls lower than it would in comparison to a cloth with a high ks. I first set ks to 10 N/M and then to 1000 N/M. There was a very noticeable difference in the two. There’s also less of a bounce as ks increases. For higher densities, I noticed that the cloth sags a little more and falls lower than it would in comparison to a cloth with low density. When I set damping to a low value, I noticed that the cloth continued to ripple for a long time even after falling. At a high damping value, the cloth falls very slowly and it doesn’t continue to move even after falling. If you look in the picture, you can see the ripples right after the cloth falls.

Handling collisions with other objects

We can see that for ks = 500, the cloth falls lower in comparison to ks = 5000 and ks = 50000. When ks = 50000, we can see that the sides of the cloth are floating slightly as opposed to falling down.

Handling self-collisions

For lower densities, we can see that the cloth lies relatively flat after it falls onto the plane. For higher densities, the cloth has more ripples within itself after falling on the plane. For lower ks values, we see that the cloth is springier and has more ripples as opposed to higher ks values which lay flat after colliding.

Shaders

Shaders are able to run in parallel and work on different parts of the graphics pipeline. They usually take in an input and output a four dimensional vector. A shader program is made up of a vertex shader and a fragment shader. The input of the fragment shader is the output of the vertex shader. Vertex shaders are responsible for the positioning of different vertices. The fragment shader takes in a fragment and uses the attributes of the fragment to output a color. The Blinn-Phong shading model uses three components, ambient, diffuse, and specular lighting, to capture illumination and to describe how a surface captures light. For bump and displacement mapping, I used texture_3.png. I think I wasn't able to generate my displacement mapping correctly. This could be due to my calculations in bump mapping or I didn't set the parameters correctly.