Animation: 3D Cloth Collision Simulation

Hey everyone! 🎓

This part of our computer graphics animation assignment is all about simulating a square piece of cloth colliding with an object. We'll be using a mass-spring cloth model for this.

Cloth Initialization 🎽

Our cloth is made up of particles connected by springs. Each particle has a mass, position, and velocity. We'll use Newton's second law to update the positions of the particles.

Springs 🪢

There are three types of springs connecting the particles: structural, shear, and flexion. Each type has a different stiffness. We'll make GUI sliders for each stiffness and see how they affect the cloth.

Forces 🚀

Now let's add some forces to our cloth!

  1. Spring forces: We'll calculate the spring force acting on a particle based on the positions, stiffness, and rest length of the spring.

  2. Gravity: The gravity acting on each particle is simply a downward force proportional to the mass.

  3. Damping: We'll add two types of damping (spring and viscous) so that our simulation converges.

After implementing these forces and time stepping, our cloth should react to gravity and springs, like this.

Collision with a Sphere âš½

Finally, we'll introduce a sphere to collide with our cloth. During the integration, we'll check if a particle is inside the sphere. If the particle's velocity is going into the sphere, we'll project it onto the tangent plane of the sphere. If it's moving away from the sphere, we'll leave it as is.

That's it! We created a cloth simulation that collides with a sphere, making it look super realistic. 🎉

Previous
Previous

Animation: 2D Deformation Simulation

Next
Next

Animation: Fluid Particle Simulation