CS 184: Computer Graphics and Imaging, Spring 2019

Project 4: Cloth Simulator

Bryan Tong, btong@berkeley.edu


For this project, I created a cloth simulator featuring real-time simulation and collisions. I used spring models, mass models, concepts of bending constraints, varying collisions systems, and lots of self-collision and deformation constraints. I learned a lot about struggling to understand these kinematic-style problems, e.g. external forces and spring correction forces. Hooke's Law, Provot 1995, and Verlet integration were all interesting concepts to apply and see visual results to! Overall, this project has involved the most physics I've used since high school.

Part 1: Masses and springs

To implement the mass and spring model as from lecture, I followed the spec to create constrained point-mass grids.

No shearing constraints
Only shearing constraints
All 3 constraints

Part 2: Simulation via numerical integration

After implementing the many mathematical requirements of part 2, we can finally test our cloth simulation. In the screenshots below, we can observe the effects of changing many various parameters of our cloth simulation regarding spring mechanics and forces.

  • ks appears to have effect on the elasticity of the cloth, which makes sense given it relates to the spring constant in our computations.
  • A low ks cloth seems to act less elastic and tightly stretched, creating more droopiness.
  • density seems to effect the gravitational impact, a low density sinks and declines less, resulting in a barely sinking, smoother structure, compared to our high density photo.
  • damping effects the boyancy of the springiness of our cloth simulation. Dropping the damping to less than half of default resulted in very tubulent physics as the cloth took a long time to settle and balance out.
  • Default parameters
    Density raised to 100, ks lowered to 1000 N/mp
    Damping reduced to 8%
    Density lowered to 2 g/cm^2

    Part 3: Handling collisions with other objects

    In this stage of the project, we got realistic collisions and cloth hanging physics implemented with a sphere and a plane.

    We can interestingly see how (as expected) a low ks results in a droopier cloth, i.e., less spring resistance. Conversely, a high ks results in a very stiff drape, representative of strong elasticity and spring forces. It interestingly still has some strong folds, although much fewer of them.

    Default ks of 5000 N/m
    A fasctinating cloth plane on a plane
    Decreased ks of 500 N/m
    Increased ks of 50000 N/m

    Part 4: Handling self-collisions

    How the cloth falls before self-collisions implemented
    How the cloth falls before self-collisions implemented, cont.
    Default with self-collisions implemented, early
    Default with self-collisions implemented, mid
    Default with self-collisions implemented, late
    Default with self-collisions implemented, rest state
    Decreased density to 2 g/cm^2
    Increased density to 200 g/cm^2
    Decreased ks to 500 N/m
    Increased ks to 50000 N/m

    Part 5: Shaders

    Diffuse Shader
    Texture Shader
    Blinn Phong Shader
    Bumpmapped Shader
    Mirror Shader
    Displacement Shader

    Extra credit: Additional cloth simulation features!

    I didn't have time to do EC, since I've been sick + had to go to the ER. :(

    Hence the day-late submission, which I have received an extension for.