420 likes | 575 Views
Crowd Simulations. Sashi Kumar Penta Robotics – Class Presentation. Overview. Motivation Background Behavior Planning for Character Animation , Kuffner et.al, Symposium on Computer Animation 2005 Continuum Crowds , Adrein et.al, SIGGRAPH 2006 Summary. Motivation.
E N D
Crowd Simulations Sashi Kumar Penta Robotics – Class Presentation
Overview • Motivation • Background • Behavior Planning for Character Animation, Kuffner et.al, Symposium on Computer Animation 2005 • Continuum Crowds, Adrein et.al, SIGGRAPH 2006 • Summary
Motivation • Crowds are every where!! • Motivating video Clip • Movies • The Chronicles of Nornia – The witch, The Lion and The ward robe • The Lord of the ring • I, Robot, etc
Applications Courtesy: Illknur • Entertainment industry (animation production, computer games) • Training of police & military (demonstrations, riots handling) • Architecture (planning of buildings, towns, visualization) • Safety science (evacuation of buildings, ships, airplanes) • Sociology (crowd behavior) • Transportation research for urban planning
Background • Motion-graph approaches • [Gleicher et. al TOG 2003] • [Kuffner et. al SCA 2005] • Static potential fields • [Kirchner 2002] • Continuous density field • [Hughes 2003] • [Adrien et. al SIGGRAPH 2006]
Behavior Planning for Character Animation, Kuffner et.al, SCA 2005
Abstract • Automatically generate realistic motions for animated characters • Motion clips - FSM - movements of a virtual character • Global search of the FSM – a sequence of behaviors for the character Static/Dynamic environments From small amount of data Scales to large motion DBs Flexible framework
Behavior Finite-State Machine • Behavior FSM defines movement capabilities of the character • Each state consists of a collection of motion clips that represent a high-level behavior • Each directed edge represents a possible transition b/w two behaviors • There can be multiple motion clips with in a state.
Environment Abstraction • Environment as a 2D height-field gridmap • Gridmap also encodes • Obstacles that the character should avoid • Free space where character can navigate • Information about special obstacles such as an archway • Height value is used so that we can represent terrains with slopes or hills. • Virtual character is bounded by a cylinder with radius r & position is the center of the cylinder
Data structures • A tree with nodes that record explored states in the FSM • Each node in the tree stores the motion clip, position, orientation, time and cost • Priority queue of FSM states ordered by cost, which represent potential nodes to be expanding during the next search iteration
A* - search • Total cost = ( cost of the path up to that node) + (expected cost to reach the goal) • Using A*-search, The planner iteratively expands the lowest cost node in the queue until either the a solution is found or the queue is empty.
ALGORITHM 1: BEHAVIOR PLANNER Function F returns the set of actions A that the character is allowed to take from sbest Function T takes the input state sin and an action a as parameters and returns the output state sout Function G determines if we should expand Snext as a child of sbest in the tree.
Motion Generation & Blending • Search algorithm returns a sequence of behaviors • Sequence is converted into an actual motion for the character • Blending: to smooth out any slight discontinuities where the transitions b/w behaviors occur.
Advantages • Scalability • Memory Usage • Intuitive Structure • Generality • Optimality • Anytime
Limitations • This technique requires an existence of a behavior FSM • This technique expects the data has been appropriately segmented & categorized
What needs to be taken care … • Individual human motion • Environmental constraints • Intelligent path planning Large group of people exhibit behavior of enormous complexity and subtlety. • Dynamic interactions between people
Previous methods • Agent based methods • Funge et al. [1999] • Shao and Terzopoulos [2005] • Massive Software [2006] • Graph based techniques • Bayazit et al. [2002] • Kuffner et al. [2005] • Static potential fields • Goldeinstein et al. [2001] • Continuous density field • Hughes [2002] • Adrien et. al [2006]
Agent based methods • Pros • Operate with each individual making independent decisions • Capture each person’s unique situation: visibility, proximity of other pedestrians, etc • Different simulation parameter may be defined for each crowd member • Cons • Computationally expensive • Difficult to develop behavioral rules that consistently produce realistic motion
Key points • Real-time crowd model based on continuum dynamics • Global navigation with moving obstacles such as other people • Motion of large crowds without need for explicit collision avoidance Dynamic potential field Interactive rates Smooth flow Emergent phenomena
The Governing Equations • Hypothesis 1: • Each person is trying to reach a geographic goal G R2 • Hypothesis 2: • People move at the maximum speed possible. • Maximum speed field f • Where • Hypothesis 3: • There exist a discomfort field g so that, people would prefer to be a point x rather than x’ if g(x’) > g(x)
Tying together – Hypothesis 4 • People choose paths so as to minimize a linear combination of • The length of the path • The amount of time to the destination • The discomfort felt, per unit time, along the path • Hypothesis 4: • A path P that minimizes
Optimal path Computation • Suppose, Cost function every where equal to the cost of the optimal path to the goal. • Optimal strategy: to move the opposite the gradient of this function. • Potential function ( ) : by following set of all optimal paths outwards from the goal. • In the goal = 0 • Every where,
Speed field • Speed is a density-dependent variable • Crowd density field • Low density (< min): depends on slope • High density (> max): depends vel of crowd • Medium density (> min ; < max)
Models of the future • Predictive discomfort • Future path planning through a constantly updated static view of environment. • Expected periodic changes • When the field deterministically changes over time
Algorithm • For each time step: • Convert the crowd to a density field. • For each group: • Construct the unit cost field C. • Construct the potential and it’s gradient • Update the people’s locations • Enforce the minimum distance between people
Implementation details • Physical fields as 2D arrays of floating point numbers. • Scalar fields : defined at the center of each grid cell • Its true for average velocity ( ), stored as pair of floats • Anisotropic fields : those depend on both position and direction • Stored with four floats per cell corresponding to = {0o, 90o, 180o, 270o} , i.e. EAST, NORTH, WEST and SOUTH faces of each cell
Density Conversion • “Splat” the crowd particles onto a density grid, to compute speed field which are dependent on density • Requirements of density function • Must be continuous w.r.t location of the people • to avoid sharp discontinuities in density and subsequently to the speed • Each person should contribute no less than to their own grid cell, but no more than to any neighboring grid cell • to ensure each individual is not affected by its own contribution to the density field
Density Conversion ctd.. • For each person, we find the closest cell center whose coordinates are both less than that of the person • Relative coordinates of that person w.r.t the cell center • Person’s density then added to the grid as
Unit cost field • Compute speed field f • Then calculate cost field C using • f and C are anisotropic • We would evaluate the speed and discomfort at the cell into which the person would be moving if they choose that direction
Dynamic Potential Field • Constructing is the dynamic potential is the most complex and time consuming step of the algorithm • Implicit eikonal equation – Solution • Assign the potential field inside the goal to 0; include these cells in KNOWN cells; all other to UNKNOWN ; • UNKNOWN cells adjacent to KNOWN cells are included in the CANDIDATE cells and we approximate at these locations by solving a finite difference approximation to • The CANDIDATE cell with the lowest potential is then included in the KNOWN cells and its neighbors are introduced into the CANDIDATE set by re-approximating the potentials at these cells • This process is repeated, propagating the KNOWN cells outwards from the goal until all cells are defined. • HEAP DATA STRUCTURE : O(N log N)
Finite difference approximation • First find the less costly adjacent grid cell along the both x- and y-axis • Solve the equation for • Once we have computed , we take its difference with the neighboring grid cells in the upwind direction gives us • Renormalize the gradient, multiply by the speed in the appropriate directions to compute the velocity field at that point
Crowd Advection • Once velocity field is known Each person’s position is displaced by their velocity, which is effectively computing an Euler integration to • Min displacement Enforcement • All pairs within a threshold distance, symmetrically pushed apart so that min distances are preserved
General Algorithm Overview Grids Potential Fields Density New positions Goal Boundary
Results Video
Contributions • Integrates both global navigation & local collision avoidance into one framework • Velocity dependent term: which induces lane formation • Distance based term: which stabilizes the flow • Complexity depend on the number of grid cells
Limitations • Complex heterogeneous motion • Individual path planning • Depends on the number of groups • Depends on the resolution • Approximations • Dynamic potential field • Minimum distance enforcement to remove visual unpleasant artifacts
What remains challenging • Individual behavior planning in crowds • Inertia – walking & running • 4D eikonal equation (Position and Velocity) • Potential function across nonuniform grids for speed up • Sparse data points in areas with few people • Finer discretizations in areas of congestion
Summary • Behavior planning approach to automatically generate realistic motions for animated characters • Crowd simulation framework based on a continuum perspective