Houdini 21.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 pose and animation, such as the Agent Look At DOP (adjusts the agent’s pose) and the Agent Clip Layer DOP (blends another animation clip with the base animation).

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

In a crowd simulation network, an agent’s animation is defined in a Crowd State DOP, and the nodes modifying the agent’s behavior and pose are wired in after the Crowd State DOP. The crowd solver updates the agent’s position/orientation (driven by steering forces) and pose (driven by animation clips) at the end of the substep, so the ordering of the behavior and animation nodes usually don’t matter since their effects are not immediately applied to the agent.

In the example below, the behavior nodes are blue and the pose-modifying node is yellow:

Nodes defining the crowd states

Adding states

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

  1. In a crowd simulation network, merge multiple Crowd State DOPs using a Merge DOP, then wire the Merge DOP into the crowd solver:

    Crowd State DOP nodes in the crowd simulation network
  2. By default, the Crowd State DOP’s Clip Name parameter is set to $OS, which sets the animation clip that the state plays to the name of the Crowd State DOP. For example, if you rename the Crowd State DOP to walk, then agents in the “walk” state play the animation clip named walk. If you want to have a state name that differs from the name of the animation clip, directly set the animation clip name in the Clip Name parameter.

Note

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

Adding behaviors to a state

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

  • To apply the behavior only to the agents in a particular state, put the behavior node between the Crowd State DOP and Merge DOP.

  • To apply the behavior to the agents in all states, put the behavior node after the Merge DOP and before the crowd solver.

In the network below, the behavior nodes are in blue. The POP Steer Wander behavior only applies to agents in the walk state, and the POP Steer Separate 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 DOP, you can use the Group parameter on a behavior node to limit the behavior to a certain group of agents.

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

Movement behaviors

Houdini has several 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’s Output Attribute parameter to POP force. You can also use regular particle simulation forces (for example, the POP Wind DOP) as behavior nodes. The regular particle simulation forces don’t have Weight parameters, however, so the crowd 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 that may apply to all agents regardless of the state they are in, including:

  • Keeping agents from turning or moving too quickly when reacting to forces. This helps the agent movement look more realistic.

  • Optional default behaviors for avoiding obstacles and keeping agents from running into each other.

  • Options for making agents “stick” to a terrain object and adapt foot bone placement to the terrain.

Modifying agent animation and poses

The following nodes can be used to adjust the agent’s pose and animation:

These nodes are wired into the crowd simulation network after the Crowd State DOP, and can be placed before or after the behavior nodes:

See layering animation clips for more information on the agent clip layer nodes.

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.

Customizing behaviors

Changing 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.

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.

SOP crowds

Crowd Procedural