10
COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds 2014; 25:353–362 Published online in Wiley Online Library (wileyonlinelibrary.com). DOI: 10.1002/cav.1580 SPECIAL ISSUE PAPER Flock morphing animation Xinjie Wang 1 , Linling Zhou 1 , Zhigang Deng 2 and Xiaogang Jin 1 * 1 State Key Lab of CAD&CG, Zhejiang University, Hangzhou 310058, Zhejiang Province, China 2 Computer Science Department, University of Houston, Houston, TX, USA ABSTRACT We propose a new animation technique, called flock morphing, to create special morphing effects between two arbitrary 3D objects by combining the features of 3D morphing and flock animation. Its core idea is first to tetrahedralize the source 3D mesh and regard each tetrahedron as an agent in a flock and then continually generate the flock morphing animation until the target mesh emerges, formed by the same set of tetrahedra. By applying plausible trajectory planning scheme and smooth deformation algorithm, we demonstrate that our proposed method can simultaneously achieve visually desired morphing effects. Copyright © 2014 John Wiley & Sons, Ltd. KEYWORDS tetrahedralization; shape morphing; flock simulation; flock morphing; special effects; computer animation *Correspondence Xiaogang Jin, State Key Lab of CAD&CG, Zhejiang University, Hangzhou, Zhejiang Province, China. E-mail: [email protected] 1. INTRODUCTION Special effects, which blur the boundaries between art and technology, are playing an important role in entertainment and film industries. During the past several decades, there have been many developments of creating special effects using computer animation techniques. Shape morphing and flock simulation are two important ones among them. In this paper, we propose a novel flock morphing method to create visually desired special effects that share the visual appearances of 3D shape morphing and flock sim- ulation. Flock morphing produces aggregate motion of tetrahedron particles, and it visually meets velocity match- ing and flock centering rules. To produce visually pleasing morphing animation, we incorporate many features of flock simulation into our morphing model. To the best of our knowledge, similar techniques have not been reported in the literature to date. Our algorithm can be described as follows. First, two 3D objects (called source and target) are located in differ- ent positions in the working space. Then, we subdivide the two objects until they possess the same number of tetra- hedra. Second, each individual tetrahedron in the source object moves in a plausible trajectory and smoothly morphs to its corresponding tetrahedron, along a user-specified global path. After arrival at their destinations, these tetra- hedra gradually form the target object. Figure 1 shows one example morphing animation result by our approach. Similar effects that we have seen in movies are more like extensions of particle systems. Particle systems have the following limitations: (i) correspondences between two mesh objects are not considered; (ii) particles can only form an approximate shape of an object; and (iii) particle systems do not support complex and autonomous behavior patterns. Our method has four main contributions: (i) it pro- vides a complete solution to this new morphing animation effect by seamlessly combining 3D shape morphing and flock simulation, including tetrahedralization, path plan- ning and control, deformation, and so on; (ii) we introduce a new style control into local tetrahedron trajectory plan- ning, which is useful for changing the patterns of tetrahedra when they are regarded as agents in a flock; (iii) we design a new obstacle avoidance algorithm for velocity genera- tion of the flock, and this algorithm can also be easily integrated into any velocity-based multi-agent simulation systems; and (iv) we introduce a new smooth shape inter- polation algorithm between two arbitrary tetrahedra, which can be potentially used for other morphing applications, not limited to the proposed approach. 2. RELATED WORK Although techniques for producing the visual effect pre- sented in this paper has never been reported in the litera- ture, there exists a large volume of relevant research. It is Copyright © 2014 John Wiley & Sons, Ltd. 353

Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

COMPUTER ANIMATION AND VIRTUAL WORLDSComp. Anim. Virtual Worlds 2014; 25:353–362

Published online in Wiley Online Library (wileyonlinelibrary.com). DOI: 10.1002/cav.1580

SPECIAL ISSUE PAPER

Flock morphing animationXinjie Wang1, Linling Zhou1, Zhigang Deng2 and Xiaogang Jin1*

1 State Key Lab of CAD&CG, Zhejiang University, Hangzhou 310058, Zhejiang Province, China2 Computer Science Department, University of Houston, Houston, TX, USA

ABSTRACT

We propose a new animation technique, called flock morphing, to create special morphing effects between two arbitrary3D objects by combining the features of 3D morphing and flock animation. Its core idea is first to tetrahedralize the source3D mesh and regard each tetrahedron as an agent in a flock and then continually generate the flock morphing animationuntil the target mesh emerges, formed by the same set of tetrahedra. By applying plausible trajectory planning schemeand smooth deformation algorithm, we demonstrate that our proposed method can simultaneously achieve visually desiredmorphing effects. Copyright © 2014 John Wiley & Sons, Ltd.

