You are on page 1of 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
a r t i c l e i n f o
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
a b s t r a c t
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: leepyzh@gmail.com, zhenglp@hfut.edu.cn (L. Zheng).
Computers & Graphics 38 (2014) 268276
conjunction with behavior based methods for collision avoidance
[12], or with control theories for adaptive navigation [13], raising
robustness and disorder problems. The proposed approach inher-
its the advantages of the geometry-based method, overcomes the
shortcomings of conventional shape-constrained methods and
extends the current virtual structure approaches to achieve a
tradeoff between rigid and exible constraints. The result, shown
in Fig. 1 as an example, exhibits a smooth, orderly and regular
transition and proves the potential of our method in applications
in many domains such as games, movie animations and massive
sport design.
There are, however, some limitations. First, our method is
restricted to agents in regulated crowds in which they form
particular formations under certain constraints. Unlike general
crowds where agents are autonomous and intelligent to choose
paths , individuals in regulated crowds are tightly constrained by
the intermediate shapes and navigated by Lloyd descent directions
to generate regular and orderly results. Also, as a side effect to
achieve an exactly optimal and homogeneous distribution, the
results of our method may look somewhat articial for real-world
crowd animations. Perturbations can be introduced to relieve such
an issue by, for instance, composing a density eld as shown in
Fig. 10, as well as using a capacity-constrained CVT method.
2. Related work
In contrast to the general crowd simulation, formation control
emphasizes on spatial, temporal and correspondence constraints
to assure the crowd's conformity to a predetermined formation.
According to [14], conventional formation control approaches can
be roughly categorized as the behavior based approach [4,12], the
leader-follower approach [5], the generalized coordinates method [6],
the geometry-based method [8,9], etc. The method proposed in this
paper is classied as a descendant of the geometry based method,
which can be further divided into the virtual structure approach
and the shape-constrained method depending on the research
domain.
In the domain of mobile robots control, the virtual structure
approach is applied to formation control for AGVs (Automated
Guided Vehicles), UAVs (Unmanned Aerial Vehicles), and AUVs
(Autonomous Underwater Vehicles). In order to improve control
performance and efciency, the virtual structure approach has
been utilized to maintain UAV formation with synchronous tech-
nology to keep the relative position tracking motion of the
aircrafts [15]. [8] proposed a combination of the Lyapunov tech-
nique and graph theory embedded in the virtual structure. In this
way, the knowledge derived by localization of the robots in the
group allowed for efcient coordination and trajectory following,
which could then create useful robot formations. Sadowska et al.
[16] presented a distributed unicycle formation control algorithm
based on the virtual structure approach from [17]. The advantages
of their algorithm reside in that for each robot only its neighbors
were needed to be contacted and then a simple linear formation
control feedback mechanism was introduced. The virtual structure
can also be exible. [9] extended the allowed exibility of classical
virtual structures, and presented a formation control method for
nonholonomic xed-wing UAVs to enable the formation to turn
continuously and smoothly along the planned curve trajectory.
The shape-constrained method, on the other hand, is prevalent in
applications in games and animations. Anderson et al. proposed a
technique to support individual constraint, group centroid con-
straint and ock outline constraint by dening a complex behavior
model and conducting a time-consuming sampling process [3]. [18]
associated a graph with a formation for determining the adjacency
relationships among individuals, adopted a spectral-based approach
to generate the trajectory of each individual, and a social forces
method 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 ock animation
system to enforce static and deforming shape constraints on the
spatial distribution of a ock [10]. The method used sampling and a
spherical projection method to establish correspondences between
ock members and sample points, and the guided ock migration
by Boids model, but it had to turn to a fuzzy control logic approach
for solving the parameter setting problem. Utilizing sketches as
formation constraints, [19,1] introduced a ood-ll algorithm to
sample the shape and formation coordinate to maintain the
adjacency relationship, and applied HiDAC technique for collision
avoidance, but the intermediate distributions in their results were
not optimal. Ho et al. [20] resolved the problems of global naviga-
tion of a ock along a predened path through an adaptive
formation adjusting process according to the curvature of the given
path, and an obstacle avoiding force based method which could
disengage and regroup a crowd so that it can squeeze pass a narrow
space. Later they presented a software library package for soft
formation control, which handled formation shape deformation by
a uniform sampling and a one-to-one mapping process in attempt
for 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 reciprocal
collision avoidance method are used for optimal positioning,
matching and path planning respectively. The paper focuses on
generating smooth and oscillation-free trajectories of robots while
our method aims at smooth and neat transformations between
formations.
Aiming at a smooth formation animation as in Fig. 1, this paper
presents a pure geometry framework. It tries to exploit the
advantage of the geometry-based method, and avoid the downside
of conventional shape-constrained methods by introducing CVT
sampling and Lloyd based navigation method. In addition, our
method relaxes the current virtual structure approaches by using
morphing technology to achieve a balance between rigid and
exible 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 and
elegant for regulated crowd animation.
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 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 path
planning in order to avoid collisions with other agents and
obstacles. We propose a geometry-based framework, which is
depicted in Fig. 2.
In the step of constrained shape generation, a morphing techni-
que is adopted to interpolate a series of intermediate shapes as key
frame boundary constraints between the source and target for-
mation, in order to impose process control that ensures a smooth
transition. Note that we do not use the adjacency relationship
generated by the morphing algorithm due to its limited capability
of correspondence preservation [18], but instead we introduce CVT
and the Lloyd technique to achieve that purpose.
For layout of agents, rather than existing samplings methods
such as random sampling, regular sampling and 3D surface
sampling [10,19], we use CVT, for its nature of being an optimal
partition of a given domain and an optimal distribution of
generators in the meantime, to determine optimal layouts of the
agents. Similar idea is explored in [22] , but our approach is
extended for applications in elds of non-uniform density in
addition to those of uniform density.
During the process of point matching between shapes, mess and
disorder arises when the relative positions in agent-pairs are not
sustained. Supporting this claim, [18] emphasized that the adja-
cency relationships between formations were crucial for achieving
both pleasing regular patterns and artistic expressiveness. Also, to
address the path planning problem, conventional interpolation as
well as the agent-based method cannot guarantee smooth and
stable formation transformations. Inspired by [23], which used
Lloyd descent methods for coverage control and coordination of
autonomous robots for distributed sensing, and by [24] which
further extended [23] to cover non-convex domains and hetero-
geneous mobile sensors, we bring in the Lloyd's method to ensure
an accurate point matching algorithm and a CVT-based coverage
path planning algorithm [23] to avoid collision and seek for
maximum clearance.
3.2. Shape morphing for smooth transformation
A Shape morphing technique tends to change one geometry into
another through a seamless transition lled with a series of
sequential shapes. In our framework, these shapes are imposed
as the key frame constraints, and the variation between two
adjacent shapes can be kept small enough to achieve a smooth
transformation. Here we do not consider the voxels inside but the
boundary and surface, that is, we use morphing only to generate
the shape prole. Instead of vertex information, the Lloyd descent
method is applied in our framework to maintain the correspon-
dence between the initial and target state. We adopt the 2D
algorithm from [25] and the 3D version from [26], both of which
have good adaptability to both convex and concave shapes. In this
paper, shape morphing is implemented in an off-line manner as a
preprocessing procedure. Note that depending on the morphing
technique used, transformation results may vary. The experimen-
tal results demonstrate that given many types of source and target
shapes we can generate a series of key-frame shapes to achieve
smooth formation transitions, as depicted in Fig. 1 for a 2D
example, and Fig. 9 for a 3D one.
In addition, the number of key frame, i.e. the time interval
between two shapes, can be set as desired to achieve multi-
resolution results with various smoothness. Fig. 13 can be roughly
seen as an example, where no key frame is included from Fig. 13
(a)(e) while 400 intermediate key frames (only 3 included in the
gure) 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 centroid
of its Voronoi region, or the cell. Let be a compact region in a
N-dimensional space R
N
, P fp
i
g
n
i 1
be n sites in , then a
Voronoi cell V
i
of a site p
i
is dened as
V
i
fxA Jxp
i
J rJxp
j
J;
8j ai; j 1; 2; ; ng
where J J is the Euclidean norm in R
N
. A Voronoi tessellation or
Voronoi diagram of is given by the set fV
i
g
n
i 1
. Then a CVT of
can be formed while
p
i

