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.
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 Springs
No Shearing
Only Shearing
Modifications to Gravity (m/s²)
Less Gravity (-5)
Normal Gravity (-9.8)
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 (2500)
Normal ks (5000)
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 (5)
Normal Density (15)
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 (0.1%)
Normal Damping (0.2%)
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 (Normal Paramenters)
Shaded 4 Pin Cloth (Normal Paramenters)
Sphere Collision (50000ks)
Sphere Collision (5000ks)
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