KEYWORDS

tetrahedralization; shape morphing; flock simulation; flock morphing; special effects; computer animation

*Correspondence

Xiaogang Jin, State Key Lab of CAD&CG, Zhejiang University, Hangzhou, Zhejiang Province, China.E-mail: [email protected]

1. INTRODUCTION

Special effects, which blur the boundaries between art andtechnology, are playing an important role in entertainmentand film industries. During the past several decades, therehave been many developments of creating special effectsusing computer animation techniques. Shape morphing andflock simulation are two important ones among them.

In this paper, we propose a novel flock morphing methodto create visually desired special effects that share thevisual appearances of 3D shape morphing and flock sim-ulation. Flock morphing produces aggregate motion oftetrahedron particles, and it visually meets velocity match-ing and flock centering rules. To produce visually pleasingmorphing animation, we incorporate many features of flocksimulation into our morphing model. To the best of ourknowledge, similar techniques have not been reported inthe literature to date.

Our algorithm can be described as follows. First, two3D objects (called source and target) are located in differ-ent positions in the working space. Then, we subdivide thetwo objects until they possess the same number of tetra-hedra. Second, each individual tetrahedron in the sourceobject moves in a plausible trajectory and smoothly morphsto its corresponding tetrahedron, along a user-specifiedglobal path. After arrival at their destinations, these tetra-hedra gradually form the target object. Figure 1 shows oneexample morphing animation result by our approach.

Similar effects that we have seen in movies are morelike extensions of particle systems. Particle systems havethe following limitations: (i) correspondences between twomesh objects are not considered; (ii) particles can onlyform an approximate shape of an object; and (iii) particlesystems do not support complex and autonomous behaviorpatterns.

Our method has four main contributions: (i) it pro-vides a complete solution to this new morphing animationeffect by seamlessly combining 3D shape morphing andflock simulation, including tetrahedralization, path plan-ning and control, deformation, and so on; (ii) we introducea new style control into local tetrahedron trajectory plan-ning, which is useful for changing the patterns of tetrahedrawhen they are regarded as agents in a flock; (iii) we designa new obstacle avoidance algorithm for velocity genera-tion of the flock, and this algorithm can also be easilyintegrated into any velocity-based multi-agent simulationsystems; and (iv) we introduce a new smooth shape inter-polation algorithm between two arbitrary tetrahedra, whichcan be potentially used for other morphing applications,not limited to the proposed approach.

2. RELATED WORK

Although techniques for producing the visual effect pre-sented in this paper has never been reported in the litera-ture, there exists a large volume of relevant research. It is

Copyright © 2014 John Wiley & Sons, Ltd. 353

Page 2: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

Flock morphing animation X. Wang et al.

(a) - 0% (b) - 7% (c) - 35%

(d) - 55% (e) - 75% (f) - 100%

Figure 1. A flock of tetrahedra morphs between two-word models and follows a user-specified path. The percentage value beloweach frame denotes its corresponding t value in the morphing process.

Figure 2. The pipeline of the proposed approach.

beyond the scope of this paper to comprehensively reviewall previous morphing, motion planning, and crowd simu-lation methods; as such, we will keep our focus on a fewrecent, most relevant approaches.

Morphing is a widely-used graphical technique [1].Two-dimensional image-based morphing [2] has the lim-itation of lacking the underlying model’s spatial informa-tion, which may cause visually unpleasant artifacts whenit is implemented into 3D animations. As a compari-son, 3D mesh-based morphing can produce more real-istic and vivid visual effects (A comprehensive surveyis provided in [3]). However, most of the existing mor-phing approaches focus on establishing the one-to-onecorrespondence between two meshes beforehand, withoutdealing with crowd (flock) algorithms.

To date, extensive researches have been carried out oncrowd simulation [4]; for example, a large volume of exist-ing studies are focused on modeling various patterns ofreal-world crowds, including flock behavior [5], socialforce model [6], example-based approaches [7], and so on.Recently, increasing attentions have been drawn to controlor generate crowd formations and transitions. For example,

Takahashi et al. produce sophisticated group formationsby combining heuristic rules with explicit hard constraints[8]. Along a different direction, Gu and Deng introduce anautomated approach to generate various free-form groupformations using a novel sketching interface [9]. Ju andcolleagues present a method that blends different crowddata to create a morphable crowd simulation [10]. Further-more, Xu et al. propose an agent-based flock animationsystem that is capable of satisfying dynamic 3D shape con-straints [11]. But all the methods mentioned earlier do notintegrate with shape morphing algorithms. In other words,individuals in these methods just group together so thatthe flock looks like a shape, without changing into anothershape during the transformation process.

