CS 184: Computer Graphics and Imaging, Spring 2017

Project 4: Cloth Simulator

Jordan Knox, CS184



Overview

This is the cloth simulator project. In this project I implemented a visual representation of cloth materials and how they interact with themselves and objects around them. Through the GUI in this project, the user is able to change many attributes of the cloth including the density of the material and the shading of the material. This project was really cool because I got to build not only the graphical representation of the cloth, but the physical attributes that would go along with it.

Part I: Masses and springs


The basic cloth wireframe
the basic cloth wireframe zoomed in
Cloth wireframe without any constraints
Cloth wireframe with only the shearing constraint
Cloth wireframe with all of the constraints

Part II: Simulation via numerical integration

Plain image of the pinned cloth at two points. None of the parameters have been changed


Low ks. As you can see, the cloth appears to be much more strechy than the default.
High ks. As you can see, the high ks causes the cloth to be much stiffer and less strechy than the default.
Low density. As you can see, the low density calsed the cloth to not be pulled down as much as with the normal density.
High density. The high density makes the fabric pull down harder on the points that it is pinned to.
Low damping. The low damping made the fabric sway and move back and forth very little.
High damping. The high damping made the fabric swayand move a lot more than the regular damping.
Shaded cloth from the pinned4 scene in its final resting state
cloth wireframe from the pinned4 scene in its final resting state

Part III: Handling collisions with other objects

Cloth draped on a sphere with the default ks of 5000, we'll say this is normal behavior for comparisons-sake.
Cloth draped on a sphere with a high ks of 50000. Notice that the cloth is much stiffer and does not bend as much to reflect the surface of the sphere it is draped upon.
Cloth draped on a sphere with a low ks of 500. Now as you can see, the lower ks makes the cloth bend much more to cover the surface of the sphere under it.
A black cloth wireframe lying peacefully on the plane

Part IV: Handling self-collisions





The cloth before it starts to fall
The cloth in the beginning of falling
The cloth as it first starts to flop over onto itself
The cloth once all of it has reached the bottom
The cloth folding over itself as it comes to rest
Another angle of the fallen cloth that highlights the folding of the cloth over onto itself
Low density. The lower density leaves the cloth to be much more wavy and lesssmoothly spread out across the surface it rests on
High density. The higher density makes the cloth much more affected by gravity, and it pulls each fold of the cloth tighter to the surface it lays on
Low ks. The low ks makes the cloth appear much more floppy and wavy as it folds onto itself. It bends more and has more creases.
High ks. The high ks makes the cloth bend less onto itself and spread out more instead of bunching up on to of itself.

Part V: Shaders

A shader program is a program that executes sections of the graphic pipeline. They take in an input and output a single 4 dimensional vector. Vertex and fragment shaders work together to produce lighting and material effects. First the vertex shader apply transforms to vertices and change their geometric properties. The vertex shader's output then gets used as the input of the fragment shader which take in the geometric attributes of the fragment and compute the color of the fragment.

The Blinn-Phong shading model is a shading model in which values between vertices are interpolated by Gouraud shading by default, rather than Phong shading.





Here is an example of the Blinn-Phong shader outputting only the ambient component.
Here is an example of the Blinn-Phong shader outputting only the diffuse component.
Here is an example of the Blinn-Phong shader outputting only the specular component.
Here is an example of the Blinn-Phong shader outputting all of the components.
Here is the texture of Mickey Mouse mapped onto the cloth draped on the sphere (his background is white, so you cant see the folds in the cloth very well)
Here is bump shading on a cloth
Here is bump shading on a cloth draped over a sphere
Here is bump shading of just a sphere
Here is displacement shading on a sphere

As you can see, the bump mapping changed the appearance of the lighting on the surphace of the sphere, but the sphere maintained its perfect spherical shape. But on the displacement makes the render actually look slightly non spherical and deformed to match the texture on it.

Here is a mirror shader on a cloth draped over a sphere
Here is a mirror shader on a sphere