roland geraerts seminar crowd simulation 2011

47
Roland Geraerts Seminar Crowd Simulation 2011 Path Planning with Explicit Corridor Maps Related work Constructing Explicit Corridor Maps Corridor Map Method Exploiting Explicit Corridors

Upload: tim

Post on 05-Jan-2016

27 views

Category:

Documents


2 download

DESCRIPTION

Path Planning with Explicit Corridor Maps Related work Constructing Explicit Corridor Maps Corridor Map Method Exploiting Explicit Corridors. Roland Geraerts Seminar Crowd Simulation 2011. Related work: A*. Method Construction phase: create a grid, mark free/blocked cells - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Roland Geraerts Seminar Crowd Simulation 2011

Roland GeraertsSeminar Crowd Simulation 2011

Path Planning with Explicit Corridor Maps Related work Constructing Explicit Corridor Maps Corridor Map Method Exploiting Explicit Corridors

Page 2: Roland Geraerts Seminar Crowd Simulation 2011

Related work: A*

Method• Construction phase: create a grid, mark free/blocked cells• Query phase: use A* to find the shortest path (in the grid)

Advantage• Simple

Disadvantages• Too slow in large scenes• Ugly paths

– Little clearance to obstacles– Unnatural motions (sharp turns)

• Fixed paths– Predictable motions

Page 3: Roland Geraerts Seminar Crowd Simulation 2011

Related work: Potential Fields

Method• Goal generates attractive force• Obstacles generate repulsive force• Follow the direction of steepest

descent of the potential toward the goal

Advantages• Flexibility to avoid local hazards• Smooth paths

Disadvantages• Expensive for multiple goals• Local minima

Page 4: Roland Geraerts Seminar Crowd Simulation 2011

Related work: Probabilistic Roadmap Method

Method• Construction phase: build the roadmap• Query phase: query the roadmap

Advantages• Reasonably fast• High-dimensional problems

Disadvantages• Ugly paths• Fixed paths

– Predictable motions– Lacks flexibility when

environment changes

Page 5: Roland Geraerts Seminar Crowd Simulation 2011

Related work: Probabilistic Roadmap Method

Method• Construction phase: build the roadmap• Query phase: query the roadmap

Advantages• Reasonably fast• High-dimensional problems

Disadvantages• Ugly paths• Fixed paths

– Predictable motions– Lacks flexibility when

environment changes

Page 6: Roland Geraerts Seminar Crowd Simulation 2011

State-of-the-art: Navigation meshes

Method• Create a representation of the

"walkable areas" of an environment• Extract the path

Advantages• General approach• Construction is fast due to use of GPU

– Examples and source code can be found on http://code.google.com/p/recastnavigation

Disadvantages• Often needs a lot of manual editing• Current techniques are imprecise• Bad support for non-planar surfaces

Obstacles Walkable voxels

Voxel regions Polygonal regions

Convex regions A path

Page 7: Roland Geraerts Seminar Crowd Simulation 2011

State-of-the-art: Navigation meshes

Some open problems• Automatic annotation of the map

– Areas: walk, climb, jump, crouch, “avoid” …– Special places: hiding and sniper spots, …

• Handle large (dynamic) changes– Efficiently updating the data structure and paths

• Improve the efficiency of mesh generation (large scenes)• Wrong coverage/connectivity due to confusing elements

– Steep stairs, ramps, hills, curved surfaces, gaps

• The mesh is only a data structure storing the walkable areas– How to create visually convincing paths?

Page 8: Roland Geraerts Seminar Crowd Simulation 2011

Towards a new methodology: Requirements

Fast and flexible path planner• Real-time planning for thousands of characters• Dealing with local hazards• Global path

Natural paths• Smooth• Short• Keeps some distance to

obstacles• Avoids other characters• …

Titan Quest: Immortal throne

Page 9: Roland Geraerts Seminar Crowd Simulation 2011

Capturing the free space

Requirements of the data structure representing the free (walkable) space• Existence of a path• Contains all cycles

– Short global paths, alternative paths

• Provides high-clearance paths (corridors)– Provides maximum local flexibility

• Small size• Fast extraction of paths

A good candidate• Generalized Voronoi Diagram + annotation

Page 10: Roland Geraerts Seminar Crowd Simulation 2011

Voronoi Diagram

Some inspiration from natural objects…drying mud maple leaf

wasps nestgiraffe bacteria colonies

Page 11: Roland Geraerts Seminar Crowd Simulation 2011

Voronoi Diagram

Definitions• Voronoi region: set of all points closest to a given point• Voronoi diagram: union of all Voronoi regions

Voronoi sites: (red) points

Page 12: Roland Geraerts Seminar Crowd Simulation 2011

Voronoi Diagram

Approximation of the Voronoi Diagram• Compute a distance mesh for each point• Render each mesh in a different color by using the GPU

– Using the Z-buffer, only pixels with the lowest distance values attribute to a pixel in the Frame buffer

• A parallel projection of the meshes gives the diagram

Perspective view (Z-buffer) Top view (Frame buffer)

Page 13: Roland Geraerts Seminar Crowd Simulation 2011

Generalized Voronoi Diagram

Generalized Voronoi Diagram supports any type of obstacles• Point, disk, line, polygon, …• Convert concave polygons into convex ones, otherwise edges do not

run into all corners

Page 14: Roland Geraerts Seminar Crowd Simulation 2011

Generalized Voronoi Diagram

Generalized Voronoi Diagram supports any type of obstacles• Point, disk, line, polygon, …• Convert concave polygons into convex ones, otherwise edges do not

run into all corners

Distance meshes• Point: cone• Disk: lifted cone• Line: tent + 2 cones• Polygon: n (point + line meshes)

Literature• [Hoff et al., 1999]• [Geraerts and Overmars, 2010]

Page 15: Roland Geraerts Seminar Crowd Simulation 2011

From GDV to Medial axis

Generalized Voronoi Diagram (GVD)• Render distance meshes for each obstacle• Boundaries: bisectors between any two closest obstacles

Medial axis• Yields bisectors between any two distinct closest obstacles• Extraction of the medial axis

– Edge: trace pixels between Voronoi regions; continue tracingwhen closest points on the obstacles are equal

– Vertex: end point of an edge

GVD Medial axis

Page 16: Roland Geraerts Seminar Crowd Simulation 2011

Medial axis

The good• Existence of a path: full coverage/connectivity• Contains all cycles: yes• Provides high-clearance paths: yes• Small size: yes (linear)• Fast extraction of paths: yes

The bad• Unclear how to extract short(est) paths• Moving along 1D-curves limits flexibility

The ugly• Deal with robustness

Page 17: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map

Basis: Medial Axis Plus: annotated event points on the edges

• Points where the type of bisector on the edge changes– Straight lines versus parabola’s (bisector of point and line)

• Changes occur at crossing between site normal and edge• Annotation: its two closest points on the sites

Equals: planar subdivision (or navigation mesh)Memory footprint The storage is linear in the number of obstacle vertices.

Memory footprint The storage is linear in the number of obstacle vertices.

Note There is no need for storing pixels.

Note There is no need for storing pixels.

Page 18: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: closest points

Computation of the closest points• Look up incident colors at the event point’s position• Each color was linked to an unique obstacle• Compute the (left and right) closest points to each obstacle

using simple linear algebra

Page 19: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: experiments

Performance• Setup

– NVIDIA GeForce 8800 GTX graphics card– Intel Core2 Quad CPU 2.4 GHz, 1 CPU used

• Experiments– McKenna: 200x200 meter, 1600x1600 pixels, 23 convex polygons

Page 20: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: experiments

Performance• Setup

– NVIDIA GeForce 8800 GTX graphics card– Intel Core2 Quad CPU 2.4 GHz, 1 CPU used

• Experiments– McKenna: 200x200 meter, 1600x1600 pixels, 23 convex polygons

time: 0.03s

Page 21: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: experiments

Performance• Setup

– NVIDIA GeForce 8800 GTX graphics card– Intel Core2 Quad CPU 2.4 GHz, 1 CPU used

