100916

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

90 (IJCNS) International Journal of Computer and Network Security,

Vol. 2, No. 9, September 2010

Cloth Deformation Simulation Based on a


simplified mass-spring model
Yao yu-feng 1, Xia kai-jian 2 and Zhou jin-cheng 3
1
Changshu Institute of Technology ,Computer science and Engineering College,
Suzhou Jiangsu china,215500
fengsingal81@gmail.com
2
Changshu Institute of Technology ,Computer science and Engineering College,
Suzhou Jiangsu china,215500
xiakaijian@163.com
3
Department of Mathematics, Qiannan Normal College for Nationalities,
Duyun Guizhou 558000
guideaaa@126.com

kinds: shear spring, structural spring and bending spring[4]


Abstract: Simulating the motion of cloth is an important part
in virtual simulation. The computational costs are still high. in the mass – spring model. The mass – spring model is
Cloth deformation simulation is an important research topic in simplified to avoid the disadvantage of the complex
the Computer Graphics. This paper presents a physics-based algorithms and the high computation cost which is
simulation of cloth deformation model approach, using a generated in seeking the physical reality. In this paper the
simplified mass-spring model for the cloth-object. To cope with mass-spring model is simplified and use a simple and
requirements such as real-time and stability in cloth effective display Euler integration method to Simulate the
deformation, this paper makes the mass-spring model simple. swung states more realistic and more quickly. This method
The dynamic equation of the cloth-object model is worked out by greatly improves the calculation efficiency and is good at the
the Euler integration method. Experimental results show that stability and real-time, and is easy to implement.
the model creates realistic simulations good stability, easy to
implement.
2. Creating the Model
Keywords: Cloth deformation; mass-spring model; Euler
integration method; collision detection. The mass-spring model is composed of m × n mass
virtual network, the relationship between the masses is
1. Introduction mainly transmitted through the spring, each mass is
connected to the adjacent mass by the spring whose quality
The real time simulation of the cloth has been widely is zero. The spring is divided into three kinds: shear spring,
used in film、 television and network games currently. It structural spring and bending spring in the adjacent mass-
makes a lot of animators to work less from the heavy works. spring model. Shown in Figure 1. Figure 1a shows the basic
As a classic soft objects[1],Cloth shows thin shape, good mass-spring model, Figure 1b is the structural spring,
shape variability. The shape can be changed according to Figure 1c is the shear spring, and figure 1d is the bending
the shape of its attached surface. At the same time, it can be spring. We can simulate all kinds of cloth deformation by
swung and deformed by the external forces (such as wind). using these three springs.
How to simulate the cloth truly has been a hot area of
research. But currently available simulation methods have
many problems in solving real time and stability at the same
time. So this is the bottleneck to use this technology to
application.
Animation technology based on physical models has been
considered the attributes of the real world object, such as its
quality, inertia moment, spring, friction and so on, and (a)basic mass-spring model (b)structural spring
automatically generates the original object with dynamic
movement, generate the movement by using dynamic
theory.
Cloth-object Simulation model Based on the physical
method-mass-spring[2],[3] is used widely as its model is
easy to use and the algorithm is easy to implement. In this
(c) shear spring (d) bending spring
paper the cloth is based on the mass-spring model and
Figure 1. the mass-spring model and the three kinds of
regarded as the grid system which is composed by the
spring type
masses and the spring which connects between the masses.
In order to meet the cloth physical properties of the
nonlinear stress-strain. The spring is divided into three
(IJCNS) International Journal of Computer and Network Security, 91
Vol. 2, No. 9, September 2010

The mass-spring model is simplified in this paper, we In the dynamic simulation of the cloth, the damp force is
Pi, j+1 Pi+1, j Pi, j Pi +1, j+1 Ft
know that spring and are the shear necessary for maintaining the system stability, the di (the
spring in Figure 1a. It is proved by the experiment that two damp force of all masses j that are the neighboring masses
shear springs do not have much affection for the of the mass i at the cloth surface) expression is as follow:
performance of the system instead of one shear spring. n
Therefore we reduce one shear spring to simplify the model, Fdit = ∑ d ij (vi − v j )
figure 2 is the simplified mass-spring model. j =0
(2)
t
F is the damp force, d i , j is the coefficient of elasticity
di

of the spring between the mass i and its neighboring mass


