This work presents the simulation of dense crowds of more than a million agents on the GPU. The freely available implementation is based on the OpenCL framework and runs primarily on the GPU without any significant participation of the CPU. The system is based on the continuum theory of flow fields. The simulated agents exhibit smooth trajectories and even at high densities intersections are prevented. Furthermore, emergent phenomena that have been observed in human crowds are simulated. The implementation is highly configurable and embedded into a GUI system, which allows easy extensibility and experimentation.
Above is a summary of a recently defended Master Thesis by Helmut Duregger, Institute of Computer Science Faculty of Mathematics, Computer Science and Physics University of Innsbruck. His thesis contains detailed information about the implementation. It is based on the Continuum Crowds paper. Similar to March of the Froblins it runs on the graphics card, but uses OpenCL instead of shader programs. It also uses the original cost function of Continuum Crowds and expresses lane formation on the gradient field level.
It supports walls and tight environments. No velocity obstacle technique has been implemented (like the one in Froblins), but that would be possible to improve the movement. A basic binning algorithm is used for collision resolution.
The agent movement in the videos below shows very nervous agents. This can be tweaked/improved with the cost weights. But you might lose other properties doing so. Unfortunately I did not have the time to experiment much with different weights. The document gives an explanation of how extreme weights visually influence the movement.
The source for the application and the thesis document is available at:
The first video shows 4096 agents on a 256×256 grid.
- 0:05 map overlay and discomfort field (infinite walls in white, low discomfort in red)
- 0:15 density field (low density in red, high density in blue)
- 0:22 average velocity direction. Color and arrows indicate direction.
- 0:37 anisotropic speed field (values for each of the four directions north, east, south, west)
- 1:02 anisotropic cost field
- 1:17 potential field (zero potential at goal areas, potential increasing outwards over domain)
- 1:43 gradient direction field (color coded, and later arrow overlay, nearest neighbor and bilinear filtering (as used by agents during movement update))
The agents move against these gradients to their destinations.
16384 agents on a 256×256 grid in a scene with different discomfort. Agents leave the area through their group exits in the upper left corner. They respawn on the right and bottom edge. In the lower right corner is a zone with discomfort forming a hill. Large discomfort separates the scene in the shape of a river. Later, a discomfort spot (brush) is set. It can be moved with the mouse to interact with the agents. The agents immediately start to evade the area of high discomfort.
- 0:12 discomfort field (white are infinite walls, river of high discomfort, hills with varying discomfort)
- 0:30 placing the discomfort brush that adds additional discomfort into the scene and allows interacting with agents
- 0:35 agents evade the area of additional discomfort
See more videos on author’s homepage.