Assignment 3: Cloth
Due Date: April 9
Grade Value: 15%
In this assignment, you'll implement
a cloth simulator and use it to suit up a moving human figure. Cloth is
modeled using a spring mass damper system, with springs and dampers for
stretch, shear and bend. The human figure is represented using a
hierarchy of cylinders, one for each link of the body. The motion of the
cylinders is obtained from optical motion capture (ASF and AMC format).
We provide code to display and animate the human figure, and a basic particle
system. Our particle data structure allows you to store a system of particles
in 3D and add a spring between any two points. Our starter code shows you
how to add a stretch spring between two points using this data structure,
you'll have to implement shear and bend using this framework. We
provide code to incorporate gravity forces on the particles, you'll have
to implement forces due to spring forces, namely:
In addition, you'll have to handle collisions
between the cloth and the human figure. For this, you'll have to first
detect collisions between a particle and a cylinder, and then perform collision
response using penalty functions. Our starter code gives you structures
for positioning, displaying and animating cylinders from AMC files.
We also give you functions to constrain (attach) a rectangular piece of
cloth to the hands of a walking "cylinder man".
Stretch spring and damping forces
Shear spring and damping forces
Bend spring and damping forces
Starter Code and
to starter code>
You'll be writing various functions
within the following two classes: CCloth and CPhysEnv.
CCloth implements a cloth
simulation system and has functions for creating and displaying the cloth.
It has the function CreateClothPatch that creates an array
of particles (stored in the structure t_Visual) arranged in either
rectangular pattern or a skirt pattern. You'll have to modify this function
to add springs between the array of particles. The function RunSim
initializes and starts the particle simulator. This class also has functions
for loading, displaying and setting the collision cylinders from the AMC
the guts of the spring mass damper system. It has structures for springs,
particles, collision cylinders, integrators, etc. You'll have to
write the function ComputeForces that will compute all the forces
acting on the particle system. The starter code shows you how to implement
gravity forces, you'll have to implement all the other forces acting on
the particle system (springs, dampers). Our starter code implements constraint
forces (to attach a piece of cloth to the moving cylinders). You have to
write functions to detect and resolve collisions between the cylindrical
objects and the particle system. Fill up the necessary sections of the
functions: DistPointCylinder, CheckforCollisions, ResolveCollisions
and ResolvePenetrations. We recommend using penalty-based methods to
handle penetrations (by using a stiff spring). Finally, you should write
the function Simulate that steps the simulation forward in time
by integrating the particle system that you create using your choice of
integrator (we provide you with Euler, midpoint and RK-4). This function
sums up all the forces on the particles (including ones due to collision)
and integrates forward by one step.
Note: We have provided the function arguments with some functions (that
you are supposed to fill) and not with others. Please feel free to modify
them according to your style and convenience.
Steps: First Load the actor (ASF file) , then load the motion
(AMC file), load Cloth and then press the Simulate button. If everything
works, the rectangular piece of cloth (white stuff next to the cylinder
man) should swing around and should be attached to the hands of the cylinder
man. As the human moves around (when you press the play button), the cloth
should collide against the cylinders of the legs and should move in a physically
correct way. We provide you here
with an executable from our implementation, with all forces and collisions
implemented (look for the executable clothSimFinal in the src directory).
This should run on the cluster machines. Make sure that you set the PATH
and LD_LIBRARY_PATH variables correctly (as explained in first asst) .Your
result should look our implementation when you are done with this assignment.
Extra Credit (Maximum of 10 points):
Create a directory asst3 under your
login name. Create three subdirectories: src, report and movies
Submit your code in the src directory.
You should also submit printouts of the following functions in separate
pages (with your report):
ComputeForces, DispPointCylinder, CheckforCollisions
Write a report addressing the following
points. Submit an electronic copy in the report subdirectory and a printout
in the drop box outside the graphics lab (NSH 4228).
Discuss the effect of the spring/damping
parameters on the behaviour (or properties) of the cloth. In particular,
generate parameters that result in three different types of cloth
(e.g., leather, silk and knit).
Discuss the collision detection system
that you implemented (in about a paragraph). What are its flaws? How can
you improve the collision detection system?
What kind of clothing can you model
with the particle system that you have implemented? (eg, skirt, jeans,
etc.?) Why? What kinds can you not model with this?
How would you add friction to this model?
Can you model air drag?
In the movies subdirectory, submit the
Result of your implementation of the
cloth interacting with the cylinder man in the walk_turn.AMC sequence.
This should do all that our executable currently does, namely: stretch,
shear and bend forces, collision detection and response with static and
moving human figure.
Constrain the same piece of cloth on
the shoulders of the character, so that it now looks like a cape. Submit
a movie for the cape interacting with the cylinders in the walk_turn.AMC
sequence. Look at the function updateSuspensionPoints in CCloth
to see how we constrain the cloth to the hands.
We have provided a sampler function
to create a skirt in the CreateClothPatch function. Attach this
skirt to the character and simulate its motion for the same AMC sequence.
Submit a movie with this sequence.
Note that the skirt implementation provided
to you is not complete, it is not seamed at the edges. If time permits,
create a closed skirt by seaming this edge using springs (for extra
Implement texture mapping on the cloth
system. Apply an interesting texture, and change the current lighting settings
to create interesting looking animations.
Implement friction, air drag, self collisions
or any other interesting aerodynamic effects (like wind, etc.).
Other interesting animations with multiple
pieces of cloth. Be creative!
Last Updated: 03-11-02