4.4. PUTTING IT ALL TOGETHER 27
stable simulations. Adding too much damping will make the cloth seem to behave as if it were
underwater.
4.4 PUTTING IT ALL TOGETHER
Lets say we start at time t
n
. At each step we want to advance our time by a step h. In order to do
so we need to compute our update in positions x and velocities v. Following the discretized
Newtons law of motion given in Equation (3.5), we come up with the following system:
x D hv
n
v D h
M
1
f.x
n
; v
n
/
(4.8)
with x D x
nC1
x
n
and v D v
nC1
v
n
. For every particle in the system, we can compute
all the internal and external forces that are acting upon it and accumulate this in a single force
vector. e internal forces are computed as the negative energy gradient and the external forces
are added to these internal forces. is will allow us to find the velocity update v. Given x
and v, the next state can trivially be found as
x
nC1
D x
n
C x
v
nC1
D v
n
C v:
(4.9)
Phew! Now that we finished all of that, we finally have a working cloth simulator, con-
gratulations! Now is a good time to pat yourself on the back. You might notice however that
the results arent always as great as you hoped. Particularly, the solution might explode (not in
an awesome special-effects-kind-of-way). e true solution will deviate dramatically from the
computed solution unless you take very small time steps. e approximation visualized in Fig-
ure 3.1 can be pretty crude. Small discretization errors accumulate and the approximation quickly
becomes worse and worse.
4.5 TEARABLE CLOTH
Beyond the Basics
At the beginning of our exposition, we talked about how springs model the internal elastic forces
of the cloth. e more the springs are extended, the stronger the resulting force will be. Can we
keep stretching the cloth indefinitely? Probably not, right?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset