Cloth Cutting Simulator
by Cody Thompson
Description
A cloth simulator that the user is able to cut and simulate wind physics on (written in C++ / GLUT / OpenGL using the Eigen library)
using large particle and spring systems to simulate the cloth.
Features
- Mouse rays to cut the cloth.
- Controls to manipulate the cloth with wind.
- A switch to move between 'weak' and 'strong' wind.
- An orthographic camera to view the cloth and have sharper mouse cutting.
- Sparse matrices to allow for larger particle systems.
User Controls:
- MouseClickDown : start the cut ray
- MouseClickUp : end the cut ray
- 't' : get rid of wind physics
- 'y' : simulate wind going to the left
- 'u' : simulate wind going up
- 'i' : simulate wind going to the right
- 'o' : simulate wind going down
- 'w' : make the wind weaker
- 's' : make the wind stronger
- 'r' : returns the cloth to its initial position, but does not reset the cuts
Notes:
- The cut ray is not made until the mouse is unpressed.
- The cut ray is always linear.
- The cut ray is not infinite, it goes from the mouse start to mouse end.
- By default, there is no wind and wind is in the 'weak' mode.
- The cloth spring system uses sparse matrices and as such can run smoothly on my computer with a 65 x 65 particle system.
- If the simulation does not run smoothly, you can go into Scene.cpp file and change the row and col values to be less.
- There is no collision detection with the cloth onto anything, including other pieces of cloth.
Pictures
These pictures are all of an 80x80 cloth system.
The basic cloth model with no wind.
Basic Cloth Cutting
Small Ray Cutting
Wind physics
Sources
- Shinjiro Sueda - Created most of the back end code for the main cloth system, and he provided information on cutting spring systems and adding simple wind physics.
Bugs / Unfinished Areas of this Project
- I attempted to add collision detection with a set ground level, but it did not work out well and so I could not include it.
- There is a bug where a spring pushes a particle into another particle it has a spring with and crashes the system.
- Currently restarting (pressing 'r') fixes the above for a little bit, but does not reset the cloth triangles or springs.