vj
j, vi is the speed of the mass i, is the speed of the mass j,
t is the current time step.
3.2 external forces
Figure 2. the simplified mass-spring model
There are many kinds of external forces including the
forces of the gravity and the wind (the system only considers
3. Analysis of Model stressing the forces of the wind and the gravity, does not consider the
In the model, the cloth is described by using the impact of other external forces).
simplified mass-spring model, The model is consisted of a 1.The force of the gravity
number of virtual masses of the triangle mesh, each mass The force caused by the attraction of the Earth is called
connects to its adjacent mass. The movement of each mass the force of the gravity. The gravity at the same point on the
is determined by the sum of the external forces and internal earth is directly proportional to the quality of the object. The
forces. The internal forces are spring force and damp force Fgit
between the masses, the external forces are the force of gravity of the mass i on the cloth surface is:
gravity and wind. Mass should show the cell movement F = mi g
t
gi
(3)
which is represented by it. The movement effect of all t
masses represents the deformation shape of the entire cloth. F gi m
is the gravity of the mass i at the time t, i is the
The following is the analysis of the force of cloth. quality of the mass i, g is the acceleration of gravity, it is a
3.1 internal forces constant.
1.spring force 2.The force of the wind
In order to simulate cloth deformation, supposed that Aerodynamics and hydrodynamics [7]gives the flow of air
movement, The computational complexity of this type of
any two masses on the cloth surface are connected by spring,
applications is often prohibitively large. A flow of wind is
a mass can produce forces of the opposite direction and
designed to simplify the computation complexity and satisfy
same direction to its neighboring mass .The spring force is
the physical reality. The flow has a parallel direction, and
adopted to the Hooke's Law. supposed that there is a spring
ignores the changes when the wind collide the cloth. So the
connected the mass i and its neighboring mass. According
Ft Fwit is:
force of the wind
to Hooke’s Law, force si is directly proportional to the
length changes of the spring [5],[6]: Fwit = kw (vw − vi ) (4)
( x j − xi ) t
Fsit = ki , j (| x j − xi | −li0, j ) F wi is the force of the wind of the mass i.
kw is the
| x j − xi |
(1) vw is the speed of the
t coefficient of the force of the wind.
F si v
is the spring force between the mass i and its
wind. i is the speed of the mass i. In the actual scenario,
k some masses on the cloth surface are blocked, so there are
neighboring mass j, i , j is the coefficient of elasticity of
no wind effect on these masses.
the spring between the mass i and its neighboring mass j,
According to Newton's Second Law of Motion, the total
xi and x j is the location of the mass i and its neighboring Fi t is:
force of the mass i at the time t
l0 Fi t = F sit + Fdit + Fgit + Fwit
mass j, i , j is the initial length of spring, t is the current (5)
time step. The mass has forces which are the same direction
and opposite direction to its neighboring masses. So the
4. Explicit Euler integration method to solve
Fi t, j the dynamic equation
force of one mass is , then the force of its neighboring
−F t
i, j This section mainly uses explicit Euler integration
mass is .
method[8],[9] to solve the mass-spring model.
2、damp force
92 (IJCNS) International Journal of Computer and Network Security,
Vol. 2, No. 9, September 2010

Fi n Collision detection is simple by using this method, but


vin+1 = vin + ∆t ⋅ there are some problems, when the cloth grid is sparse, Even
mi (6) the mass is outside of the geometrical object, the infiltration
n +1 n +1 can occur. For solving this problem, the expansion avoiding
xi = x + ∆t ⋅ v
n
i i (7) method[10]is given, that is increasing a bounding layer in
This method needs to store two variables for each mass. the outer surface of the ball, which is to increase the radius
They are current speed and position. Through calculating of the sphere, this can be effective to avoid the
the time step ∆t ,new speed and position can be calculated infiltration phenomena.
by equation(6)and(7). This method is simple and When the collision detected, the system should respond
computing quickly and good at parallelism. But it needs the timely for realistic simulations. Equation (10) shows that the
time step ∆t small enough to guarantee the stability of the
Euler integration method does not solve the system
equations by using the speed variable, so the system
algorithm. The external forces (the force of the gravity and
calculates fast, and can remain stability.
the wind) are relatively small in the model, so this issue will
not affect the result of simulation.
Judging from the general system, the position of the 6. The simulation results
masses of the cloth is moving fast, so it would lead to
instability occurs such as collision reaction. To solve this 6.1 The work flow
problem, a simple method is proposed, that is modifying the The simulation for the cloth collision essentially is to
value of the speed after each time step: determine the coordinate’s information about the mass
x in − xin −1 position on the cloth at each time step. The position is
v =
n
mainly influenced by the external forces and internal forces.
∆t
i
(8) The work flow for the cloth deformation simulation is
Equation (8) shows that, the speed of the mass is shown in figure 3:
calculated by the position movement. So the position
movement can directly affect the speed at the next time step,
and this method can enhance the stability of the numerical
integration algorithms. Substitute equation (6) into equation
(7):
n +1 Fi n
xi = x + ∆t (v + ∆t ⋅
n
i
n
i )
mi (9)
Substitute (8) into (9):
Fi n
xin+1 = 2x in − xin−1 + ∆t 2
(10)
mi
The mass position can be calculated at any time step
according to equation (10).

