In this case, we will see a piece of cloth falling down and colliding with a ball.
This task is based on Unity.
We can use a simple mass-spring system to represent the cloth. Specifically, the cloth is presented as a structured triangular mesh.
We can choose to use implicit integral or position based dynamics to achieve the effects.
At the beginning, we set up the initial position X of the first iteration and the other one of the initial state by explicit integral.
After that, calculate the gradient such as the internal spring forces and the external gravities for every vertices.
Third, we consider the Hessian as a simple diagonal matrix to update the postion. We compute the gradient and updated all the vertices with Hessian in every iterations.
After several iterations, we update the velocity.
We choose to use Jacobi solver.
First, we update the positions and velocities by explicit integral.
After that, we calculate the sum of position of its neighboring vertices for each endpoint and count the number of neighbors
After several iteration of the previous step, we update positions and velocities.
Simple SDF collision detection between ball and cloth and impulse method to response it.
User can drag the ball by mouse to simulate the effects of collision.
Implicit Integral
2022-12-27.20.46.00.mov
Comparison of PBD results for different iterations