Professional Documents
Culture Documents
Lama Imam
Abstract The growing availability of parallel com- From simple geometric approximations to compli-
puting architectures has prompted research into the cated physical systems, these techniques are used[1].
best algorithms and approaches for maximising par- The complexity of the cloth simulation, as well as
allelism. The GPU has evolved as a parallel process- the time constraints imposed on processing it, is dic-
ing device in addition to the parallelism offered in the tated by whether it will be used as part of an in-
CPU. The purpose of this research was to construct teractive system or as part of a pre-rendered anima-
a hybrid parallel CPU/GPU cloth simulation appli- tion. Pre-rendered animations, such as those used in
cation to investigate the joint utilisation of CPU and Films, are subjected to significantly fewer time con-
GPU parallelism. To test the merits of the hybrid ap- straints than interactive systems, like video games.
proach, the application was first designed in sequen- The amount of time it takes to make a pre-rendered
tial CPU form, then in parallel CPU form.The appli- animation is immaterial to the animation’s viewer, as
cation uses a position-based dynamic approach, ac- they have no idea how long it took to develop the se-
cumulating internal and external forces before com- quence. The length of time it takes to develop a se-
puting accelerations using Newton’s second law of quence is only important to the animation’s producer
motion. The velocities and, eventually, the locations if it has an impact on the final animation’s cost.The
of the object are updated using a time integration interactive scenario is quite unique. The animation’s
method. Only a few simulation approaches (most speed affects the user’s experience. The ideal anima-
rigid body simulators) use impulse-based dynamics tion rate for an interactive system is 30 frames per sec-
to manipulate velocities directly. ond (frames per second). Animated objects move in a
In this project we introduce an OpenGL based cloth fragmented manner if the frame rate is too low, miss-
simulation code base, in which we implemented a ing the fluidity of natural motion. In the pre-rendered
GPU version of the already existing CPU version of world, minutes and even hours are acceptable times
the Position Based Dynamic cloth simulation algo- for the production of a single frame. This, however,
rithm. We produced this simulation with high res- is not acceptable when it comes to producing anima-
olution on the GPU and have plotted the significant tions with multiple frames per second.
difference in runtimes for both approaches. We used Interactive systems research is motivated by a desire
the opencloth repository on github to access source to push simulation complexity to greater levels while
code, where we made use of the libraries existing in retaining interactive frame rates. Such systems have
the repository to implement a GPU version of the Po- extraordinarily high performance requirements, and
sition Based Dynamic cloth simulation approach. implementing them remains a key issue for cloth sim-
The findings of this work could lead to future re- ulation researchers. The approaches utilised in this
search into using GPUs to execute time integration study are more suited to pre-rendered animation.
methods connected with updating velocities in the
position based dynamics algorithm in more sophisti- Cloth simulation computing hardware There are
cated cloth simulation settings. three steps to cloth simulation. The cloth abstraction
model is implemented in the first stage. This step
is largely concerned with the model’s data types and
populating those data types with the simulation’s ini-
Introduction Cloth simulations can now be found tial conditions. The numerical solver is implemented
in a wide range of settings. The existence of vir- in stage two, which will calculate the placements of
tual clothing and cloth elements links a wide range the simulation’s components by solving equations of
of visual output, from Blockbuster films to garment motion within the application. Collision detection
prototype tools. Researchers have been working on and reaction are implemented in stage three. The
algorithms and methods to display cloth elements mechanism through which the simulation identifies
convincingly using computers for over 20 years. whether more than one element of the simulation is
occupying the same point in space is called collision monly employed in interactive computer animation
detection. The simulation’s collision response is how and simulation applications because they produce
it handles identified collisions. Parallelism can be faster results than direct approaches, despite the fact
used at each of these levels[1]. that the resulting solutions have a higher residual er-
ror. For touch response, they’ve been used by mul-
Problem Statement To keep improving cloth simula- tiple researchers such as Bridson[5] in their paper
tion performance, hardware architectures must make ‘Robust Treatment of Collisions, Contact and Fric-
use of parallelism. Greater rates of parallelism will tion for Cloth Animation’, Harada[6] in ‘“A Parallel
be responsible for future hardware performance ad- Constraint Solver for a Rigid Body Simulation’ and
vancements. Not only should cloth simulation algo- Tonge[7] in ‘Mass Splitting for Jitter-free Parallel Rigid
rithms be built to make use of today’s parallelism, but Body Simulation’. More recently, Macklin in his re-
they should also be able to scale to tomorrow’s par- search proposed a unified architecture for rigid bod-
allelism. Researchers will continue to investigate the ies, soft bodies, and fluids, in which animated entities
extent to which cloth simulation techniques can ac- are voxelized using constant sized spheres and con-
complish this. The question that arises is, how can straints are addressed using a Jacobi-like solver [8].
cloth simulation and generation performance be im- To get an understanding of the math behind the po-
proved for future technological advancements. This sition based dynamic algorithm as well as implement
study focuses on the implementation of the position a GPU version of the pre-existing CPU solution using
based dynamic algorithm using a GPU for faster cloth graph colouring approach, we referred to the study by
generation, and proposes a potential solution that can Marco Fratarcangeli[9]
be built upon by researchers to fine grain cloth sim-
ulation in a multitude of applications such as video Methodology
games.
Position Based Dynamics Position Based Dynamics
Purpose of our Project The purpose of this research
(PBD) is a method for interactively animating de-
is to see if a cloth simulation approach that uses both
formable objects based on Verlet integration[10]. The
CPU and GPU parallelism may deliver higher perfor-
objects are represented as a collection of n particles
mance than a similar algorithm that uses serial and
whose movement is controlled by m nonlinear con-
parallel CPU implementations.
straints. By directly updating the particle placements,
Hypothesis In theory, serial implementation will give the system of equations is solved using Gauss–Seidel
us the worst runtimes and give us the least efficient iterations. Internal forces are avoided in PBD, and the
solution. Introducing parallelism will obviously in- locations are updated in such a way that the angu-
crease our systems performance. When it comes to lar and linear momentums are conserved implicitly.
CPU parallelism vs GPU parallelism, we hypothesise [9] As a result, the entire process is unaffected by
that the GPU implementation will yield better results the instabilities associated with interactive, physically
because of the availability of shared memory space based approaches. Nonlinear equality and inequal-
and due to its parallel processing architecture, with ity equations make up the set of constraints, as fol-
which it can run various calculations over multiple lows[9]:
data streams at the same time.
Ci (p) ≥ 0|Ci (p) = 0 where i = 1, ... , m
Literature Review Müller, in his paper describes
a hierarchical, position-based technique for cloth above, p is the vector of particle positions, n is the
simulation by accelerating the solver’s convergence number of particles, and m is the number of con-
speed[2]. Bender and Bayer used a red-black par- straints. The constraints are mostly nonlinear, and
allel Gauss–Seidel schema for animating inextensible they’re solved in order using Gauss–Seidel iterations.
cloth with a force-based approach in their research[3]. To get the correction ∆p, each equation is linearized
This approach is limited to meshes with a regular grid individually in the vicinity of C around the current
structure, despite its high performance. The mesh is configuration p. This is represented by the following
separated into constraint strips. Strips with no com- equation[9]:
mon particles are independent of one another and can
be solved simultaneously. Fratarcangeli [4] in their Ci (p + ∆p) ≈ Ci (p) + ∇pCi (p) · (p) = 0
paper, describes a comparable strategy that relies on a
Jacobi-like solver. All of these solvers work well with ∇pCi (p) is a vector that contains the derivatives of
grid-like meshes (cloths), but they lack the general- the equation Ci with respect to the n components of
ity required for simulation of elements varying struc- p. p is imposed to be in the direction of ∇pC(p) such
tures. that:
Jacobi and Gauss–Seidel iterative solvers are com-
∆ p = λi·∇p · Ci (p) The correction for each particle in the tetrahedron is: