geometry-constrained crowd formation animation

9
Special Section on CAD/Graphics 2013 Geometry-constrained crowd formation animation Liping Zheng a,n , Jianming Zhao a , Yajun Cheng a , Haibo Chen a , Xiaoping Liu a , Wenping Wang b a Hefei University of Technology, China b The University of Hong Kong, China article info Article history: Received 4 August 2013 Received in revised form 27 October 2013 Accepted 28 October 2013 Available online 20 November 2013 Keywords: Crowd simulation Crowd formation Animation Centroidal Voronoi tessellation The Lloyd's method abstract Formation control technology can exhibit the collective ock behaviors of a crowd for simulation and animation purpose, and thus, can be applied in various elds. In this paper, an innovative geometry- constrained framework for smooth formation animation of regulated crowds is proposed. We employ the morphing method to generate a series of in-between constrained shapes as key frames to impose process control and ensure smoothness of formation transformations. We also introduce centroidal Voronoi tessellation (CVT) to calculate optimal distribution of agents, and present an improved Lloyd descent method to perform path planning by utilizing its xed point iteration feature. As extensions, the proposed framework can handle environmental obstacles avoiding problems for the whole crowd to preserve certain formation extremely by utilizing a domain modication method, and can also be adapted to 3D spaces and density-based domains. Experimental results show that the proposed method can generate stable, smooth, orderly, regular and elegant crowd formation animations. & 2013 Elsevier Ltd. All rights reserved. 1. Introduction Crowd formation, also known as ock or group formation, is an arrangement or deployment of a group of individuals which form a certain pattern or shape. Flock's collective behaviors are often visually expressed as their general formations that are vital in many real-world scenarios such as battles or football games [1]. Crowd formation animation is dened as the process of deforming a crowd from an initial formation to a target one, and is widely used in games for interactive group control, in movies to produce graceful animation, and in multi-agent control systems where agents coordinate and cooperate to perform difcult tasks. One common practical example of such a multi-agent control system is formulated as a swarm robotic system in [2] in which hundreds or thousands of autonomous robots perform subtasks in a parallel manner. Formation control has been under intensive studies recently in the domain of multi-robot control system. Although existing popular methods are available for applications in this domain, they all have some downsides. The behavior based method is intuitive and straightforward, but it suffers from parameter tuning problems. This kind of method cannot be used to dene ock behaviors explicitly and guarantees no stability and regularity [3,4]. The leader-follower method [5] and generalized coordinates method [6] usually impose location constraints to maintain a formation through a set of rigorous control theories and differ- ential equations. These types of methods have a solid theoretical basis, but they are prone to modeling and implementation difculties and robustness issues [5]. In addition, exact knowledge of the animals' behaviors and complicated implementation tech- niques are often needed [7]. The geometry constrained method [8,9] utilizes geometric structures as proles to construct certain formation. This kind of method is simple and easy to be imple- mented, but it faces a variety of problems in existing attempts, such as sampling uniformity, matching accuracy, path planning with collision avoidance [10]. This paper focuses on regulated crowds, which are often found in scenarios of battles, mass performances and team sports. These applications require smooth and well-organized transitions to achieve artistic layouts and tactical arrangements, as shown in Fig. 1. In addressing these desirable features, the geometry-based method is inherently more advanced than other methods. [3] indicates that rigid constraints in crowd animation are often difcult to be imposed on agent behaviors due to the fact that they are massive, autonomous and intelligent. To solve this difculty, Schuerman et al. introduced a class of situation agents, in which specialized controlling logics as well as constraints can be implemented to impact regular agents [11]. In general, the shape- constrained method is a very good solution. Our major contribution is that we propose a pure geometry- based framework to animate the deformation process of regulated crowds. The existing geometry based approaches are often used in Contents lists available at ScienceDirect journal homepage: www.elsevier.com/locate/cag Computers & Graphics 0097-8493/$ - see front matter & 2013 Elsevier Ltd. All rights reserved. http://dx.doi.org/10.1016/j.cag.2013.10.035 n Corresponding author. Tel.: þ86 551 62901377. E-mail addresses: [email protected], [email protected] (L. Zheng). Computers & Graphics 38 (2014) 268276

Upload: tjitske-franx

Post on 05-May-2017

227 views

Category:

Documents


1 download

TRANSCRIPT

Special Section on CAD/Graphics 2013

Geometry-constrained crowd formation animation

Liping Zheng a,n, Jianming Zhao a, Yajun Cheng a, Haibo Chen a, Xiaoping Liu a,Wenping Wang b

a Hefei University of Technology, Chinab The University of Hong Kong, China

a r t i c l e i n f o

Article history:Received 4 August 2013Received in revised form27 October 2013Accepted 28 October 2013Available online 20 November 2013

Keywords:Crowd simulationCrowd formationAnimationCentroidal Voronoi tessellationThe Lloyd's method

a b s t r a c t

Formation control technology can exhibit the collective flock behaviors of a crowd for simulation andanimation purpose, and thus, can be applied in various fields. In this paper, an innovative geometry-constrained framework for smooth formation animation of regulated crowds is proposed. We employ themorphing method to generate a series of in-between constrained shapes as key frames to impose processcontrol and ensure smoothness of formation transformations. We also introduce centroidal Voronoitessellation (CVT) to calculate optimal distribution of agents, and present an improved Lloyd descentmethod to perform path planning by utilizing its fixed point iteration feature. As extensions, theproposed framework can handle environmental obstacles avoiding problems for the whole crowd topreserve certain formation extremely by utilizing a domain modification method, and can also beadapted to 3D spaces and density-based domains. Experimental results show that the proposed methodcan generate stable, smooth, orderly, regular and elegant crowd formation animations.

& 2013 Elsevier Ltd. All rights reserved.

1. Introduction

Crowd formation, also known as flock or group formation, is anarrangement or deployment of a group of individuals which form acertain pattern or shape. Flock's collective behaviors are oftenvisually expressed as their general formations that are vital inmany real-world scenarios such as battles or football games [1].Crowd formation animation is defined as the process of deforminga crowd from an initial formation to a target one, and is widelyused in games for interactive group control, in movies to producegraceful animation, and in multi-agent control systems whereagents coordinate and cooperate to perform difficult tasks. Onecommon practical example of such a multi-agent control system isformulated as a swarm robotic system in [2] in which hundreds orthousands of autonomous robots perform subtasks in a parallelmanner.

Formation control has been under intensive studies recently inthe domain of multi-robot control system. Although existingpopular methods are available for applications in this domain,they all have some downsides. The behavior based method isintuitive and straightforward, but it suffers from parameter tuningproblems. This kind of method cannot be used to define flockbehaviors explicitly and guarantees no stability and regularity[3,4]. The leader-follower method [5] and generalized coordinates

method [6] usually impose location constraints to maintain aformation through a set of rigorous control theories and differ-ential equations. These types of methods have a solid theoreticalbasis, but they are prone to modeling and implementationdifficulties and robustness issues [5]. In addition, exact knowledgeof the animals' behaviors and complicated implementation tech-niques are often needed [7]. The geometry constrained method [8,9]utilizes geometric structures as profiles to construct certainformation. This kind of method is simple and easy to be imple-mented, but it faces a variety of problems in existing attempts,such as sampling uniformity, matching accuracy, path planningwith collision avoidance [10].

This paper focuses on regulated crowds, which are often foundin scenarios of battles, mass performances and team sports. Theseapplications require smooth and well-organized transitions toachieve artistic layouts and tactical arrangements, as shown inFig. 1. In addressing these desirable features, the geometry-basedmethod is inherently more advanced than other methods. [3]indicates that rigid constraints in crowd animation are oftendifficult to be imposed on agent behaviors due to the fact thatthey are massive, autonomous and intelligent. To solve thisdifficulty, Schuerman et al. introduced a class of situation agents,in which specialized controlling logics as well as constraints can beimplemented to impact regular agents [11]. In general, the shape-constrained method is a very good solution.

Our major contribution is that we propose a pure geometry-based framework to animate the deformation process of regulatedcrowds. The existing geometry based approaches are often used in

Contents lists available at ScienceDirect

journal homepage: www.elsevier.com/locate/cag

Computers & Graphics

0097-8493/$ - see front matter & 2013 Elsevier Ltd. All rights reserved.http://dx.doi.org/10.1016/j.cag.2013.10.035

n Corresponding author. Tel.: þ86 551 62901377.E-mail addresses: [email protected], [email protected] (L. Zheng).

Computers & Graphics 38 (2014) 268–276

conjunction with behavior based methods for collision avoidance[12], or with control theories for adaptive navigation [13], raisingrobustness and disorder problems. The proposed approach inher-its the advantages of the geometry-based method, overcomes theshortcomings of conventional shape-constrained methods andextends the current virtual structure approaches to achieve atradeoff between rigid and flexible constraints. The result, shownin Fig. 1 as an example, exhibits a smooth, orderly and regulartransition and proves the potential of our method in applicationsin many domains such as games, movie animations and massivesport design.

There are, however, some limitations. First, our method isrestricted to agents in regulated crowds in which they formparticular formations under certain constraints. Unlike generalcrowds where agents are autonomous and intelligent to choosepaths , individuals in regulated crowds are tightly constrained bythe intermediate shapes and navigated by Lloyd descent directionsto generate regular and orderly results. Also, as a side effect toachieve an exactly optimal and homogeneous distribution, theresults of our method may look somewhat artificial for real-worldcrowd animations. Perturbations can be introduced to relieve suchan issue by, for instance, composing a density field as shown inFig. 10, as well as using a capacity-constrained CVT method.

2. Related work

In contrast to the general crowd simulation, formation controlemphasizes on spatial, temporal and correspondence constraintsto assure the crowd's conformity to a predetermined formation.According to [14], conventional formation control approaches canbe roughly categorized as the behavior based approach [4,12], theleader-follower approach [5], the generalized coordinates method [6],the geometry-based method [8,9], etc. The method proposed in thispaper is classified as a descendant of the geometry based method,which can be further divided into the virtual structure approachand the shape-constrained method depending on the researchdomain.

In the domain of mobile robots control, the virtual structureapproach is applied to formation control for AGVs (AutomatedGuided Vehicles), UAVs (Unmanned Aerial Vehicles), and AUVs(Autonomous Underwater Vehicles). In order to improve controlperformance and efficiency, the virtual structure approach hasbeen utilized to maintain UAV formation with synchronous tech-nology to keep the relative position tracking motion of theaircrafts [15]. [8] proposed a combination of the Lyapunov tech-nique and graph theory embedded in the virtual structure. In thisway, the knowledge derived by localization of the robots in thegroup allowed for efficient coordination and trajectory following,which could then create useful robot formations. Sadowska et al.[16] presented a distributed unicycle formation control algorithmbased on the virtual structure approach from [17]. The advantages

of their algorithm reside in that for each robot only its neighborswere needed to be contacted and then a simple linear formationcontrol feedback mechanism was introduced. The virtual structurecan also be flexible. [9] extended the allowed flexibility of classicalvirtual structures, and presented a formation control method fornonholonomic fixed-wing UAVs to enable the formation to turncontinuously and smoothly along the planned curve trajectory.

The shape-constrained method, on the other hand, is prevalent inapplications in games and animations. Anderson et al. proposed atechnique to support individual constraint, group centroid con-straint and flock outline constraint by defining a complex behaviormodel and conducting a time-consuming sampling process [3]. [18]associated a graph with a formation for determining the adjacencyrelationships among individuals, adopted a spectral-based approachto generate the trajectory of each individual, and a social forcesmethod to locally adjust the trajectory. However, the agent dis-tribution of the formation needs to be set manually and exhaus-tively. Xu et al. proposed a shape-constrained flock animationsystem to enforce static and deforming shape constraints on thespatial distribution of a flock [10]. The method used sampling and aspherical projection method to establish correspondences betweenflock members and sample points, and the guided flock migrationby Boids model, but it had to turn to a fuzzy control logic approachfor solving the parameter setting problem. Utilizing sketches asformation constraints, [19,1] introduced a flood-fill algorithm tosample the shape and formation coordinate to maintain theadjacency relationship, and applied HiDAC technique for collisionavoidance, but the intermediate distributions in their results werenot optimal. Ho et al. [20] resolved the problems of global naviga-tion of a flock along a predefined path through an adaptiveformation adjusting process according to the curvature of the givenpath, and an obstacle avoiding force based method which coulddisengage and regroup a crowd so that it can squeeze pass a narrowspace. Later they presented a software library package for softformation control, which handled formation shape deformation bya uniform sampling and a one-to-one mapping process in attemptfor the minimum time [21]. Like animation applications, Alonso-Mora et al. [22] proposed a formation transition method for multi-robot control. CVT, Hungarian algorithm and optimal reciprocalcollision avoidance method are used for optimal positioning,matching and path planning respectively. The paper focuses ongenerating smooth and oscillation-free trajectories of robots whileour method aims at smooth and neat transformations betweenformations.

Aiming at a smooth formation animation as in Fig. 1, this paperpresents a pure geometry framework. It tries to exploit theadvantage of the geometry-based method, and avoid the downsideof conventional shape-constrained methods by introducing CVTsampling and Lloyd based navigation method. In addition, ourmethod relaxes the current virtual structure approaches by usingmorphing technology to achieve a balance between rigid andflexible constraints.

Fig. 1. Formation animation snapshots of a 200-agent crowd deforming from a dolphin to a rabbit and then to a dog. The deformation process is very smooth, orderly andelegant for regulated crowd animation.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276 269

3. Geometry-based framework

3.1. Key idea

Crowd deformation between two shape-constrained forma-tions usually involves four steps: constrained shape generation,layout of agents in shapes, point matching between shapes, and pathplanning in order to avoid collisions with other agents andobstacles. We propose a geometry-based framework, which isdepicted in Fig. 2.

In the step of constrained shape generation, a morphing techni-que is adopted to interpolate a series of intermediate shapes as keyframe boundary constraints between the source and target for-mation, in order to impose process control that ensures a smoothtransition. Note that we do not use the adjacency relationshipgenerated by the morphing algorithm due to its limited capabilityof correspondence preservation [18], but instead we introduce CVTand the Lloyd technique to achieve that purpose.

For layout of agents, rather than existing samplings methodssuch as random sampling, regular sampling and 3D surfacesampling [10,19], we use CVT, for its nature of being an optimalpartition of a given domain and an optimal distribution ofgenerators in the meantime, to determine optimal layouts of theagents. Similar idea is explored in [22] , but our approach isextended for applications in fields of non-uniform density inaddition to those of uniform density.

During the process of point matching between shapes, mess anddisorder arises when the relative positions in agent-pairs are notsustained. Supporting this claim, [18] emphasized that the adja-cency relationships between formations were crucial for achievingboth pleasing regular patterns and artistic expressiveness. Also, toaddress the path planning problem, conventional interpolation aswell as the agent-based method cannot guarantee smooth andstable formation transformations. Inspired by [23], which usedLloyd descent methods for coverage control and coordination ofautonomous robots for distributed sensing, and by [24] whichfurther extended [23] to cover non-convex domains and hetero-geneous mobile sensors, we bring in the Lloyd's method to ensurean accurate point matching algorithm and a CVT-based coverage

path planning algorithm [23] to avoid collision and seek formaximum clearance.

3.2. Shape morphing for smooth transformation

