1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

30
1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015

Transcript of 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

Page 1: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

1

From Path Planning to Crowd Simulation

Roland Geraerts3 September 2015

Page 2: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

2

Path planning

Page 3: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

3

Path planning and crowd simulation

Goal: bring characters from A to B in an environment Also vehicles, animals, camera, a formation,…

Requirement: fast and flexible Real-time planning for thousands of characters Individuals and groups Dealing with local hazards Different types of environments

Requirement: realistic paths For example, the way humans move Low energy usage (smooth, short, minimal

rotation/acceleration) Keep some distance (clearance) to obstacles Social behavior and rules (collision avoidance) …

Page 4: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

4

Social relevance of simulation

Crowd simulation is needed for Simulations of the real world

• Improving crowd flow, predicting crowd pressures, planning evacuation routes

• Replacement of big-scale exercises – Hard and expensive to organize: 500+ people– No impact on environment and surroundings

Populating game worlds

Love Parade in Duisburg, 2010

Evacuation in sports stadiumsRebuilding of train station

Game world

Page 5: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

5

A computational model of human navigation

Challenge: Unify dispersed models for realistic, individual, small group, and collective human movements in interactive, heterogeneous environments. Dispersed models

Agent-based: individuals, but problems with high densities Flow-based: no individuals, but good for high densities

Realistic movements Comprise collaboration, smooth and energy-efficient movement,

collision avoidance, and dealing with unrealistic congestions. Interactive environment

Geometry can change dynamically, and the crowd has to react. Heterogeneous environment

People need to take logical, distinct, and realistic paths over heterogeneous terrains in the environment.

Page 6: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

6

Are we there yet?

Page 7: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

7

Path planning errors in games

Networks of waypoints are incorrect Hand designed Do not adapt to changes in the environment Do not adapt to the type of character

Local methods fail to find a route Keep stuck behind objects Lead to repeated motion

Groups split up Not planned as a coherent entity

Paths are unnatural Not smooth Stay too close to network/obstacles

Methodology is not general enough to handle all problems

Titan Quest: Immortal throne

Page 8: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

8

Path planning algorithms

Method: Flocking Separation: steer to avoid crowding local units Alignment: steer towards the average heading of local units Cohesion: steer to move toward the average position of local

units Advantages

Natural behavior for certain animals Disadvantages

Coherent group behavior is hard Trapped in local minima

Reynolds, 1987: Flocks, Herds, and Schools: A Distributed Behavioral Model

Page 9: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

9

Path planning algorithms

Method: A* 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, e.g. sharp turns

Fixed paths• Predictable motions

Hart et al, 1968: A Formal Basis for the Heuristic Determination of Minimum Cost Paths

Page 10: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

10

Path planning algorithms

Method: Potential Fields 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

Continuum crowdsTreuille et al, 2006: Continuum crowds; Latombe, 1991: Robot motion planning

Page 11: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

11

Path planning algorithms

Method: Probabilistic Roadmap 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 or obstacles are added• Storage can be expensive

Kavraki et al, 1996: Probabilistic roadmaps for path planning in high-dimensional configuration spaces

Page 12: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

12

Path planning algorithms

Method: Navigation meshes Create a representation of the

"walkable areas" of a scene Extract the path

Advantages General approach Construction is fast on the GPU

• code.google.com/p/recastnavigation

Disadvantages Often needs much manual editing Current techniques are imprecise Bad support for terrains No automatic annotations (games)

• Areas: walk, climb• Places: hiding and sniper spots

Obstacles Walkable voxels

Voxel regions Polygonal regions

Convex regions A pathMononen, 2015: Recastnavigation

Page 13: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

13

Do we need a new path planning algorithm?

Robotics Virtual environments

Nr. entities a few robots many charactersNr. DOFs many DOFs a few DOFsCPU time much time available little time availableInteraction anti-social socialType path nice path realistic pathCorrectness fool-proof may be incorrect

differences

Page 14: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

14

Surface-based navigation

We need a paradigm shift from graph-based to surface-based navigation

Graph-based navigation: little support for route deviation Hard to avoid expected collision between humans Hard to support differently sized humans/groups Costly to deal with dynamic changes in the environment Hard to efficiently deal with heterogeneous regions Human navigation is surface-based