R
V
i
xx dx
R
V
i
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 effective
one is L-BFGS based method presented by Liu [28].
Fig. 3 gives several examples of CVT with a constant density for
a 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 on
a density eld. The layout generated by CVT is usually more
optimal 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) 268276 270
algorithm and Lloyd descent based path planning intrinsically
cooperate very well.
3.4. Lloyd descent for collision-free path planning
3.4.1. Lloyd descent method
Among a number of CVT computation methods, the most
popular one is the Lloyd descent method [27]. It starts with
sampling n sites in the domain and constructing the Voronoi
tessellation, and then the mass centroid of each Voronoi region is
computed and each site p
i
is moved to the centroid. The latter two
steps are repeated until the newset of sites meets the convergence
criterion.
The Lloyd descent method can be viewed as a xed point
iteration, so it is suitable for path planning. Each agent is relocated
to the centroid of its cell in a strict stepwise manner towards
convergence, generating paths with built-in collision avoidance,
inherent adjacency relationship preservation and optimal layout in
key frame shapes. The trajectories generated by the Lloyd's
method 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 start
from their previous centroids and reach the new ones at that same
time. Although this simplicity may cause dissimilar speed and
even oscillation issues (see attached video), increase of the
number of key frames can somewhat counterbalance the pro-
blems. The path planning process is conducted in an on-line
manner thanks to the fast computation of the Lloyd iteration.
3.4.2. Lloyd descent in variable domains
In our framework, the navigation between two adjacent shapes
needs to address the discrete changing domain of the Lloyd's
method. This may happen because the motion of each individual is
constrained by key frame shapes for smoothness purpose, and the
Lloyd's method needs to be conducted across these discrete
intermediate domains. It is imperative that the navigation process
be seamless and elaborate since the Lloyd's method fails if agents
cannot move into the next shape, resulting in the failure of the
navigation chain further.
Our solution works in two steps. First, the Lloyd descent motion
of each individual is guaranteed to step from the current con-
strained shape into the next intermediate one. Second, the domain
is then switched to the next constrained shape. These two steps
are repeated until the crowd moves to the target shape. Consider a
scenario where between two adjacent constrained shapes,
denoted by Ct
j
and Ct
j 1
, an agent A
i
in Ct
j
is moved to its
new centroid CenVA
i
of the Voronoi cell VA
i
, and suppose the
difference between Ct
j 1
and Ct
j
is kept small enough by
means of adding sufcient key frame shapes, the four typical
cases, as shown in Fig. 6(a), are dened as follows:

