On this page |
Overview
Crowd simulations require a few different node networks to set up. Most of these have shelf tools that set up the networks for you.
-
A render network to render out agent files from a character.
-
A geometry network to load an agent from disk.
-
A geometry network to source agent primitives.
-
A simulation network to run the crowd simulation.
Quick start
It’s possible to use the Simulate shelf tool to get a "demo" crowd simulation quickly in one scene. This is useful for getting a feel for the different networks involved in crowd simulations.
-
Press ⌃ Ctrl + on the Simulate tool on the Crowds shelf tab. The tool will automatically build agents and a crowd source networks using the
mocapbiped1
character built into Houdini. -
If you have terrain geometry you want the agents to walk across, select it and click Terrain on the Crowds shelf tab.
Bake out an agent
It’s possible to build a quick simulation that gets agent data directly from a character in the same scene file. But it’s much more efficient to "bake out" the agent data into files and use those for simulation.
See baking an agent for how to write out agent files for a character.
Load an agent
Once you've baked agent files, you can load them into a scene for simulation using an agent setup network.
-
At the scene level, create a Geometry object for the agent.
-
Inside the geometry network, create an Agent node.
-
Set Agent name to the name you used when you baked out the agent.
-
If you stored the agent files somewhere other than in an
agents
folder beside the scene file, set the Cache directory parameter to the path containing the agent files.
-
-
If you're going to do terrain adaptation (where Houdini adjusts the agent’s animation so its feet plant properly on the terrain geometry), or look at (where Houdini edits the agent’s neck joint to point its head at something), or other features that require Houdini know which joints represent which body parts, you need to add an Agent Prep node after the Agent node.
In the Agent Prep parameters, you can associate joints in the character with specific body parts.
-
Add a Null at the end of the network and give it the display flag. This will serve as a convenient node to reference for the output of the network which doesn’t change even if you add other nodes before it.
The usual convention is to name this node
OUT
. -
If you're going to do ragdoll simulation of agents, you need to set up collision geometry and joint limits on the agent. See how to set up agents for ragdoll.
Create a crowd source
The agent setup network loads the agent files from disk, representing the "definition" of an agent. To create a crowd, you need a crowd source network that creates a crowd of agent primitives.
-
On the Crowds shelf tab, click Populate.
-
Select the agent setup object, then press Enter.
-
If you have terrain geometry, select it and press Enter, or just press Enter if you don’t have terrain.
(With no terrain geometry, the node will simply scatter agents across an area defined by parameters on the node).
Create a crowd simulation
The crowd source network generates agent primitives representing the individual agents in the crowd. To make the crowd move and execute behaviors, you need a crowd simulation network.
-
Select the crowd source object.
-
On the Crowds shelf tab, click Simulate.
The tool will build a dynamics network the loads the crowd source and applies a few default behaviors. You can edit the nodes in this network to set up the crowd behaviors you want.
See dynamics network below for information on the general structure of this network.
Shelf tools
The following tools are on the Crowds tab of the shelf.
|
Set up the networks to create an agent and bake out animation clip for the selected character. |
|
|
Set up simple collision geometry around an agent character’s skeleton. |
|
|
Set up joint rotation limits on an agent character, for use in ragdoll simulation. |
|
|
Create a network to scatter agents across the selected geometry, but do not create the simulation network. This may be useful for layout artists who don’t want to create a simulation. |
|
|
Paint density |
Paint density attributes on terrain geometry to control the random distribution of generated agents. |
|
Set up geometry and simulation networks with sample animated agents and sample behaviors. This is useful for setting up the networks quickly, and you can then modify them to suit your needs. |
|
|
Set the selected geometry as terrain for the current crowd simulation. |
|
|
Add the selected geometry as an obstacle for the current crowd simulation. |
|
|
Create a POP Steer Path node to make all agents follow the selected path. If you want only agents in a certain state to follow the path, you need to rewire the POP Steer Path node. See the simulation network overview and states and behaviors. |
|
|
Have agents keep their head turned toward the selected object. |
|
|
Have agents chase the selected object. |
|
|
Create an attach cameras to the head transform of the selected agents. |
Geometry networks
Crowd simulations have separate agent setup networks for each separate class of agent, and a crowd source network to generate the crowd.
Agent setup networks
This network is where you (or the shelf tools) add nodes to modify the agent primitive before simulation, such as adding layers, and adding collision and rotation information for ragdoll simulation.
|
Creates an agent primitive, and sets basic information such as its name, the current layer, and the current animation clip. |
|
|
Sets up additional information on the agent, such as specifying transforms to use for different limbs, so the solver knows how to do foot placement and other procedural changes. |
|
|
This node exists as a reference target for the simulation network to grab the agents using a POP Source node. |
Crowd source network
|
Object merge |
These nodes "import" the agent primitive from a setup networks. |
|
This node copies agent primitives onto points. It has options for automatically scattering agents across a surface or within a defined area, as well as for randomizing their initial states. |
|
|
This node sets up the constraint networks between agent parts, for ragdoll simulation. |
|
|
|
This node merges the separate import → crowd source → constraints branches for each agent class in the simulation. Below this is a null node to act as a target for importing the agents into the crowd simulation DOP network. You can wire nodes you want to apply to all agents between these two nodes. |
|
|
This DOP IO node node imports the results of the DOP crowd simulation back into this object so it can be rendered. |
You can wire geometry into the crowd source nodes to control the scattering of agents.
-
If you wire in point geometry, it will create agents at those points.
If the input points have agent related attributes on them, the attributes will be copied onto the new agent primitives. This is a very effective way of manually or randomly specifying different starting conditions, looks, etc. across agents.
-
If you wire in surface geometry, it will use the dimensions of the of the surface as the area across which to randomly scatter a number of agents controlled by a parameter.
If the surface has a
density
attribute, the node will only create agents where the attribute is non-zero. -
If you don’t wire in any geometry, it will parameters to decide the area and number of agents to randomly scatter.
DOP network
The Simulate shelf tool creates the geometry network above as well as a simulation network with some sample nodes for simulating the crowd.
|
Each branch leading into the The state node is followed by behavior nodes specific to that state, between the state node and the You can wire behavior nodes after the The state name should correspond to an animation clip of the same name that agents will play while in that state. |
|
|
Each branch leading into the The trigger node(s) is/are followed by a Crowd Transition node which specifies that agents in one state should switch to another state when the trigger condition is met. (You can wire multiple Transition nodes between a trigger and the |
|
|
This is a POP Source DOP that references agent primitives created in the crowd source network. |
|
|
Implements the crowd system. The solver has controls for several optional default behaviors that can apply to all agents, such as agent-to-agent collision avoidance, and terrain following. |
|
|
Crowd Object and POP solver |
These nodes are used by the particle (POP) foundation on which the crowd system is built. You will not usually need to modify these nodes. |
Tip
Houdini automatically color codes certain nodes to make it easier to keep them straight in the network editor (Crowd State pink, Crowd Trigger orange, Crowd Trigger Logic green). If you want to, you can change a node’s color after it is created.