3. APPROACH OVERVIEW

The pipeline of our approach can be illustrated in Figure 2.At the beginning, two mesh models are specified as sourceand target. Then, they are tetrahedralized into two sets,which have the same number of tetrahedra. During themorphing process, the source tetrahedron set is moving

354 Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd.DOI: 10.1002/cav

Page 3: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

X. Wang et al. Flock morphing animation

toward the target as a flock simulation, where each tetrahe-dron can be regarded as an individual agent. At each timestep, we compute the velocity of each agent and updateits position accordingly. Once a tetrahedron approaches thetarget area, we will dynamically identify its corresponding(target) tetrahedron. Then, by adjusting its arriving veloc-ity, it will gradually morph to the target tetrahedron. Theanimation stops once all the tetrahedra reach their goalsand together form the target model.

4. MESH TETRAHEDRALIZATION

We adopt “Tetgen” [12] to obtain a tetrahedron set thataccurately tetrahedralizes a mesh model. Given a piece-wise linear complex (PLC) without intersecting segmentsor facets, Tetgen can generate a quality mesh of Delaunaytetrahedra with radius-edge ratios no greater than 2.0. Most3D meshes can be converted into PLCs easily.

Once we have tetrahedralized the source mesh and thetarget mesh into two tetrahedron sets S and T , we continuesubdividing them until they share the same number of tetra-hedra. Let n1 and n2 be the number of tetrahedra in S andT , respectively. Let n be a user-specified parameter, whichis the total number of tetrahedra during the morphing, andn � max.n1, n2/. The default value for n is max.n1, n2/.Three different schemes can be used for subdivision, asillustrated in Figure 3.

We first apply one-to-four subdivision scheme(Figure 3(a)) to all the tetrahedra in S. So S is replaced bya new set with 41 � n tetrahedra after one level of subdivi-sion. We repeatedly apply one-to-four subdivision schemek times where k should satisfy:

4k � n1 � n < 4kC1 � n1 (1)

It is easy to know that k equals to

ˇˇlog

nn14

ˇˇ. So far, the

subdivided S has m D 4k � n1 tetrahedra. Let

d Djn � m

3

k, r D n � m � 3 � d (2)

We first sort the tetrahedra of the subdivided S accordingto their volumes in a descending order and then subdividethe preceding d tetrahedra using one-to-four subdivisionscheme. If r equals to 2, we subdivide the tetrahedra

with index d with the one-to-three subdivision scheme(Figure 3(b)). If r equals to 1, we subdivide the tetrahe-dron with index d by the one-to-two subdivision scheme(Figure 3(c)). To this end, both S and T have n tetrahedra,respectively.

5. MOVING SCHEME

In this work, we assume that the source mesh and thetarget mesh do not overlap. Thus, the simplest way togenerate morphing animation is to guide all agents tomove straightly from their source positions to their goals.However, many scenarios require agents to follow a moreflexible and controllable path.

In this section, we describe a two-phase velocity controlmethod that can create many different kinds of plausibletrajectories. Agents will apply different velocities accord-ing to their positions during different phases, as illustratedin Figure 4. During phase 1, we generate velocity EV1 foreach agent by using a two-level velocity method

�EVg and

EVl

�and two collision avoidance schemes

�EVoa and EVla

�.

During phase 2, a simple velocity EV2 is applied to eachagent according to its corresponding target tetrahedron.The next four sections give the details of four velocityfields needed for calculating EV1, and Section 5.5 describesthe detailed computation of EV1 and EV2.

5.1. Global Velocity

First, we find out the centroid CS (or CT ) of the source(or target) mesh. The vector

���!CSCT is regarded as the main

direction of the global velocities of all the agents in S.Second, our approach allows users to specify the global

path by sketching an arbitrary curve in the 3D space. Wesequentially sample m key points (m can be specified byusers) on the curve, Q.Q0, Q1, : : : , Qm, QmC1/. Specially,Q0 D CS and QmC1 D CT , which indicates that the nav-igation curve must start from the source and end at thetarget. Each pair of two adjacent points derives a unit vec-tor Efi, from the former to the latter (Figure 4). Then, wecalculate the global velocities for all the agents:

EVg.X, t/ D Efi � speed0,

where i D argmin.distance.Ex.t/, Qi/(3)

Figure 3. Three subdivision schemes for a tetrahedron.

Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd. 355DOI: 10.1002/cav

Page 4: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

Flock morphing animation X. Wang et al.

Figure 4. Moving scheme for flock morphing.

In Equation 3, speed0 is a user-specified parameter,which defines the base speed of the flock. X is a tetra-hedron, and X 2 S, Ex.t/ D Ex.t, x, y, z/ means the current3D position of X’s centroid at moment t. The func-tion distance./ calculates the distance value between twopoints. We can also define the width of the path and addan attractive velocity on EVg to force all agents to move in afixed width. It is unnecessary to go into the details becauseit is easy to implement. Besides, it is noteworthy that thepath should not be self-intersecting. Otherwise, we may notobtain the correct path.

Moreover, we design the specific moving order of X 2S according to the path. Generally, when animation starts,all of the tetrahedron agents are stationary in the sourcemodel. Those who are in front along the global movingdirection will move earlier. On the other hand, at the end ofthe animation, agents will form the target model by startingwith the farthest locations. A concrete example is shown inFigure 1. To achieve this, we define an order D1.X/ for anyX 2 S, and D2.X0/ for any X0 2 T :

D1.X/ D .Q0 � Q1/ ��Ex.t0/ � Q1

�D2.X

0/ D �.QmC1 � Qm/ ��Ex0.t0/ � Qm

� (4)

In the previous equations, t0 denotes the first time step ofthe animation, when all the tetrahedra in S have not startedto move yet. As a preprocessing step, we calculate D1 andD2 and sort them in an ascending order, respectively.

5.2. Style Velocity

While the global velocity can guarantee agents to movealong the path, we still expect that they can exhibit charac-teristic motion patterns. Therefore, a few existing velocityfields can be integrated with our approach, such as stochas-tic wind fields, gravitational fields, or noise fields. Thesevelocity fields are used to generate local behaviors, so ourapproach is able to create a variety of animation scenar-ios. For example, we can employ the following curl-noisevelocity field, inspired by the work of Wang et al. [13] and

Bridson et al. [14], to obtain swarm-like behaviors of theflock:

EP.Ex/ D

�P1

�Ex

scale

�, P2

�Ex

scale

�, P3

�Ex

scale

��� gain

EVl.X, t/ D r � EP�Ex.t/

�(5)

Here, Ex is a 3D point, and P1, P2, and P3 are three Perlinnoise functions with different random seeds. Ex.t/ is still X’scentroid at moment t. We use two noise parameters: scale(for controlling the grid density indirectly) and gain (foradjusting the magnitude of the Perlin noise).

In this way, we combine EVg (Equation 3) and EVl(Equation 5) to obtain the governing velocity as follows:

EVgrn D !1 � EVg C !2 � EVl (6)

where !1 and !2 are adjustment factors.

5.3. Obstacle Avoidance

In many scenes, collisions will happen when theuser-specified path passes through the obstacles. Thus,the agents should be aware of the environment and findout a collision-free new path in time. Many obstacleavoidance algorithms have been proposed in the crowdsimulation community. Treuille et al. [15] design the con-tinuum crowd simulation based on shortest path finding.But their approach does not support user-defined paths.Patil et al. [16] introduce a path finding algorithm witha user-sketched guidance curve. However, in their work,path following may fail if the guidance curve intersectswith obstacles. In addition, agents distant away from thecurve will not be effected strongly by the curve. In ourflock morphing animation, all the agents should follow thepath as strictly as possible while avoiding obstacles; other-wise, the visual result would not be satisfying. We addressthis issue by introducing a new obstacle avoidance scheme,described as follows.

356 Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd.DOI: 10.1002/cav

Page 5: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

X. Wang et al. Flock morphing animation

First, we calculate a discrete potential field dt using 3Dgrids in the environment, where dt.i/ denotes the shortestdistance from the center of a grid cell i to the obstacles.Those cells whose centers are inside an obstacle will havedt D 0. dt distributes in the space and forms a gravitationalfield, as illustrated in Figure 5. Any points in this field tendto move from higher potential to lower potential. The mov-ing direction of an agent X can be obtained from potentialgradient Eg.dt.X/ equals to dt.i/when X is in the grid cell i).When we need to calculate an obstacle-avoidance velocity,we first solve a plane that passes through X and perpen-dicular to Eg, and then we calculate a repulsion direction ofX by finding a projection unit vector ED of the Vgrn on thisplane. Figure 5 illustrates this computing process (2D viewis chosen for simplicity). Note that if ED is a zero vector,the repulsion direction of X can be any unit vector on theplane. The obstacle-avoidance velocity Voa is defined asfollows:

EVoa.X/ Ddt.X/

ka� EVgrn C

�1 �

dt.X/

ka

�� ED � speed0 (7)

where ka is an adjustment factor and denotes the range ofthe influenced area. As described in Equation 7, agents thatare close to an obstacle will be more affected by EVoa (theagent X1 in Figure 5). Conversely, agents that are locatedoutside the influenced area will maintain their originalvelocities (the agent X2 in Figure 5).