A Shape morphing technique tends to change one geometry intoanother through a seamless transition filled with a series ofsequential shapes. In our framework, these shapes are imposedas the ‘key frame’ constraints, and the variation between twoadjacent shapes can be kept small enough to achieve a smoothtransformation. Here we do not consider the voxels inside but theboundary and surface, that is, we use morphing only to generatethe shape profile. Instead of vertex information, the Lloyd descentmethod is applied in our framework to maintain the correspon-dence between the initial and target state. We adopt the 2Dalgorithm from [25] and the 3D version from [26], both of whichhave good adaptability to both convex and concave shapes. In thispaper, shape morphing is implemented in an off-line manner as apreprocessing procedure. Note that depending on the morphingtechnique used, transformation results may vary. The experimen-tal results demonstrate that given many types of source and targetshapes we can generate a series of key-frame shapes to achievesmooth formation transitions, as depicted in Fig. 1 for a 2Dexample, and Fig. 9 for a 3D one.

In addition, the number of ‘key frame’, i.e. the time intervalbetween two shapes, can be set as desired to achieve multi-resolution results with various smoothness. Fig. 13 can be roughlyseen as an example, where no key frame is included from Fig. 13(a)–(e) while 400 intermediate key frames (only 3 included in thefigure) are interpolated in Fig. 13(g) and (k).

3.3. CVT for optimal layout in formations

Centroidal Voronoi tessellation (CVT) is a special Voronoi tessel-lation in which each point, called site, coincides with the centroidof its Voronoi region, or the cell. Let Ω be a compact region in aN-dimensional space RN , P ¼ fpigni ¼ 1 be n sites in Ω, then aVoronoi cell Vi of a site pi is defined as

Vi ¼ fxAΩ∣Jx�pi Jr Jx�pj J ;

8 ja i; j¼ 1;2;…;ng

where J � J is the Euclidean norm in RN . A Voronoi tessellation orVoronoi diagram of Ω is given by the set fVigni ¼ 1. Then a CVT of Ωcan be formed while

pi ¼RVixρðxÞ dx

RViρðxÞ dx ; i¼ 1;2;…;n ð1Þ

where ρðxÞ is a smooth density function. The Lloyd's method [27]is a simple and stable approach to compute CVT. More effectiveone is L-BFGS based method presented by Liu [28].

Fig. 3 gives several examples of CVT with a constant density fora series of shapes generated by the morphing method from [25].Fig. 4 illustrates two examples with the Gaussian density function,and in Section 4.3 we will further analyze the CVT distribution ona density field. The layout generated by CVT is usually moreoptimal than sampling methods. In addition, the CVT layout

Fig. 2. Geometry based crowd formation animation framework.

Fig. 3. CVT examples on different shapes.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276270

algorithm and Lloyd descent based path planning intrinsicallycooperate very well.

3.4. Lloyd descent for collision-free path planning

3.4.1. Lloyd descent methodAmong a number of CVT computation methods, the most

popular one is the Lloyd descent method [27]. It starts withsampling n sites in the domain and constructing the Voronoitessellation, and then the mass centroid of each Voronoi region iscomputed and each site pi is moved to the centroid. The latter twosteps are repeated until the new set of sites meets the convergencecriterion.

The Lloyd descent method can be viewed as a fixed pointiteration, so it is suitable for path planning. Each agent is relocatedto the centroid of its cell in a strict stepwise manner towardsconvergence, generating paths with built-in collision avoidance,inherent adjacency relationship preservation and optimal layout inkey frame shapes. The trajectories generated by the Lloyd'smethod are illustrated in Figs. 11(f) and 13(l).

For simplicity purpose, the new centroids are updated simul-taneously in a discrete manner in this paper, i.e. all agents startfrom their previous centroids and reach the new ones at that sametime. Although this simplicity may cause dissimilar speed andeven oscillation issues (see attached video), increase of thenumber of key frames can somewhat counterbalance the pro-blems. The path planning process is conducted in an on-linemanner thanks to the fast computation of the Lloyd iteration.

3.4.2. Lloyd descent in variable domainsIn our framework, the navigation between two adjacent shapes

needs to address the discrete changing domain of the Lloyd'smethod. This may happen because the motion of each individual isconstrained by key frame shapes for smoothness purpose, and theLloyd's method needs to be conducted “across” these discreteintermediate domains. It is imperative that the navigation processbe seamless and elaborate since the Lloyd's method fails if agents

cannot move into the next shape, resulting in the failure of thenavigation chain further.

Our solution works in two steps. First, the Lloyd descent motionof each individual is guaranteed to step from the current con-strained shape into the next intermediate one. Second, the domainis then switched to the next constrained shape. These two stepsare repeated until the crowd moves to the target shape. Consider ascenario where between two adjacent constrained shapes,denoted by CðtjÞ and Cðtjþ1Þ, an agent Ai in CðtjÞ is moved to itsnew centroid CenðV ðAiÞÞ of the Voronoi cell VðAiÞ, and suppose thedifference between Cðtjþ1Þ and CðtjÞ is kept small enough bymeans of adding sufficient key frame shapes, the four typicalcases, as shown in Fig. 6(a), are defined as follows:

� P1: AiACðtjÞ \ Cðtjþ1Þ && CenðVðAiÞÞACðtjÞ \ Cðtjþ1Þ� P2: AiACðtjÞ�Cðtjþ1Þ && CenðVðAiÞÞACðtjÞ \ Cðtjþ1Þ� P3: AiACðtjÞ�Cðtjþ1Þ && CenðVðAiÞÞACðtjÞ�Cðtjþ1Þ� P4: AiACðtjÞ \ Cðtjþ1Þ && CenðVðAiÞÞACðtjÞ�Cðtjþ1Þ

In cases P1 and P2, the agent always step into the nextconstrained shape Cðtjþ1Þ. However, in cases P3 and P4, the agentsneed to be cleverly ‘dragged’ into the next constrained shapeCðtjþ1Þ without colliding with each other.

As illustrated in Fig. 6(b) for case P3, the point Pp on innerborders of Cðtjþ1Þ can be found by projecting P3 onto the border ofCðtjþ1Þ with respect to the nearest distance, and we navigate theagent to Pb, which is the intersection point of line P3Pp and theVoronoi borders of P3. Then the Voronoi tessellation is updatedaccording to the new positions of all pi. The above two steps arerepeated until P3 reaches Pp. For P4, we make the agent stay inCðtjþ1Þ by changing its target to the point Pv, which is theintersection of the predefined path from P4 to CenðV ðP4ÞÞ andthe inner border of Cðtjþ1Þ, as demonstrated in Fig. 6(c). With theabove improvements, Lloyd descent is applicable in variabledomains, inheriting the strengths of maximal-clearance and free-of-collision.

4. Extension

4.1. Crowd moving and obstacle avoiding

In practice, a crowd tends to preserve or change its formationwhile moving along a specific path. The motion of agents in such acrowd can be decomposed into two parts, one to move forwardalong the global path and the other to maintain or form a certainformation. In this paper, the global path is set interactively in a 3Ddomain by using a freehand drawing or B-spline. The motion ofthe whole group is implemented by designating a ‘base point’ onthe constrained shape to anchor to the path, and a ‘direction’ todetermine the formation orientation. In the example shown inFig. 7, the base point is specified as the centroid of the formationshape, and the direction is set as the normal direction of theformation and always along the tangent line of the path. Note thatdifferent settings of the base point and direction will generatevarious motion results. Here we do not consider the formationcalibration in accordance with curve curvature as in [20]. Fig. 5

Fig. 4. CVT layout under general two-dimensional elliptical Gaussian densityfunction f ðx; yÞ ¼ e�ðaðx� x0 Þ2 þ2bðx�x0 Þðy�y0 Þþ cðy�y0 Þ2 Þ . (a) Single Gauss function,a¼ b¼ c¼ 20, ðx0; y0Þ is the center of the region. (b) Mixed model with 4 Gaussfunctions, all a¼ c¼ 20, b¼ 0, and their ðx0 ; y0Þ are symmetrical.

Fig. 5. A 40-agent crowd moves along the freehand sketched ‘z’ path while smoothly changing its formation from a circle (a) to a triangle (c) to a square (e) and finallyrestoring to a circle (g).

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276 271

presents an example where a 40-agent crowd moves along ahand-sketched z path while changing its formations, with the basepoint fixed at the center and the direction set as tangent directionof both the formation and the path.

In consideration of the overall formation movement, environ-mental obstacle avoidance is another important aspect thatdeserves to be addressed. Here only static obstacles are consid-ered. Most existing formation animation algorithms deal with theobstacle avoidance problem by a three-step process, formationbreaking up, obstacles avoiding and formation rejoining, and takeno consideration of formation maintenance in the process, such as[20,19].