• Experiments– City: 500x500 meter, 4000x4000 pixels, 548 convex polygons

Page 22: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: experiments

Performance• Setup

– NVIDIA GeForce 8800 GTX graphics card– Intel Core2 Quad CPU 2.4 GHz, 1 CPU used

• Experiments– City: 500x500 meter, 4000x4000 pixels, 548 convex polygons

time: 0.3s

Page 23: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: experiments

Supports large environments• E.g. 1 km2

• Millimeter precision– However, there must be at least

two pixels in between two obstacles to discover an edge

Page 24: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: recent work

Extension to 2.5D (multi-layered) environments• Technique

• Result (46 ms)

Multi-layered environment Partial medial axes for Li and LjConnection scene Updated medial axes for Li and Lj

Page 25: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: recent work

Handling dynamic changes• Technique for adding a point/line

• Result (1 – 2.7 ms per update)

A

Finding closest site Continue in 1 dir. w1 has been reached Updated VD (point) Updated VD (line)

Page 26: Roland Geraerts Seminar Crowd Simulation 2011

Compare with the old approach

Disadvantages Implicit Corridor Map• More than linear storage (due to discrete sample points)• Non-exact representation• Additional parameters required

for local sampling density

Page 27: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridor Map: some thoughts

Examples of different topological spaces (plane, sphere, cylinder, torus, Möbius strip, Klein bottle)

Page 28: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Construction phase (offline)

• Build Explicit Corridor Map• Build kd-tree that stores

the ECM

Query phase (on-line)

• Construct indicative route– CMM: Medial axis

Page 29: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)

• Construct indicative route– CMM: Medial axis

• Compute a corridor• Compute a path

Construction phase (offline)

• Build Explicit Corridor Map• Build kd-tree that stores

the ECM

Distinguish three scales1. Macro (corridor)2. Meso (indicative route)3. Micro (local behavior)

Distinguish three scales1. Macro (corridor)2. Meso (indicative route)3. Micro (local behavior)

Page 30: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)1. Retract the start and goal to the medial axis

– Query the kd-tree

2. Connect the start and goal to the Corridor Map

3. Compute the shortest backbone path (using A*)

Explicit Corridor Map Corridor with its backbone pathQuery

Page 31: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)4. Compute the path

– While the corridor determines the character’s global path, forces determine its local path

– The force F(x)=Fa(x)+Fo(x) causes the character to accelerate, pulling it toward the goal. The variable x is the character’s position

– Using Newton's Second Law, we have F = Ma, where M = mass = 1 and a = acceleration

– Hence, the force F can be expressed as:

– Combining these expressions gives us:

A smooth path

smdtxdx /

2

2

2

)F(

)(F)(F/2

2

2

xx oasmdtxd

Page 32: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)4. Compute the path: forces

– The attraction force steers the character toward the goal

Fa(x) = , where f controls the magnitude

a(x) = attraction point: the furthest point on the backbone path whose disk encloses the character.

α(x)x

goal

Note on old approachThis is an discrete corridor instead of continuous explicit corridor.

Note on old approachThis is an discrete corridor instead of continuous explicit corridor.

Page 33: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)4. Compute the path: forces

– The boundary force keeps the character inside the corridorThis force is hidden inside the attraction force: (r=character’s radius)

f=0, when the character is positioned at its attraction point (i.e. d=0)f=∞, when the character touches the disk’s boundary

α(x)x

goal

R[t]

d

Note on old approachThis is an discrete corridor instead of continuous explicit corridor.

Note on old approachThis is an discrete corridor instead of continuous explicit corridor.

Page 34: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Query phase (on-line)4. Compute the path

– Solving the equation gives us the character’s positions– Cannot be done analytically

• revert to a numerical approximation

A smooth path

Page 35: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method

Choice of forces• Combining these forces and using disks was a bad choice• This is solved by the IRM, which uses Explicit Corridors

Comparison of their vector fields

Vector field: CMM force Vector field: IRM force

Page 36: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method: Examples