The obstacle avoidance algorithm introduced earlier canbe straightforwardly integrated into any velocity-based

multi-agent simulation systems by regarding their govern-ing velocity fields as Vgrn in Equation 7.

5.4. Local Avoidance

In a path planning scheme, the local collision avoidancebetween agents is important. Considering that a large num-ber of agents may appear in one scene, we address thelocal inter-agent avoidance issue using a highly efficientmethod called minimum distance enforcement (MDE) ruleto compute a local avoidance velocity EVla, as suggested in[15]. This rule can be briefly summarized as follows: Ifthe distance between two agents is smaller than a thresh-old (i.e., the minimum distance), we add two symmetricalopposite velocities on them, respectively (illustrated inFigure 6).

5.5. Velocity Synthesis

As illustrated in Figure 4, we divide the moving schemeinto two phases, by checking whether the agent is insidethe minimal bounding sphere of the target model (phase 2)or not (phase 1). We calculate the final velocities for agentsduring phase 1 and phase 2, respectively.

Phase 1: For an agent X that is moving, the governingvelocity of X should be Vgrn.X, t/ at moment t. We advanceX’s position by this velocity for ıt time. If X is to collidewith obstacles, it needs to change its direction at t. Other-wise, it will remain its direction. The final velocity during

Figure 5. An illustration of computing the obstacle-avoidance velocity.

Figure 6. An illustrative example of the minimum distance enforcement rule.

Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd. 357DOI: 10.1002/cav

Page 6: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

Flock morphing animation X. Wang et al.

phase 1 can be described in Equation 8, where PX denotesthe current position of X, and RX denotes the radius of theminimal bounding sphere of tetrahedron X.

EV1.X, t/ D