Aiming at maximum formation maintenance, a geometry-based constraint idea is also explored in this paper. A domainmodification approach is presented to remove the obstacle spacefrom the key frame shapes. First, given a certain number of keyframe shapes generated by the morphing method, and a globalmotion setting that includes a global path, a base point and adirection, we attach the shapes to the global path with equalinternal distance. Then, the shapes are modified on encounteringsome obstacles. Let CðtjÞ be the constrained shape at time tj, andsuppose there are m obstacles at that time, denoted by fOigmi ¼ 1, theproposed domain modification method generates the new keyframe constrained shape C′ðtjÞ asC′ðtjÞ ¼ CðtjÞ� [m

i ¼ 1 Oi

where ‘� ’ and ‘[ ’ are Boolean subtraction and union operation incomputer graphics respectively. Finally, the original constrainedshape CðtjÞ is modified to an obstacle-free domain C′ðtjÞ so that noobstacles need to be taken into account in the later path planningprocess. All these are done automatically in an off-line manner atthe preprocessing stage.

Here we need to be aware of a special problem. When theobstacles are comparatively large to the shapes, they split theformation into a number of parts, resulting in a disconnected C′ðtjÞfrom which several sub-flocks emerge. A distributed framework isutilized to address this issue. Each sub-flock independently per-forms a formation deformation constrained by its sub-shape untilthey are rejoined to reconstruct the whole crowd. By using moreconstrained shapes from the morphing method, the differencebetween adjacent shapes can be as little as that the breaking-up

and rejoining process are smoothed. The resulting formation ofour example in Fig. 14(g)–(l) delivers both smoothness andformation preservation in bypassing a big obstacle.

4.2. 3D domain

Many formation animations, such as bird or fish flocks thatchange formations while flying or swimming, take place in 3Dspaces (note that a crowd of human or animals walking or runningon a flat ground can be treated as a 2D problem). In 3D domains,the source and target formation are given as 3D polyhedrons. Weextend our framework to 3D spaces by adopting the 3D versions ofmorphing, CVT and the Lloyd's method. [26] is selected as themorphing algorithms in 3D space to generate intermediate 3Dformations. For CVT and the Lloyd's method, the centroid of aVoronoi cell, which is a convex polyhedron in 3D spaces, iscomputed by volume integration. The Lloyd based path planningmethod in 3D domains still retains the fixed-point iteration andcollision-free features.

Fig. 8 shows snapshots of 400 agents morphing from a 3D vaseto a cube, and Fig. 9 simulates a crowd of birds landing on theground by deforming the formation from a 3D sphere to a thincube, and includes all the flying trajectories of the whole crowd.

4.3. Density-based formation

The CVT layout is known as an even distribution of a set of sitesin a uniform density domain, yet it can achieve various hetero-geneous layout effects corresponding to non-uniform smoothdensity distributions as well. This feature can be utilized to formdifferent creative formations by designating a density function toeither one or both of the source and target shape, with a slightchange in computations of the centroids for the given densityfunction according to Formula (1). An example is depicted in Fig. 4.Since the Lolyd's method is only associated with centroids anddeals with density-based fields, our framework can be easilyextended to handle density-based formation.

Fig. 10 demonstrates an example in which the target formationis dissected into 9 sub-crowds by using a carefully designeddensity function. As seen in the figure is an uneven formationdistribution, which is appropriate for simulation of natural flocks.

5. Results and analysis

5.1. Implementation and results

We use CGAL 3.5.1 and the exact predicates inexact constructionskernel to compute Voronoi diagrams. OGRE 1.7.4 is used to renderthe animation results.

Shape morphing is implemented according to [25,26] for 2Dand 3D domains in an off-line manner, and we choose to generate400 key frame shapes for each formation transition. CVT layout of

Fig. 6. Lloyd descent between two adjacent shapes. (a) 4 cases. (b) case P3. (c) case P4.

basepoint

direction

Fig. 7. Global motion synthesis of a formation.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276272

the initial formation is computed by the Lloyd's method also in anoff-line manner. These two computations are completed in thepreprocessing stage. Path planning between two adjacent inter-mediate shapes is conducted by the Lloyd's method in real time.Since the key frame shapes generated from the morphing processare very dense, we find in experiments that good motion resultscan be achieved with even only 2 Lloyd iterations betweenneighboring shapes. Several examples will be included here andmore will be included in the supplemental material and theattached video.

In a 2D domainwith a uniform density, Figs. 1, 5, Fig. 11, 12(g)–(l)and Fig. 13(g)–(l) illustrate the smooth deformation processbetween certain challenging formations. As to 3D domain,Figs. 8 and 9 show examples without and with global motionrespectively. Density-based formations are depicted as in Fig. 10,in which nice nonuniform results are produced by using acomplex density field. Figs. 5, 9 and Fig. 14(g)–(l) present examplesof a transforming formation along a global path. An obstacle-avoiding scenario is included in Fig. 14(g)–(l), where the for-mation is maintained very well though the flock is divided intotwo subparts while coming across a relatively big obstacle.Extensive experiments show that the proposed framework isstable to produce smooth, graceful and regular formation anima-tion results.

5.2. Timing analysis

We conduct all above simulations on a PC powered by a2.8 GHz 4-core CPU, a 4 GB memory and an NVIDIA GeForceGTX465 display card. We choose a 2D scenario where a crowd ofhuman changes its formation from a square to a pentagram, and a3D one where a flock of birds flies from a cube to a sphere. There

are 4744 faces in the ‘man’ model and 2218 in the ‘bird’ model.Experiments are conducted with different crowd sizes. The per-formance data are shown in Table 1. From the data we can see thatthe offline morphing computation in both 2D and 3D domain,which generates 400 key frame shapes, is very fast (Column“Morph” in Table 1). The other preprocessing procedure is theCVT layout of the initial shape, which uses 50 Lloyd iterations toconverge to CVT and consumes more time with more agents(Column “CVT” in Table 1). To render animations, we use abrute-force approach without any optimization. With the increaseof the number of agents, the computation and rendering timebecomes significantly longer. We achieve a speed that is sufficientfor interaction purpose in 2D domains with several hundredagents, but the responsiveness in 3D domains suffers. Here weapplied a big number of key frame shapes. Since there is a highpositive correlation between the performance and the number ofkey frame shapes, we can speedup the system by using fewerintermediate shapes. Also, the performance will benefit a lot froman optimal rendering strategy.

5.3. Boundary analysis

In order to analyze the orderliness of the result produced bythe proposed method, we conduct a boundary analysis becausethe position change of the agents on the border can considerablyreflect the correspondence of relative positions of all agents. If theboundary agents remain on or close to the border during thetransition, we can roughly conclude relative positions of all agentsremain steady and the process is fairly orderly because all otheragents stay within the boundary during the transition. Note thatinside agents may come to the boundary since the border line cangrow longer. But if a boundary agent and one inside the boundary

Fig. 8. A 400-agent flock changes its formation, constrained by 3D shapes, from a vase to a cube in a 3D space.

Fig. 9. A group of 20 birds lands on a rectangle on the ground from a sphere formation in the sky. The flying trajectories are outlined in (e).

Fig. 10. The gradual change of a 200-agent circular crowd formation in a constant density field to that in a non-constant one. The density is ρðx; yÞ ¼ jðx2�400Þðy2�400Þjwith the origin at the center of the circle, which is visualized as the background field.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276 273

are swapped, the resulting intersection disrupts the relativeposition correspondence, which should be avoided here for thepurpose of orderliness.

In the example illustrated in Fig. 11, we mark the boundaryagents in red and draw their trajectories. As indicated in the figure,all boundary agents remain on the border during the deformation,

Fig. 11. Transition process from a circle to a dog for boundary analysis. Agents on the border are marked red, and their trajectories are drawn in different colors. We can seethat the transition process is very neat by observing the border agents and their trajectories. (For interpretation of the references to color in this figure caption, the reader isreferred to the web version of this article.)

Fig. 12. Comparison with [1]. A crowd transits from a rectangle to a triangle while moving along a global ‘S’ path. (a)–(f) and (g)–(l) are the results of methods proposed in [1]and this paper respectively. Our result is neater and more organized in the whole transformation process.

Fig. 13. Comparison with RVO. Transition process from a rabbit to a HaiBao (2010 Shanghai World Expo logo) formation. (a)–(f) and (g)–(l) demonstrate the results of RVOand this paper respectively. Trajectories of all agents are drawn in (f) and (l). (a) and (g) are the same which are generated by our framework, as well as (e) and (k). The point-to-point matching between (a) and (e) is also conducted using our framework. We can see (h), (i) and (j) are more neatly distributed than (b), (c) and (d) of RVO, andtrajectories in (l) are more exquisite than in (f).

Fig. 14. Comparison with RVO in the obstacle avoiding scenario. A crowd avoids a big obstacle while deforming from a square to a hexagon. (a)–(f) and (g)–(l) demonstratethe results of RVO and this paper respectively. Similar to Fig. 13, the sampling method of (a) and (g), (f) and (l), and point-to-point matching algorithm between (a) and (f),are both taken from our framework. Our method can maintain formation as much as possible while the counterpart does not give any consideration.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276274

whereas some agents inside the boundary are moved to the bordergenerating a longer border line. Our boundary analysis shows thatthe resulting trajectories exhibits an advantage in correspondencepreservation. More examples are shown in Figs. 9(e) and 13(l), inwhich all trajectories are demonstrated.

5.4. Comparison

First, the comparison between our method and the freestylegroup formation control method from [1] is exemplified by Fig. 12,where a crowd migrates along a global ‘S’ path while deformingfrom a ‘rectangle’ to a ‘triangle’. The comparison shows that ourmethod can generate more orderly and neater results by means ofthe full-flow geometry constraint process, and is more suitable forregulated crowds.

At the same time, a traditional crowd simulation method iscompared with the proposed framework to demonstrate theirdifference in processing regulated crowds. We select RVO (Reci-procal Velocity Obstacles) [29], a stable and representative model,to navigate crowd formation transitions, while the sampling andpoint-to-point matching process of the starting and target forma-tions are still conducted by our framework to provide the initialand destination positions in the shape for each agent. It can beclearly seen in Fig. 13 that the result generated by RVO, whichfocuses on optimal path planning without considering smooth-ness, shows poor organization. This can be further clarified by acareful observation of the contrast between Fig. 13(f) and (l),where trajectories of RVO tend to be straight but those of ourmethod, which seeks for neatness, are roundabout.

In addition, a comparison with RVO is performed in anobstacle-avoiding scenario, under which the crowd is split by abig obstacle. The difference is illustrated in Fig. 14. Note that thesampling and point-to-point matching algorithms are also takenfrom our framework. The difference demonstrated in the resultssuggests that our approach outperforms the RVO method inmaintaining formation during the movement.

6. Conclusion

In this paper, we have presented a pure geometry-basedframework by utilizing several methods: shape morphing, CVTsampling, the Lloyd based navigation and domain modificationmethod. Our method can generate stable, smooth, orderly, regularand elegant crowd formation animations both in 2D and 3Dspaces.

Our future extensions include complex formations with hetero-geneous distribution of agents by using capacity-constrained CVTmethod, and dynamic environmental obstacle avoidance byexploring geometry-based ideas. We will use the control theoryto optimize the navigation between two key frame shapes to

achieve a better smoothness. It is also an interesting directionto apply the proposed approach to actual robot formation controlin an asynchronous and decentralized manner.

Acknowledgment

This work was supported by National Natural Science Funds ofChina (Grant no. 61300118).

Appendix A. Supplementary materials

Supplementary data associated with this article can be found inthe online version at http://dx.doi.org/10.1016/j.cag.2013.10.035.

References

[1] Gu Q, Deng Z. Generating freestyle group formations in agent-based crowdsimulations. IEEE Comput Graph Appl 2013;33(1):20–31.

[2] Berman SM. Abstractions, analysis techniques, and synthesis of scalablecontrol strategies for robot swarms. Dissertations of University ofPennsylvania.

[3] Anderson M, McDaniel E, Chenney S. Constrained animation of flocks. In:Proceedings of the 2003 ACM SIGGRAPH/eurographics symposium on com-puter animation; 2003. p. 286–97.

[4] Chang J-Y, Li T-Y. Simulating virtual crowd with fuzzy logics and motionplanning for shape template. In: Proceedings of 2008 IEEE conference oncybernetics and intelligent systems; 2008. p. 131–36.

[5] Tanner HG, Pappas GJ, Kumar V. Leader-to-formation stability. IEEE TransRobot Autom 2003;20(3):443–55.

[6] Spry S, Hedrick J. Formation control using generalized coordinates. In: 43rd IEEEconference on decision and control, 2004 (CDC), vol. 3; 2004. p. 2441–446.

[7] Bajec IL, Zimic N, Mraz M. Simulating flocks on the wing: the fuzzy approach.J Theor Biol 2005;233(2):199–220.

[8] Mehrjerdi H, Ghommam J, Saad M. Nonlinear coordination control for a groupof mobile robots using a virtual structure. Mechatronics 2011;21(7):1147–55.

[9] Low CB, Ng QS. A flexible virtual structure formation keeping control for fixed-wing uavs. In: 9th IEEE international conference on control and automation(ICCA); 2011. p. 621–26.

[10] Xu J, Jin X, Yu Y, Shen T, Zhou M. Shape-constrained flock animation. ComputAnim Virtual Worlds (CASA'2008 Spec Issue) 2009;19(3–4):319–30.

[11] Schuerman M, Singh S, Kapadia M, Faloutsos P. Situation agents: agent-basedexternalized steering logic. Comput Anim Virtual Worlds 2010;21(3–4):267–76.

[12] Klotsman M, Tal A. Animation of flocks flying in line formations. Artif Life2012;18(1):91–105.

[13] Henry J, Shum HP, Komura T. Environment-aware real-time crowd control. In:Proceedings of the 11th ACM SIGGRAPH/Eurographics conference on compu-ter animation. Eurographics Association; 2012. p. 193–200.

[14] Krontiris A, Louis S, Bekris KE. Simulating formations of non-holonomicsystems with control limits along curvilinear coordinates. In: Internationalconference on motion in games 2010, lecture notes on computer science 6459;2010. p. 121–33.

[15] Li NHM, Liu HHT. Formation of UAV flight control using virtual structure andmotion synchronization. In: Proceedings of American control conference;2008. p. 1782–787.

[16] Sadowska A, Huijberts H, Kosti'c D. Formation control of unicycle robots usingthe virtual structure approach. In: 15th international conference on advancedrobotics; 2011. p. 365–70.

[17] van den Broek T., van de Wouw N., Nijmeijer H. Formation control of unicyclemobile robots: a virtual structure approach. In: IEEE conference on decisionand control; 2009. p. 8328–333.

[18] Takahashi S, Yoshida K, Kwon T, Lee KH, Lee J, Shin SY. Spectral-based groupformation control. Comput Graph Forum (EUROGRAPHICS 2009) 2009;28(2):639–48.

[19] Gu Q, Deng Z. Formation sketching: an approach to stylize groups in crowdsimulation. In: Proceedings of the graphics interface (GI); 2011. p. 1–8.

[20] Ho C, Nguyen Q, Ong Y-S, Chen X. Autonomous multi-agents in flexible flockformation. Mot. Games 2010:375–85.

[21] Ho CS, Ong Y-S, Chen X, Tan A-H. Fame, soft flock formation control forcollective behavior studies and rapid games development. In: Simulatedevolution and learning, vol. 7673 of Lecture notes on computer science;2012. p. 258–69.

[22] Alonso-Mora J, Breitenmoser A, Rufli M, Siegwart R, Beardsley P. Multi-robotsystem for artistic pattern formation. In: 2011 IEEE international conferenceon robotics and automation (ICRA), IEEE; 2011. p. 4512–517.

[23] Cortes J, Martinez S, Karatas T, Bullo F. Coverage control for mobile sensingnetworks. IEEE Trans Robot Autom 2004;20(2):243–55.

[24] Pimenta LCA, Kumar V, Mesquita RC, Pereira GAS. Sensing and coverage for anetwork of heterogeneous robots. In: IEEE conference on decision and control;2008. p. 3947–952.

Table 1System performance of 2D and 3D scenarios.

Domain Crowd size Model Preprocess (ms) Average

Morph CVT FPS

2D 50 Man 0.9 282.6 57.72D 100 Man 446.3 34.92D 1000 Man 1671.0 5.72D 5000 Man 4417.4 1.2

3D 50 Bird 249.7 796.4 10.53D 100 Bird 1669.6 5.23D 1000 Bird 12065.1 0.63D 5000 Bird 50075.7 0.2

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276 275

[25] Sederberg TW, Gao P, Wang G, Mu H. 2d shape blending: an intrinsic solutionto the vertex path problem. In: Proceedings of SIGGRAPH 93; 1993. p. 15–8.

[26] Kent JR, Carlson WE, Parent RE. Shape transformation for polyhedral objects.In: SIGGRAPH '92; 1992. p. 47–4.

[27] Lloyd S. Least squares quantization in PCM. IEEE Trans Inf Theory 1982;28(2):129–37.

[28] Liu Y, Wang W, Lévy B, Sun F, Yan D-M, Lu L, et al. On centroidal Voronoitessellationłenergy smoothness and fast computation. ACM Trans Graph (ToG)2009;28(4):101.

[29] van den Berg J, Lin M, Manocha D. Reciprocal velocity obstacles for real-timemulti-agent navigation. In: IEEE international conference on robotics andautomation; 2008. p. 1928–935.

L. Zheng et al. / Computers & Graphics 38 (2014) 268–276276