P1: A
i
ACt
j
\ Ct
j 1
&& CenVA
i
ACt
j
\ Ct
j 1

P2: A
i
ACt
j
Ct
j 1
&& CenVA
i
ACt
j
\ Ct
j 1

P3: A
i
ACt
j
Ct
j 1
&& CenVA
i
ACt
j
Ct
j 1

P4: A
i
ACt
j
\ Ct
j 1
&& CenVA
i
ACt
j
Ct
j 1

In cases P1 and P2, the agent always step into the next
constrained shape Ct
j 1
. However, in cases P3 and P4, the agents
need to be cleverly dragged into the next constrained shape
Ct
j 1
without colliding with each other.
As illustrated in Fig. 6(b) for case P3, the point P
p
on inner
borders of Ct
j 1
can be found by projecting P3 onto the border of
Ct
j 1
with respect to the nearest distance, and we navigate the
agent to P
b
, which is the intersection point of line P3P
p
and the
Voronoi borders of P3. Then the Voronoi tessellation is updated
according to the new positions of all p
i
. The above two steps are
repeated until P3 reaches P
p
. For P4, we make the agent stay in
Ct
j 1
by changing its target to the point P
v
, which is the
intersection of the predened path from P4 to CenVP4 and
the inner border of Ct
j 1
, as demonstrated in Fig. 6(c). With the
above improvements, Lloyd descent is applicable in variable
domains, 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 formation
while moving along a specic path. The motion of agents in such a
crowd can be decomposed into two parts, one to move forward
along the global path and the other to maintain or form a certain
formation. In this paper, the global path is set interactively in a 3D
domain by using a freehand drawing or B-spline. The motion of
the whole group is implemented by designating a base point on
the constrained shape to anchor to the path, and a direction to
determine the formation orientation. In the example shown in
Fig. 7, the base point is specied as the centroid of the formation
shape, and the direction is set as the normal direction of the
formation and always along the tangent line of the path. Note that
different settings of the base point and direction will generate
various motion results. Here we do not consider the formation
calibration in accordance with curve curvature as in [20]. Fig. 5
Fig. 4. CVT layout under general two-dimensional elliptical Gaussian density
function f x; y e
axx0
2
2bxx0yy
0
cyy
0