(EVoa.X, t/C EVla.X, t/ dt

�x.t/C EVsyn.X, t/ � ıt

�< RX ,

EVsyn.X, t/C EVla.X, t/ Otherwise(8)

Phase 2: When X moves into the minimal bound-ing sphere of the target model, we immediately find thecorresponding tetrahedron X0 in the target set T usingEquation 4, and we predict the duration tf before it arrivesat X0. tf needs to be used to determine V2 as shown inEquation 9. Note that V2 is a constant, and we only need tocalculate it once.

EV2.X/ D����!PX0PX

k����!PX0PX k tf

, where tf Dk����!PX0PX k

speed0(9)

6. MORPHING SCHEME

Besides the path planning, how to morph between thesource and the target tetrahedra is also a non-trivial issuein our approach. Based on our experiments, we found thatapplying appropriate deformations (shrink, transform, andenlarge) to an individual tetrahedron could achieve visuallypleasing flock morphing animations.

Figure 7(a) illustrates our morphing scheme. In order toexplain the process more clearly, two key parts of the mor-phing scheme are zoomed in Figure 7(b) and Figure 7(c),respectively. As in Figure 7(b), a tetrahedron quicklyshrinks to one-eighth of its original size when it starts tomove. The situation is somewhat different when the tetra-hedra tend to form the target. As shown in Figure 7(c),first, a smooth shape transformation is performed betweenthe shrinked tetrahedron Xs and the corresponding shrinkedtarget tetrahedron X0s. Then, X0s is enlarged gradually untilit becomes the same as X0. Meanwhile, X0s arrives at the tar-get position. We present an efficient way to process shapetransformations based on an affine mapping algorithm.

An affine transformation is a transformation that pre-serves collinearity and ratios of distances, and it can beuniquely determined by four pairs of points. Inspired bythe work of Farin [17], an affine transformation can beexpressed as follows:

x0 D dC A.x � o/

where o is the origin of x’s coordinate system and x0 isthe image of under affine map x displaced by vector d. LetT.p1p2p3p4/ be the source tetrahedron and T

�p01p02p03p04

�be the target tetrahedron. We assume that pi correspondsto p0i. To calculate the affine transformation from T to T 0,we set up a coordinate system at T by taking P1 as the ori-gin and pi � p1.i D 2, 3, 4/ as three axes. The coordinate

Figure 7. Morphing scheme for flock morphing.

358 Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd.DOI: 10.1002/cav

Page 7: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

X. Wang et al. Flock morphing animation

system at T 0 can be set up similarly based on the sameindices. Points in the two coordinate systems can bemapped by

x0 D p01 C A.x � p1/

Then, the non-translational portion A of the affine trans-formation from T to T 0 can be computed as follows:

A D�p02 � p01, p03 � p01, p04 � p01

� Œp2 � p1, p3 � p1, p4 � p1�

�1

(a) - 3% (b) - 30% (c) - 37%

(d) - 55% (e) - 82% (f) - 95%

(a) - 0% (b) - 5% (c) - 35%

(d) - 60% (e) - 70% (f) - 100%

(a) - 0% (b) - 10% (c) - 30%

(d) - 60% (e) - 90% (f) - 100%

Figure 8. Results of our approach: (top example) a moon-like model morphs to a star; (middle example) two imaginary creaturestransform from one to another in a desert; (bottom example) in a castling situation of a chess game, the rook and the king morph tothe target subtly instead of moving rigidly. The percentage value below each frame denotes its corresponding t value in the morphing

process.

Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd. 359DOI: 10.1002/cav

Page 8: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

Flock morphing animation X. Wang et al.

A is a composite transformation that encodes rotation,scaling, and shear transformations. If we interpolate itdirectly with an identity matrix I, that is, .1� t/IC tA, theresults are not valid. In 1994, Shoemake showed that thepolar decomposition is a good way to interpolate an affinetransformation [18]. The polar decomposition factors A arerepresented as follows:

A D RS

where R is an orthogonal matrix and S is a symmetric pos-itive definite matrix. The factor S is always unique and canbe expressed as S D .AT A/

12 , where exponent 1

2 denotesthe principal square root. The factors produced by polardecomposition are unique and coordinate-independent.

In order to proceed the polar decomposition, wefirst converse R to its unit quaternion representationq D .w, x, y, z/ and then further express q as q D�

cos �2 , nsin �2

�, where � is the rotation angle and n is

the unit rotation axis. Thus, we can interpolate the rota-tion between two tetrahedra explicitly by interpolating theunit quaternion. q can be converted into the rotation matrixR.n, �/.

Now, the interpolated composite matrix can be writtenas follows:

A.t/ D .1 � t/IC tR.n, t�/S, 0 � t � 1

Decomposing matrix A into the polar form makes itpossible to interpolate the intrinsic rotation separately,which leads to smooth transformation. Now, using the pre-vious formula, the positions of the linearly interpolatedtetrahedron, T.p1.t/p2.t/p3.t/p4.t//, can be computed asfollows:

q1.t/ D .1 � t/p1 C tp01q2.t/ D q1.t/C A.t/.p2 � p1/

q3.t/ D q1.t/C A.t/.p3 � p1/

q4.t/ D q1.t/C A.t/.p4 � p1/

7. EXPERIMENTAL RESULTS

We used our approach to generate a variety of flock mor-phing animations and found that our approach can producevisually satisfactory effects. Our method can be appliedto any 3D objects with arbitrary topology to create visu-ally pleasing evolving effects from the source object tothe target object. All the transitions are visually smoothduring the whole animation. Several selected simulationscenarios are discussed in this section. Please refer to theaccompanying demo video for animation results.

Words morphing: Figure 1 clearly shows the process ofour approach. Tetrahedra detach from the word “CASA” inorder and find their paths to form the target word “2014.”The transformations and scalings between tetrahedra canbe obtained during the animation. Because there is no stylevelocity field (i.e., EVl D 0), agents move and follow theuser-specified curve strictly.

Ta

ble

I.Pa

ram

eter

sett

ings

and

perf

orm

ance

stat

istic

sof

our

appr

oach

for

sele

cted

sim

ulat

ion

scen

ario

s.

Num

ber

ofPr

epro

cess

ing

Sim

ulat

ion

Ave

rage

MD

ES

cena

rioag

ents

Spee

d 0Pa

ram

eter

sG

ridre

solu

tion

Sty

lefa

ctor

stim

e(s

econ

d)FP

S(C

PU

)pe

rcen

tage

per

fram

e(%

)

Wor

ds13

,818

10.0

!1D

1.0

80�

120�

60—

1.53

618

5.4

0.13

!2D

0.0

The

moo

n34

748.

0!

1D

0.7

120�

40�

40S

toch

astic

win

d:0.

454

31.3

0.72

!2D

0.3

Win

dSpe

edD

0.5

Cre

atur

es48

1110

.0!

1D

0.5

120�

100�

65C

url-n

oise

:0.

508

17.8

0.63

!2D

0.5

gainD

0.3

scal

eD

0.6

Cas

tling

-Kin

g41

466.

5!

1D

1.0

100�

80�

60—

0.41

232

2.4

0.02

!2D

0.0

!1D

0.8

Cur

l-noi

se:

Cas

tling

-Roo

k41

465.

5!

2D

0.2

80�

120�

60ga

inD

0.00

62.

159

13.1

1.27

k aD

0.01

scal

eD

0.01

5

The

calc

ulat

ion

ofst

yle

velo

citie

sco

nsum

esex

tra

time

insc

enar

ios

2,3,

and

5.

360 Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd.DOI: 10.1002/cav

Page 9: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

X. Wang et al. Flock morphing animation

The moon: In this simulation, we employ a stochasticwind velocity field as a style velocity field. While agentsare constrained by the curve, they are also affected by thewind field. In Figure 8 (top example), the moon vanishes asit is blown away by the wind, creating a flow-like morphingeffect. Note that the navigation curve in this scenario doesnot actually intersect with itself, just an illusion when thescene is rendered into 2D.

Imaginary creatures: In Figure 8 (middle example), thecurl-noise style velocity field is employed to make agentsmove like insect swarms (described in Section 5.2).

Castling: This scenario shows how agents deal withobstacles. After the king moves two squares toward therook, it becomes an obstacle blocked in the morphing pathof the rook. Then, the rook starts to morph, and all the tetra-hedron agents can be aware of the king and bypass it. InFigure 8 (bottom example), the rook’s morphing process isdemonstrated. We encourage readers to check the completecastling animation in our companion video.

All the previous scenarios were simulated on an off-the-shelf computer with an Intel 2 DUO Central ProcessingUnit (CPU) E7500 and 4 G main memory. Table I showsthe performance statistics of the previous four scenarios.The regular 3D grid defined in each scenario is employedfor storing style velocities (at the centers) and MDE calcu-lation. The obtained simulation Frames Per Second (FPS)shows that our approach can run in near real-time on anoff-the-shelf computer. Besides, the average percentage ofMDE per frame is recorded in the last row of Table I. In allthe previous scenarios, the percentage of calling the MDErule is significantly below 2%.

8. DISCUSSION ANDCONCLUSIONS

In this paper, we introduce a highly efficient approachto create visually pleasing flock morphing animations.Unlike existing shape morphing and flock simulation meth-ods, our approach seamlessly combines the two researchdirections to produce a new type of visual special effect.Our approach provides flexible controls to users includingtuning those parameters or employing pre-defined veloc-ity fields. Another advantage of our approach is its timeefficiency. For example, our approach real-time supportslarge-scale simulations (i.e., over 104 tetrahedra agents) onan off-the-shelf computer.

However, a number of caveats need to be noted regard-ing our current approach. First, the minimal boundingsphere that we use for determining whether the agents isclose enough to the target model may not work well whenthe target model is too narrow. But adopting a minimalbounding box, instead of the minimal bounding sphere,would cause some moving artifacts, because the boundingbox is anisotropic and agents may fail to move in order. Wewill leave this issue to the future work.

Second, global avoidance and local avoidance are notsupported when agents move inside the minimal bounding

spheres. Controls of the agents’ velocities are restrictedbecause moving to the target positions is the primary taskof the agents. In other words, agents may collide with thoseobstacles close to the target model or collide with eachother before they reach their destinations. The latter seemsless critical because agents will collide with each otheranyway at the final step. We plan to explore new and bet-ter path-control schemes to further improve the results. Asthe future work, we would like to extend our approach tohandle 3D models in other forms (not tetrahedra), such asirregular polyhedra, meta-balls, or more complex elements.

ACKNOWLEDGEMENTS

This work was supported by Zhejiang Provincial NaturalScience Foundation of China (grant no. Z1110154), theJoint Research Fund for Overseas Chinese, Hong Kongand Macao Young Scientists of the National Natural Sci-ence Foundation of China (grant no. 61328204), and theNational Natural Science Foundation of China (grant no.61272298). The authors would like to thank Junjie Chenfor English proofreading.

REFERENCES

1. Gomes J, Darsa L, Costa B, Velho L. Warping andMorphing of Graphical Objects. Morgan KaufmannPublishers Inc.: San Francisco, USA, 1998.

2. Wolberg G. Image morphing: a survey. The VisualComputer 1998; 14(8–9): 360–372.

3. Alexa M. Recent advances in mesh morphing. Com-puter Graphics Forum 2002; 21(2): 173–198.

4. Zhan B, Monekosso DN, Remagnino P, Velastin SA,Xu LQ. Crowd analysis: a survey. Machine Vision andApplications 2008; 19(5–6): 345–357.

5. Reynolds CW. Flocks, herds and schools: a distributedbehavioral model. In Proceedings of the 14th AnnualConference on Computer Graphics and InteractiveTechniques. SIGGRAPH ’87. ACM: New York, USA,1987; 25–34.

6. Helbing D, Molnár P. Social force model for pedestriandynamics. Physical Review E 1995; 51: 4282–4286.

7. Lee KH, Choi MG, Hong Q, Lee J. Groupbehavior from video: a data-driven approach tocrowd simulation. In Proceedings of the 2007ACM SIGGRAPH/Eurographics Symposium on Com-puter Animation. SCA ’07. Eurographics Association:Aire-la-Ville, Switzerland, 2007; 109–118.

8. Takahashi S, Yoshida K, Kwon T, Lee KH, Lee J, ShinSY. Spectral-based group formation control. ComputerGraphics Forum 2009; 28(2): 639–648.

9. Gu Q, Deng Z. Generating freestyle group formationsin agent-based crowd simulations. IEEE ComputerGraphics and Applications 2013; 33(1): 20–31.

Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd. 361DOI: 10.1002/cav

Page 10: Flock morphing animationgraphics.cs.uh.edu/wp-content/papers/2014/2014... · COMPUTER ANIMATION AND VIRTUAL WORLDS Comp. Anim. Virtual Worlds2014; 25:353–362 Published online in

Flock morphing animation X. Wang et al.

10. Ju E, Choi MG, Park M, Lee J, Lee KH, TakahashiS. Morphable crowds. ACM Transactions on Graphics2010; 29(6): 140:1–140:10.

11. Xu J, Jin X, Yu Y, Shen T, Zhou M. Shape-constrainedflock animation. Computer Animation and VirtualWorlds 2008; 19(3–4): 319–330.

12. Si H. Tetgen: a quality tetrahedral mesh generatorand three-dimensional Delaunay triangulator. Techni-cal Reports 9, Weierstrass Institute for Applied Analy-sis and Stochastic, Berlin, Germany, 2004.

13. Wang X, Jin X, Deng Z, Zhou L. Inherent noise-awareinsect swarm simulation. Computer Graphics Forum2014. DOI: 10.1111/cgf.12277. (published online).

14. Bridson R, Houriham J, Nordenstam M. Curl-noise forprocedural fluid flow. ACM Transactions on Graphics2007; 26(3): 1–4.

15. Treuille A, Cooper S, Popovic Z. Continuumcrowds. ACM Transactions on Graphics 2006; 25(3):1160–1168.

16. Patil S, van den Berg J, Curtis S, Lin M, Manocha D.Directing crowd simulations using navigation fields.IEEE Transactions on Visualization and ComputerGraphics 2011; 17(2): 244–254.

17. Farin G. Curves and Surfaces for CAGD: A PracticalGuide 5edn. Morgan Kaufmann Publishers Inc.: SanFrancisco, USA, 2002.

18. Shoemake K. Graphics gems IV. In Graphics Gems IV,Heckbert Paul S. (ed.). Academic Press Professional,Inc.: San Diego, USA, 1994; 207–221.

AUTHORS’ BIOGRAPHIES

Xinjie Wang is a PhD candidate of theState Key Lab of CAD&CG, ZhejiangUniversity, China. She received herBSc degree in computer science andtechnology from Wuhan University in2010. Her research interests includecomputer animation, flock simulation,and crowd simulation.

Linling Zhou received her BSc degreein digital media technology in 2011and MSc degree in computer technol-ogy in 2014, all from Zhejiang Uni-versity. Her research interests includecomputer animation and interactivedesign.

Zhigang Deng is an associate profes-sor of Computer Science at Universityof Houston (UH) and the FoundingDirector of the UH Computer Graph-ics and Interactive Media (CGIM)Lab. His research interests are in thebroad areas of computer graphics,computer animation, human-computerinteraction, virtual human modeling

and animation, and visual computing for biomedical appli-cations. Besides the CASA 2014 general co-chair, hecurrently serves as an associate editor of Computer Graph-ics Forum, and Computer Animation and Virtual WorldsJournal. He earned his PhD in computer science at theUniversity of Southern California in 2006. Prior to that,he completed his BS degree in Mathematics from Xia-men University (China) and MS in Computer Science fromPeking University (China). Over the years, he had workedat the Founder Research and Development Center (China)and AT&T Shannon Research Lab.

Xiaogang Jin is a professor of theState Key Lab of CAD&CG, Zhe-jiang University, China. He receivedhis BSc degree in computer sciencein 1989 and MSc and PhD degreesin applied mathematics in 1992 and1995, respectively, all from ZhejiangUniversity. His current research inter-ests include traffic simulation, insect

swarm simulation, physically based animation, cloth ani-mation, special effects simulation, implicit surface com-puting, non-photorealistic rendering, computer-generatedmarbling, and digital geometry processing.

362 Comp. Anim. Virtual Worlds 2014; 25:353–362 © 2014 John Wiley & Sons, Ltd.DOI: 10.1002/cav