5. Collision detection and treatment


In real time simulation, only consider the collision
between the cloth and the shape object, collision detection
can be implemented by calculating the distance between the
objects. In the experiment, calculate the distance to judge Figure 3. cloth simulation flow chart
whether the collisions occur between the cloth and 6.2 Experiments and Results
the geometrical object, or whether the infiltrations into the
We implement the simplified mass-spring model on PC
object occur.
In the following collision detection experiment, use Point which is P4 T2310 1.86G, 2GRAM, Inte182865G graphic
to Plane model to carry out the collision detection. In the cards, and based on the OpenGL graphics library, using the
experiment, given a rigid geometric sphere, the coordinate VC + + as a development environment. As the mass-spring
model is a simplified physical model which is discrete, the
of the mass is( x, y, z ),supposed the coordinate of the center
r simulation results can only be a degree of approximation.
( a, b, c) , n is the surface normal vector,
of the sphere is We have detected the collision that the cloth is draped.
d between The collision object is a red ball, simulate the masses of the
the radius of the sphere is r ,then the distance
cloth and draping cloth. The following figures show
the center of the sphere and the mass is:
experimental results by using different parameters. Figure
d = (x - a) 2 + ( y − b) 2 + ( z − c ) 2 4(a)is the result of the draping cloth, the red dots on the
(11)
cloth are the masses of the model. Figure 4(b)is the result
If d < r the infiltration would occur; when the collision occurs. Figure 4(c)and (d)are the
If d ≥ r the infiltration would not occur; result without masses.
(IJCNS) International Journal of Computer and Network Security, 93
Vol. 2, No. 9, September 2010

The Journal of Visualization and Computer


Animation.2001,12:1-12.
[9] Jin Bi-peng.Research on the computer real-time
animation[D].HeFei:University of Electronic Science
and Technology of China,2007.
[10] Wang Jian-chun,Hu Xin-rong,Wang Hui. Simulation
Technology of Cloth Modeling Based on Mass Spring
Model [J]. Journal of Wuhan University of Science and
(a)draped cloth (b)cloth deformation when the Engineering. 2008,21(9):6-8.
collision occurs

Author Profile
Yao yu-feng received the M.S. degrees in
Computer science and technology from
Beijing University of posts and
telecommunication in 2008. Then works as
an teaching assistant at Changshu Institute
(c) draped cloth (d) cloth deformation when the collision of Technology ,Computer science and
occurs( without masses) Engineering College .
Figure 4. experimental results

7. Conclusions
In this paper, we present a mass-spring model to simulate
the cloth deformation, and use simplified mass-spring model
when create the model of cloth, and decrease some shear
springs. The computation performance is highly improved
by using this model. The dynamic equation of the cloth-
object model is worked out by the Euler integration method.
The collision between the cloth and object is also
considered. Experimental results show that the model
creates realistic simulations good stability, easy to
implement.

References

[1] NGNH, GRIMSDALE R L. Computer graphics


techniques for modeling cloth[J]. IEEE Computer
Graphics and Applications, l996,16-36.
[2] Bridson R, Marino S, Fedkiw R. Simulation of clothing
with folds and wrinkles[C]. Proceeding of the 2003
ACM SIGGRAPH/Eurographics Symposium on
Computer Animation, San Diego, 2003,28-36.
[3] Xia kai-jian, Wang shi-tong. [J]. computer engineering
and applications, 2009, 45(29):177-179.
[4] Li Jian, Li Peng-kun, Liao Qiu-jun. Cloth simulation
based on improved mass-spring model[J].journal of
computer applications, 2009, 29(9):2386-2388.
[5] Ning Song, Lin mu-hua, Liu Jiao. A quick cloth
simulation based on physical modeling[J]. Computer
Simulation, 2006, 12( 23) : 118-121
[6] Jaruwan M, Ratan G, Shafaq C. 3D Soft Body
Simulation Using Mass-spring System with Internal
Pressure Force and Simplified Implicit Integration[J].
Journal of Computers. 2007,2(8):34-43.
[7] Li Chang-feng, Xiu Yi. Cloth 3D dynamic deformation
[J]. CAD&CG,2006,18(9):1372-1376.
[8] MEYER M, DEBUNNE G, BARR A. Interactive
animation of cloth-like objects for virtual reality[J].

You might also like