. (a) Single Gauss function,


a b c 20, x
0
; y
0
is the center of the region. (b) Mixed model with 4 Gauss
functions, all a c 20, b 0, and their x
0
; y
0
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 nally
restoring to a circle (g).
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 271
presents an example where a 40-agent crowd moves along a
hand-sketched z path while changing its formations, with the base
point xed at the center and the direction set as tangent direction
of both the formation and the path.
In consideration of the overall formation movement, environ-
mental obstacle avoidance is another important aspect that
deserves to be addressed. Here only static obstacles are consid-
ered. Most existing formation animation algorithms deal with the
obstacle avoidance problem by a three-step process, formation
breaking up, obstacles avoiding and formation rejoining, and take
no 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 domain
modication approach is presented to remove the obstacle space
from the key frame shapes. First, given a certain number of key
frame shapes generated by the morphing method, and a global
motion setting that includes a global path, a base point and a
direction, we attach the shapes to the global path with equal
internal distance. Then, the shapes are modied on encountering
some obstacles. Let Ct
j
be the constrained shape at time t
j
, and
suppose there are m obstacles at that time, denoted by fO
i
g
m
i 1
, the
proposed domain modication method generates the new key
frame constrained shape Ct
j
as
Ct
j
Ct
j
[
m
i 1
O
i
where and [ are Boolean subtraction and union operation in
computer graphics respectively. Finally, the original constrained
shape Ct
j
is modied to an obstacle-free domain Ct
j
so that no
obstacles need to be taken into account in the later path planning
process. All these are done automatically in an off-line manner at
the preprocessing stage.
Here we need to be aware of a special problem. When the
obstacles are comparatively large to the shapes, they split the
formation into a number of parts, resulting in a disconnected Ct
j

from which several sub-ocks emerge. A distributed framework is


utilized to address this issue. Each sub-ock independently per-
forms a formation deformation constrained by its sub-shape until
they are rejoined to reconstruct the whole crowd. By using more
constrained shapes from the morphing method, the difference
between adjacent shapes can be as little as that the breaking-up
and rejoining process are smoothed. The resulting formation of
our example in Fig. 14(g)(l) delivers both smoothness and
formation preservation in bypassing a big obstacle.
4.2. 3D domain
Many formation animations, such as bird or sh ocks that
change formations while ying or swimming, take place in 3D
spaces (note that a crowd of human or animals walking or running
on a at ground can be treated as a 2D problem). In 3D domains,
the source and target formation are given as 3D polyhedrons. We
extend our framework to 3D spaces by adopting the 3D versions of
morphing, CVT and the Lloyd's method. [26] is selected as the
morphing algorithms in 3D space to generate intermediate 3D
formations. For CVT and the Lloyd's method, the centroid of a
Voronoi cell, which is a convex polyhedron in 3D spaces, is
computed by volume integration. The Lloyd based path planning
method in 3D domains still retains the xed-point iteration and
collision-free features.
Fig. 8 shows snapshots of 400 agents morphing from a 3D vase
to a cube, and Fig. 9 simulates a crowd of birds landing on the
ground by deforming the formation from a 3D sphere to a thin
cube, and includes all the ying trajectories of the whole crowd.
4.3. Density-based formation
The CVT layout is known as an even distribution of a set of sites
in a uniform density domain, yet it can achieve various hetero-
geneous layout effects corresponding to non-uniform smooth
density distributions as well. This feature can be utilized to form
different creative formations by designating a density function to
either one or both of the source and target shape, with a slight
change in computations of the centroids for the given density
function according to Formula (1). An example is depicted in Fig. 4.
Since the Lolyd's method is only associated with centroids and
deals with density-based elds, our framework can be easily
extended to handle density-based formation.
Fig. 10 demonstrates an example in which the target formation
is dissected into 9 sub-crowds by using a carefully designed
density function. As seen in the gure is an uneven formation
distribution, which is appropriate for simulation of natural ocks.
5. Results and analysis
5.1. Implementation and results
We use CGAL 3.5.1 and the exact predicates inexact constructions
kernel to compute Voronoi diagrams. OGRE 1.7.4 is used to render
the animation results.
Shape morphing is implemented according to [25,26] for 2D
and 3D domains in an off-line manner, and we choose to generate
400 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.
base
point
direction
Fig. 7. Global motion synthesis of a formation.
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 272
the initial formation is computed by the Lloyd's method also in an
off-line manner. These two computations are completed in the
preprocessing 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 process
are very dense, we nd in experiments that good motion results
can be achieved with even only 2 Lloyd iterations between
neighboring shapes. Several examples will be included here and
more will be included in the supplemental material and the
attached video.
In a 2D domain with a uniformdensity, Figs. 1, 5, Fig. 11, 12(g)(l)
and Fig. 13(g)(l) illustrate the smooth deformation process
between certain challenging formations. As to 3D domain,
Figs. 8 and 9 show examples without and with global motion
respectively. Density-based formations are depicted as in Fig. 10,
in which nice nonuniform results are produced by using a
complex density eld. Figs. 5, 9 and Fig. 14(g)(l) present examples
of 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 ock is divided into
two subparts while coming across a relatively big obstacle.
Extensive experiments show that the proposed framework is
stable to produce smooth, graceful and regular formation anima-
tion results.
5.2. Timing analysis
We conduct all above simulations on a PC powered by a
2.8 GHz 4-core CPU, a 4 GB memory and an NVIDIA GeForce
GTX465 display card. We choose a 2D scenario where a crowd of
human changes its formation from a square to a pentagram, and a
3D one where a ock of birds ies 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 that
the ofine 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 the
CVT layout of the initial shape, which uses 50 Lloyd iterations to
converge to CVT and consumes more time with more agents
(Column CVT in Table 1). To render animations, we use a
brute-force approach without any optimization. With the increase
of the number of agents, the computation and rendering time
becomes signicantly longer. We achieve a speed that is sufcient
for interaction purpose in 2D domains with several hundred
agents, but the responsiveness in 3D domains suffers. Here we
applied a big number of key frame shapes. Since there is a high
positive correlation between the performance and the number of
key frame shapes, we can speedup the system by using fewer
intermediate shapes. Also, the performance will benet a lot from
an optimal rendering strategy.
5.3. Boundary analysis
In order to analyze the orderliness of the result produced by
the proposed method, we conduct a boundary analysis because
the position change of the agents on the border can considerably
reect the correspondence of relative positions of all agents. If the
boundary agents remain on or close to the border during the
transition, we can roughly conclude relative positions of all agents
remain steady and the process is fairly orderly because all other
agents stay within the boundary during the transition. Note that
inside agents may come to the boundary since the border line can
grow longer. But if a boundary agent and one inside the boundary
Fig. 8. A 400-agent ock 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 ying trajectories are outlined in (e).
Fig. 10. The gradual change of a 200-agent circular crowd formation in a constant density eld to that in a non-constant one. The density is x; y jx
2
400y
2
400j
with the origin at the center of the circle, which is visualized as the background eld.
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 273
are swapped, the resulting intersection disrupts the relative
position correspondence, which should be avoided here for the
purpose of orderliness.
In the example illustrated in Fig. 11, we mark the boundary
agents in red and draw their trajectories. As indicated in the gure,
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 see
that the transition process is very neat by observing the border agents and their trajectories. (For interpretation of the references to color in this gure caption, the reader is
referred 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 RVO
and 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, and
trajectories 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) demonstrate
the 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) 268276 274
whereas some agents inside the boundary are moved to the border
generating a longer border line. Our boundary analysis shows that
the resulting trajectories exhibits an advantage in correspondence
preservation. More examples are shown in Figs. 9(e) and 13(l), in
which all trajectories are demonstrated.
5.4. Comparison
First, the comparison between our method and the freestyle
group formation control method from [1] is exemplied by Fig. 12,
where a crowd migrates along a global S path while deforming
from a rectangle to a triangle. The comparison shows that our
method can generate more orderly and neater results by means of
the full-ow geometry constraint process, and is more suitable for
regulated crowds.
At the same time, a traditional crowd simulation method is
compared with the proposed framework to demonstrate their
difference 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 and
point-to-point matching process of the starting and target forma-
tions are still conducted by our framework to provide the initial
and destination positions in the shape for each agent. It can be
clearly seen in Fig. 13 that the result generated by RVO, which
focuses on optimal path planning without considering smooth-
ness, shows poor organization. This can be further claried by a
careful observation of the contrast between Fig. 13(f) and (l),
where trajectories of RVO tend to be straight but those of our
method, which seeks for neatness, are roundabout.
In addition, a comparison with RVO is performed in an
obstacle-avoiding scenario, under which the crowd is split by a
big obstacle. The difference is illustrated in Fig. 14. Note that the
sampling and point-to-point matching algorithms are also taken
from our framework. The difference demonstrated in the results
suggests that our approach outperforms the RVO method in
maintaining formation during the movement.
6. Conclusion
In this paper, we have presented a pure geometry-based
framework by utilizing several methods: shape morphing, CVT
sampling, the Lloyd based navigation and domain modication
method. Our method can generate stable, smooth, orderly, regular
and elegant crowd formation animations both in 2D and 3D
spaces.
Our future extensions include complex formations with hetero-
geneous distribution of agents by using capacity-constrained CVT
method, and dynamic environmental obstacle avoidance by
exploring geometry-based ideas. We will use the control theory
to optimize the navigation between two key frame shapes to
achieve a better smoothness. It is also an interesting direction
to apply the proposed approach to actual robot formation control
in an asynchronous and decentralized manner.
Acknowledgment
This work was supported by National Natural Science Funds of
China (Grant no. 61300118).
Appendix A. Supplementary materials
Supplementary data associated with this article can be found in
the 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 crowd
simulations. IEEE Comput Graph Appl 2013;33(1):2031.
[2] Berman SM. Abstractions, analysis techniques, and synthesis of scalable
control strategies for robot swarms. Dissertations of University of
Pennsylvania.
[3] Anderson M, McDaniel E, Chenney S. Constrained animation of ocks. In:
Proceedings of the 2003 ACM SIGGRAPH/eurographics symposium on com-
puter animation; 2003. p. 28697.
[4] Chang J-Y, Li T-Y. Simulating virtual crowd with fuzzy logics and motion
planning for shape template. In: Proceedings of 2008 IEEE conference on
cybernetics and intelligent systems; 2008. p. 13136.
[5] Tanner HG, Pappas GJ, Kumar V. Leader-to-formation stability. IEEE Trans
Robot Autom 2003;20(3):44355.
[6] Spry S, Hedrick J. Formation control using generalized coordinates. In: 43rd IEEE
conference on decision and control, 2004 (CDC), vol. 3; 2004. p. 2441446.
[7] Bajec IL, Zimic N, Mraz M. Simulating ocks on the wing: the fuzzy approach.
J Theor Biol 2005;233(2):199220.
[8] Mehrjerdi H, Ghommam J, Saad M. Nonlinear coordination control for a group
of mobile robots using a virtual structure. Mechatronics 2011;21(7):114755.
[9] Low CB, Ng QS. A exible virtual structure formation keeping control for xed-
wing uavs. In: 9th IEEE international conference on control and automation
(ICCA); 2011. p. 62126.
[10] Xu J, Jin X, Yu Y, Shen T, Zhou M. Shape-constrained ock animation. Comput
Anim Virtual Worlds (CASA'2008 Spec Issue) 2009;19(34):31930.
[11] Schuerman M, Singh S, Kapadia M, Faloutsos P. Situation agents: agent-based
externalized steering logic. Comput Anim Virtual Worlds 2010;21(34):26776.
[12] Klotsman M, Tal A. Animation of ocks ying in line formations. Artif Life
2012;18(1):91105.
[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. 193200.
[14] Krontiris A, Louis S, Bekris KE. Simulating formations of non-holonomic
systems with control limits along curvilinear coordinates. In: International
conference on motion in games 2010, lecture notes on computer science 6459;
2010. p. 12133.
[15] Li NHM, Liu HHT. Formation of UAV ight control using virtual structure and
motion synchronization. In: Proceedings of American control conference;
2008. p. 1782787.
[16] Sadowska A, Huijberts H, Kosti'c D. Formation control of unicycle robots using
the virtual structure approach. In: 15th international conference on advanced
robotics; 2011. p. 36570.
[17] van den Broek T., van de Wouw N., Nijmeijer H. Formation control of unicycle
mobile robots: a virtual structure approach. In: IEEE conference on decision
and control; 2009. p. 8328333.
[18] Takahashi S, Yoshida K, Kwon T, Lee KH, Lee J, Shin SY. Spectral-based group
formation control. Comput Graph Forum (EUROGRAPHICS 2009) 2009;28
(2):63948.
[19] Gu Q, Deng Z. Formation sketching: an approach to stylize groups in crowd
simulation. In: Proceedings of the graphics interface (GI); 2011. p. 18.
[20] Ho C, Nguyen Q, Ong Y-S, Chen X. Autonomous multi-agents in exible ock
formation. Mot. Games 2010:37585.
[21] Ho CS, Ong Y-S, Chen X, Tan A-H. Fame, soft ock formation control for
collective behavior studies and rapid games development. In: Simulated
evolution and learning, vol. 7673 of Lecture notes on computer science;
2012. p. 25869.
[22] Alonso-Mora J, Breitenmoser A, Rui M, Siegwart R, Beardsley P. Multi-robot
system for artistic pattern formation. In: 2011 IEEE international conference
on robotics and automation (ICRA), IEEE; 2011. p. 4512517.
[23] Cortes J, Martinez S, Karatas T, Bullo F. Coverage control for mobile sensing
networks. IEEE Trans Robot Autom 2004;20(2):24355.
[24] Pimenta LCA, Kumar V, Mesquita RC, Pereira GAS. Sensing and coverage for a
network of heterogeneous robots. In: IEEE conference on decision and control;
2008. p. 3947952.
Table 1
System performance of 2D and 3D scenarios.
Domain Crowd size Model Preprocess (ms) Average
Morph CVT FPS
2D 50 Man 0.9 282.6 57.7
2D 100 Man 446.3 34.9
2D 1000 Man 1671.0 5.7
2D 5000 Man 4417.4 1.2
3D 50 Bird 249.7 796.4 10.5
3D 100 Bird 1669.6 5.2
3D 1000 Bird 12065.1 0.6
3D 5000 Bird 50075.7 0.2
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 275
[25] Sederberg TW, Gao P, Wang G, Mu H. 2d shape blending: an intrinsic solution
to the vertex path problem. In: Proceedings of SIGGRAPH 93; 1993. p. 158.
[26] Kent JR, Carlson WE, Parent RE. Shape transformation for polyhedral objects.
In: SIGGRAPH '92; 1992. p. 474.
[27] Lloyd S. Least squares quantization in PCM. IEEE Trans Inf Theory 1982;28
(2):12937.
[28] Liu Y, Wang W, Lvy B, Sun F, Yan D-M, Lu L, et al. On centroidal Voronoi
tessellationenergy 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-time
multi-agent navigation. In: IEEE international conference on robotics and
automation; 2008. p. 1928935.
L. Zheng et al. / Computers & Graphics 38 (2014) 268276 276

You might also like