Query phase (on-line)4. Compute the path: forces

– Adding/changing forces leads to other “behavior”

Smooth path Short path Obstacle avoidance

Coherent groups Path variation Camera path

Obstacle avoidance (Helbing model) + path variation = crowd?

Page 37: Roland Geraerts Seminar Crowd Simulation 2011

The Corridor Map Method: Examples

Query phase (on-line)4. Compute the path: forces

– Adding/changing forces leads to other “behavior”

Stealth-based path planning

Page 38: Roland Geraerts Seminar Crowd Simulation 2011

Exploiting Explicit Corridors

The Corridor’s boundaries are given explicitly• Construction

Convenient representation• Small storage: linear in the number of samples (i.e. events)• Computation of closest points in O(1) time (on average)• Allows computing shortest minimum-clearance paths

Page 39: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridors: Obtaining clearance

Minimum clearance in explicit corridors• For each closest point cp, move cp toward its center point c• The displacement equals the desired clearance clmin

• Insert event point(s) if clmin > distance(c, cp)

c cp

Explicit Corridor Shrunk corridors Shrinking a corridor

Page 40: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridors: Shortest paths

Computing the shortest path• Construct a triangulation

– 2ith triangle: (li , ri , li+1) ; 2i+1th triangle: (ri , li+1 , ri+1)

– If the start [goal] is not included, add triangle (s, l1 , r1 ) [(ln , rn ,g)]

• Compute the shortest path– Funnel algorithm [Guibas et al. 1987]

Explicit Corridor Triangulation Shortest path

li ri

li+1 ri+1

s

g

Page 41: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridors: Shortest paths

Sketch of the Funnel algorithm• Funnel

– Tail: computed shortest path from start to apex

– Fan: 2 outward convex chains plus one diagonal

– The fan keeps track of all possible shortest paths

• Algorithm– Add diagonals iteratively while

updating the funnel

• Algorithm is linear in the number of diagonals

– (or events)

apex

start

goal

fan diagonal

tail

Page 42: Roland Geraerts Seminar Crowd Simulation 2011

Explicit Corridors: Shortest paths

Computing the shortest minimum clearance path• Shrink the corridor

– Construction time: linear in the number of event points

• Compute the shortest path– Adjust Funnel algorithm to deal with circular arcs– Construction time: linear in the number of event points

Shortest pathLeft/right closest points Triangulation

Page 43: Roland Geraerts Seminar Crowd Simulation 2011

Improving the CMM: IRM

Compute a smooth path: Indicative Route Method• Compute the shortest minimum-clearance path• Define the attraction force

– Pulls the character toward the goal

• Define the boundary force– Keeps the character inside the corridor

• Time-integrate the forces– Yields a smooth (C1-continous) path

Page 44: Roland Geraerts Seminar Crowd Simulation 2011

The Query Phase: Experiments

Performance• Setup

– Intel Core2 Quad CPU 2.4 GHz, 1 CPU

• Experiments– City: 500x500 meter, 1.000 random queries

• Results (average query time)

Page 45: Roland Geraerts Seminar Crowd Simulation 2011

The Query Phase: Experiments

Performance• Setup

– Intel Core2 Quad CPU 2.4 GHz, 1 CPU

• Experiments– City: 500x500 meter, 1 query

• Results (query time)– 2.8 ms

ECM (0.3s) Explicit corridor Shrunk corridor Triangulation Shortest path Smooth path

Page 46: Roland Geraerts Seminar Crowd Simulation 2011

Integration in Second Life

Implementation in Second Life

Virtual World

Interface

Path planning on server:http request

Bitmap

Camera path

Page 47: Roland Geraerts Seminar Crowd Simulation 2011

Conclusion

Advantages• Fast and flexible planner creates visually convincing paths• Computation of smooth, short minimum clearance paths• The algorithms run in linear time and are fast• The algorithms are simple

Open problems• Automatic annotation of the navigation mesh• Handling 3D spaces• Handling extensions• Handling character behavior

– E.g. shopping and beach behavior– Interaction between different

entities (human, car, bicycle)