Page 15: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

15

Crowd simulation framework

Simulation step

Animation

Local movement

Route following

Global route planning

High-level planning

start/goal positions

indicative route

preferred velocity

velocity

Level 1

Level 2

Level 3

Level 4

Level 5

Representation environment Level 5

Plans actions Level 4

Creates indicative routes Level 3

Traverses the routes Yields speed/direction pairs

Level 2 Adapts routes E.g. to avoid collisions

Level 1 Moves the characters

We need a fast and generic frameworkRepresentation of the environment

Van Toll, Jaklin, and Geraerts, 2015. Towards Believable Crowds: A Generic Multi-Level Framework for Agent Navigation.

Page 16: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

16

Crowd simulation framework

Simulation step

Animation

Local movement

Route following

Global route planning

High-level planning

start/goal positions

indicative route

preferred velocity

velocity

Level 1

Level 2

Level 3

Level 4

Level 5

Representation environment Level 5

Plans actions Level 4

Creates indicative routes Level 3

Traverses the routes Yields speed/direction pairs

Level 2 Adapts routes E.g. to avoid collisions

Level 1 Moves the characters

Representation of the environment

Van Toll, Jaklin, and Geraerts, 2015. Towards Believable Crowds: A Generic Multi-Level Framework for Agent Navigation.

Page 17: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

17

Representation of the traversable environment

Comparison of navigation meshes

Triangles[Kallmann]

Disks[Pettré et al]

Polygons[Mononen]

Corridor Map[Geraerts]

Exact representation x xLinear memory x x3D environments x x xVariable unit widths x xDynamic obstacles x x xNOT!

Page 18: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

18

Representation of the traversable environment

Requirements Path existence 100% coverage of the navigable space All cycles Flexible: surfaces Fast computation and small storage Fast query time during simulation

Page 19: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

19

Representation of the traversable environment

Navigation mesh Voronoi diagram / Medial axis

Voronoi sites: red points Voronoi sites: red/black lines

Page 20: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

20

Representation of the traversable environment

Navigation mesh Voronoi diagram / Medial axis From a graph to a surface representation

• Closest point annotation

Page 21: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

21

Representation of the traversable environment

Navigation mesh Voronoi diagram / Medial axis From a graph to a surface representation

• Closest point annotation Computation

• Approximation on the GPU

• Exact computation on the CPU: Vroni, Boost• Both have to deal with precision issues

Page 22: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

22

Representation of the traversable environment

Navigation mesh Extension to 3D environments

• Split environment into 2D layers• Too hard to compute optimally

Page 23: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

23

Representation of the traversable environment

Navigation mesh Extension to 3D environments

• Split environment into 2D layers• Too hard to compute optimally• Stitch the navigation meshes on the layers together

Page 24: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

24

Representation of the traversable environment

Extension to 2.5D (multi-layered) environments Technique

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

Page 25: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

25

Representation of the traversable environment

Result 10 ms

Page 26: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

26

Representationof the traversable environment

Navigation mesh Fast to compute

115 ms

10 ms

3 s

Page 27: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

27

Representation of the traversable environment

Can be huge E.g. 1 km2

Page 28: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

28

Representation of the traversable environment

Navigation mesh Handles dynamic changes

• Update costs < 1 ms

Page 29: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

29

Representation of the traversable environment

Navigation mesh Exact representation

• Captures 100% of the free space• Captures all homotopically different routes (cycles)

Allows fast extraction of global routes and final paths Nice mathematical properties

• Fast to compute – O(n log n)• Small data structure – O(n)• Nearest obstacle computation – O(1)• 2D algorithms also work in ML environments

Page 30: 1 From Path Planning to Crowd Simulation Roland Geraerts 3 September 2015.

30

Crowd simulation framework

Simulation step

Animation

Local movement

Route following

Global route planning

High-level planning

start/goal positions

indicative route

preferred velocity

velocity

Level 1

Level 2

Level 3

Level 4

Level 5

Representation environment Level 5

Plans actions Level 4

Creates indicative routes Level 3

Traverses the routes Yields speed/direction pairs

Level 2 Adapts routes E.g. to avoid collisions

Level 1 Moves the characters

Representation of the environment