Houdini 20.0 Crowd simulations

Crowd agent states

About agent states, the virtual “mood” of each agent that controls the agent’s animation and the behaviors it runs.

On this page

Overview

At any given time, every agent is in a particular state, such as “walk”, “idle”, “attack”, or “run_to_goal”. A state is defined by:

  1. The animation clip that is played for the agents in that state.

  2. Behavior nodes that affect the movement of the underlying particles that the agents are attached to.

  3. Nodes that affect the agent’s skeletal animation, such as the Agent Look At DOP (adjusts the agent’s pose) and the Agent Clip Layer DOP (blends another animation clip on top of the “base” animation clip).

For example, in a “run” state, an animation clip would be played of an agent running. Without a behavior node, the agents would run in place. If a behavior node like POP Steer Separate is used, the agents would run away from each other.

In a crowd simulation network, an agent’s animation is defined in the Crowd State DOP, and the behavior and skeletal animation nodes are wired in after the Crowd State DOP. In the example below, the Crowd State DOP nodes are pink (this is the default Crowd State DOP node color), and the behavior nodes are colored blue.

Nodes defining the crowd states

Add a new state

The name of a state, along with its associated animation clip, is defined by the Crowd State DOP.

  1. In the crowd simulation network, create a Crowd State DOP node and wire it into the merge_states node.

    Crowd State DOP nodes in the crowd simulation network
  2. On the new Crowd State DOP, set the State Name parameter to the name of an animation clip. For example, agents in the walk state play the walk animation clip.

Note

Along with the animation clip settings, other ragdoll-related settings are also defined in the Crowd State DOP.

Add behaviors to a state

Create a behavior node to influence the movement of the underlying particles that the agents are attached to. Wire this behavior node into the crowd simulation network after the Crowd State DOP as follows:

  • For the behavior to apply only to the agents in a particular state, put the behavior node between the state node and the merge_states node.

  • For the behavior to apply to all agents in all states, put the behavior node after the merge_states node (before the crowd solver).

In the below network, the behavior nodes are colored blue. The POP Steer Wander behavior only applies to agents in the walk state, and the POP Steer Path behavior applies to agents in all states.

Agent behaviors in the crowd simulation network

Note

Regardless of whether the behavior node is wired before or after the merge_states node, you can use the Group parameter on a behavior node to limit the behavior to a certain group or groups of agents.

You can have multiple behaviors in a state, and multiple behaviors after the merge. There are also behaviors built into the crowd solver that apply to all agents. The crowd solver combines the effects of all the applicable behaviors using weights.

Movement behaviors

Houdini has several useful POP forces that you could use as behavior nodes to control the movement of the underlying particles that the agents are attached to. Nodes of this type have names starting with “POP Steer”. These “steering” forces are essentially particle forces with the added concept of weights, which determine how the crowd solver deals with multiple forces on the agents.

You can use the above steering forces with regular particles by setting the steering force Output Attribute parameter to POP force. You can also use regular particle simulation forces (for example, the POP Wind node) as behavior nodes. However, because the regular particle simulation forces don’t have Weight parameters, the solver will simply add these forces to the other forces on the agent instead of first normalizing them.

Default agent behaviors on the crowd solver

The Crowd Solver DOP has some optional default behaviors, such as collision avoidance, that may apply to all agents regardless of the state they are in:

  • To keep movement looking realistic, the solver keeps agents from turning or moving too quickly when reacting to forces.

  • The solver has optional default behaviors to avoid obstacles and keep agents from running into each other.

  • The solver has options to make agents “stick” to a terrain object, and to adapt foot bone placement to the terrain.

Using shelf tools

Path shelf tool

The Path shelf tool creates a POP Steer Path DOP node to make agents in the selected state follow a path curve.

  1. Select the path curve.

  2. On the Crowds shelf tab, click the Path tool.

  3. From the dialog box, select the state (or all states) in which you want the agents to follow the path.

    • If you select a particular state, the POP Steer Path node will be wired between the state node and the merge_states node.

    • If you select all states, the POP Steer Path node will be wired after the merge_states node.

Look At shelf tool

The Look At shelf tool wires an Agent Look At DOP into the crowd network to make the agents look at an object.

  1. Select the object you want agents to look at.

  2. On the Crowds shelf tab, click the Look At tool.

  3. From the dialog box, select the state (or all states) in which you want the agents to look at the object.

    • If you select a particular state, the Agent Look At node will be wired between the state node and the merge_states node.

    • If you select all states, the Agent Look At node will be wired after the merge_states node.

Customize behaviors

Change the attributes inside a state

The “steering” behavior nodes apply forces to move the underlying particles that the agents are attached to. You can also use a POP Wrangle DOP as a behavior node to change the attributes on an agent.

For example, if you want to change an agent’s maximum turn rate when it is in a certain state, use a POP Wrangle DOP after the state node with a script such as:

f@maxturnrate = 15;

Custom steer force VOP network

You can use the POP Steer Custom DOP to define a new steering behavior. It contains a VOP network you can use to add to or change the current force on the agent particle.

VOPs names that include “Agent” are useful for working with agents.

Crowd simulations

Getting started

  • Basics

    An overview of Houdini crowd simulation concepts.

  • Setup

    How to set up and edit a crowd simulation.

The moving parts

  • Agents

    About agents, the moving actors that make up a crowd simulation.

  • States

    About agent states, the virtual mood of each agent that controls the agent’s animation and the behaviors it runs.

  • Triggers

    How to specify conditions that cause agents to change from one state to another.

  • Caches

    Tips for efficiently caching and loading crowd sims.

SOP crowds

Behavior

Appearance

  • Diversity

    How to create a more realistic crowd by making agents look and act differently.

  • Attaching cloth

    You can add and constrain vellum cloth as part of agent shape geometry, and then simulate the cloth based on agent movements.

Terrain

  • Foot planting

    How to set up agents to adapt their animation to terrain and prevent skating.

  • Terrain

    How to specify terrain geometry for agents to walk across.

  • Obstacles

    How to set up obstacles for agents to avoid.