Spring-Mass Cloth Simulation
Goals:
1.Create spring mass cloth and investigate its behavior.
2.Explore the simulation speed.
3.Explore the simulation stability.
4.Explore the cloth appearance.
1.Create spring mass cloth and investigate its behavior.
2.Explore the simulation speed.
3.Explore the simulation stability.
4.Explore the cloth appearance.
Implementation:
I set the cloth size as 15 X 15, then tried different numbers of the timestep. Finally I figured out that the largest number without crashing the program should be 0.001. Anything smaller than that could work, but larger than that couldn’t.
For the stability, I read through Andrew Withkin’s slides, and learned that the Euler’s method is not stable.
I added red and yellow color blocks and made it looks like a cloth. Multi instance of the cloth looks similar because they are in the same environment and they follow the same physical rule.
I set the cloth size as 15 X 15, then tried different numbers of the timestep. Finally I figured out that the largest number without crashing the program should be 0.001. Anything smaller than that could work, but larger than that couldn’t.
For the stability, I read through Andrew Withkin’s slides, and learned that the Euler’s method is not stable.
I added red and yellow color blocks and made it looks like a cloth. Multi instance of the cloth looks similar because they are in the same environment and they follow the same physical rule.
Results:
Experiment with different integrators
Goals:
1.Create a simulation environment for testing.
2.Implement three different integrators.
3.Compare the simulation speed, stability and accuracy.
1.Create a simulation environment for testing.
2.Implement three different integrators.
3.Compare the simulation speed, stability and accuracy.
Implementation:
I implemented: RK4, Semi-implicit Euler and verlet methods. Then I added flag texture as well as wind environment to the RK4 model.
For the comparison of speed, I set same perimeter and tested with different algorithms, and found out the result:
I implemented: RK4, Semi-implicit Euler and verlet methods. Then I added flag texture as well as wind environment to the RK4 model.
For the comparison of speed, I set same perimeter and tested with different algorithms, and found out the result:
For the stability and accuracy, I did some researches, and learned from the article Stability Analysis for Systems of Differential Equations. The author did pendulum experiments and found out that: “For Euler’s method, no imaginary axis points are inside the gray circle except zero (in which case h = 0), so this method is always unstable no matter how you choose your step size. For the implicit Euler’s method, any choice of h leads to ±hı being in the gray region. The method is stable, but unfortunately not very accurate. For the Runge–Kutta method, the figure does not clearly show it, but the boundary of the gray region on the right is slightly to the right of the imaginary axis except at the origin which is on the boundary. ”
The author made a form which clearly shows the stability of different algorithm.
The author made a form which clearly shows the stability of different algorithm.
The column “difference” is keep becoming bigger of the explicit Euler, and becoming smaller of the implicit Euler. The RK is the most stable one because it only changed a little bit during the time.
Results:
RK4 with texture
and wind
and wind