Houdini - Crowd

Houdini 18 crowd docs

Theese notes are based on the excellent tutorial by Mikael Pettersen, a little bit of CGWiki and random bits of information I stumble up on.

Minimal Setup

Lets setup a minimal but “working” crowd.

  • First create some geo, bones and capture the geometry.
  • Then create a subnet to house all the parts we created in the previous step, This is our character rig.
  • Create a new Geometry node and dive in.
  • Create an Agent node.
    • Agent Name : give it a name
    • Input : we select Character Rig
    • Character Rig : point to the subnet we created
  • Create a Crowd Source node and plug in the agent node in the first input.
  • In the randomize tab we can randomize (duhh) varoius properties
  • In the second input of the crowd source node we can supply our own points as “source” for the agents.

Agent Prim Setup

Agent from FBX

Lets say that we have some fbx files, a rest pose, a walk and a run animation. Lets create an agent primitive from theese files, write them out to disc and then read them back in.

Create a Geometry node call it “agent_prim” and dive in. First we will use the rest pose, to setup some agent layers (shape variations that we the can use in our crowd sim to add variation/randomness). We will only add theese layers to the rest pose, the walk and run files we will just write out the clips (meaning the animation) So lets start with the rest pose setup.


Create an Agent node and call it “rest”.

  • Agent
    • Agent Name : dude (it is important that we use the same name for all the clips that we setup)
    • Current Clip : a name that describes the motion of the rest, clip, walk, run etc.
      • note that you first must set the Clip Name (located under the “Clip” section at the lower half of the parms, when this is set the clip name is available in the dropdown)
    • Input : FBX
    • FBX File : path/to/file.fbx
    • Converts Units
      • You might need to check this if the size is off.
    • Clip
      • Clip Name : a name that describes the motion of the rest, clip, walk, run etc.
        • Note that you must set the same name in the Current Clip parm at the top of the parm list.
    • Locomotion
      • Convert to In-Place Animation : on
      • Locomotion Node : The node that “drives” the rig forward, possibly hips
        • The object inside the Character Rig that controls the locomotion of the character (the node in the character rig that has translation channels that move it forward in space). When Convert to In-Place Animation, Houdini uses this to remove the translation from the character animation to keep the character in place. (The crowd solver node assumes that the agent animation is in-place since it will be attached to a moving particle.)
      • Locomotion Orient : try LeftUpLeg_To_LeftLeg (using mocapbiped3)
        • If this parameter and Locomotion Node are specified, the generated locomotion transform will also contain rotational information using the vector from the Locomotion Node to the Locomotion Orient node
          From cgwiki: “The locomotion stuff can handle changes of direction, but needs more information than just where the hips are. There’s a second locomotion parameter on the agent sop for orient, but I couldn’t understand why it didn’t work when I assigned it the hips again. After chatting with sidefx (and re-reading the docs), this field isn’t to read the rotation of the hips. You give it another joint, it constructs a vector from the hips to that joint, and uses that vector to cancel out rotation. In this case I used one of the upper leg joints (LeftUpLeg_To_LeftLeg).”

Agent Layer

Note! Only for the rest. This node creates custom agent layers which can be used to add variations to the look of the agent. A layer specifies an assignment of shapes from the agent’s shape library to transforms in its rig. The shapes can be in the original fbx file or you can specify a SOP path within the houdini file. If you do not want or dont have variations skip this step.

Note that you can chain multiple Agent Layer nodes to add more layers.

Append an Agent Layer node to the Agent node.

  • Agent Layer
    • Layer Name : give it a descriptive name
    • Layer Bindings : set the number of shapes to add
      • Add Shape : if this is enabled you can add shapes using a SOP path.
        • Then we could specify which node in the fbx to use to drive it, how to deform it etc.
      • Shape : select the shape from inside the fbx file.
      • Transform Name : I dont think this needs to be specified if the shape is inside the fbx and already deformed by the rig.
        • specifies which transform the shape should be attatched to.

Foot Planting

The reason to use foot planting is to avoid the feet sliding on the ground. We can use an Agent Prep node to assist us with this. The concept is to use an agent prep node in combination with a CHOP network to detect when the foot should be considered stationary. There are two ways to do this, the first one is based on a speed threshold and the other is based on the distance to the terrain.

We can add the agent prep node before the agents are cached to disc or after (when they are read back in). It is probably better to do this before, since then the data is already present if we read the agent cache in some other setup later.

Note that we also need to add an Agent prep in the “crowd_src” geometry network to let houdini know which bones that will be part of the IK chaoin that houdini will create to achieve the foot locking. Notes on this will be in the “Crowd Source” section.

  • Create an Agent Prep node and append it to the Agent node (or the Agent Layer mode if you used one)
  • Switch to the Additional Channels tab
  • Click on the Create Footplant CHOP Network
    • This will create a chop network that basically gets all the animation curves from the clip and pipes them back out through a Merge node. What we will do is to add some foot plant channels that will be merged with the other channels and then written out to disk.
  • Enter the created CHOP network. Now we will create 2 Foot Plant chop nodes, one for the ankle and one for the toe.
    • Create a Foot Plant chop node, name it “ankle_planted”
    • Source : Agent
    • Clip Name : Set the clip name, to the clip we are working on
    • Transform Name : From the drop down select the appropriate bone
    • Channel Name : By default it is $OS (or set it explicitly) this is the name of the channel that will be created.
    • Connect it to the merge Node
    • Repeat the steps above for the toe bone.
    • Remember that if you have a left & right side you need to create 4 footplant nodes (a good idea is to suffix theese wit L & R, or whaterver makes ense to you)
    • To inspect the foot plant channels do this
  • On the Additional Channels of the Agent Prep press Reload Channels

Agent Definition Cache

Create an Agent Definition Cache and append it to the Agent Prep node (if present). This node will assit us in writing out the agent data to disk, so that we can reuse the data in other scene files.

Note! for the rest agent we will cache everything to disc but for the other clips we only want to cache the Clips, as shown below.

  • Agent Definition Cache
    • Agent Name : Set this name to match the name set in the Agent node.
    • Rig : on | off
    • Agent Layers : on | off
    • Shape Library : on | off
    • Clips : on | on
    • Transform Groups : on | off

Press save to disk to cache the agent prim.

Crowd Source

In this geo network we will load the agents we cached out to disc, add a crowd source and do other preparations of the agent prims to be used as a source in our crowd sim.

Create a Geometry node call it “crowd_src” and dive in.


Create an Agent node.

  • Agent
    • Agent Name : select the same name that were used when writing to disc.
    • Input : Agent Definition Cache
    • Current Clip
      • Note that you can set the current clip to preview the cached clips
    • Apply Clip Locomotion : off

Foot Planting

If we want to use the foot planting channels that we setup earlier, before writing the agents to disc we need use an Agent Prep node here aswell.

  • Create an Agen Prep node and append it to the Agent node
  • Click on the + icon on the right side of Lower Limbs multiparm to add as many lower limbs as needed.
  • Enter the name of the bones that corresponds with the parms
    • Upper Leg
    • Knee
    • Ankle
    • Toe
  • specify the Ankle Plant Channel (the one we wrote to disc earlier)
  • specify the Toe Plant Channel (the one we wrote to disc earlier)
  • Note when we enable foot locking (and use a terrain?) we might need to adjust the ankle & toe offset to offset from the terrain.

Agent Layer

Note that we could also add layers to our clips here, if we did not do it earlier (before they were cached)

Clip Properties

The Agent Clip Properties node will help us with creating a loop from a specified frame range of a selected animation clip. This SOP creates geometry (which can be attached to a crowd object) describing advanced options for how animation clips should be played back by the crowd solver. Each point in the geometry represents an animation clip, and point attributes describe properties such as a sub-range of frames that should be looped.

Note that this node will not be part of the “main node chain” but will be branching of to the side.

  • Create a Agent Clip Properties node and append it to the [Agent node, Agent Prep or Agent Layer] (Dont think it matters)
  • Click the + to the right of Clips to add a clip
  • Select a Clip Name from the dropdown
  • Enable Loop Range and set the start and end frames.
  • You probably want to enable Blend While Lopoping, possibly adjust the frames before and after.
  • Finally we create a Null node call it OUT_clip_prop and append it to the Agent Clip Properties node.

Note If we want to test the behaviour of our Agent in combination with the Agent Clip Properties node we can use a Test Simulation: Crowd Transition. See here

Note Lets say that we wish to create a new clip from an already existing clip. To do this we can enable the Clip Name Alias in the Agent Clip Properties.

  • Add a new clip in the agent clip properties multiparm.
  • Select the Clip Name
  • Then we enable Clip Name Alias and enter the name of the clip we wish to create.
  • Set the lopp range, blending etc.


Agent Clip Transition Graph A crowd object’s clip transition graph may optionally be used to control transitions between states and animation clips. It provides information about which clips are allowed to transition to each other, and where in the clips those transitions should occur. This can be used by the Crowd Transition DOP to delay state transitions until an appropriate point in the current animation clip, and to smoothly blend into the next clip. Additionally, the clip transition graph allows per-clip control over this behavior (which is useful if the transition’s Input State parameter specifies multiple states, or if Randomize Clips is enabled for any of the input states).

Note If we Clip Name Alias in the Agent Clip Properties (which creates a new clip from an existing one), we need to connect the output of the Agent Clip Properties to the third input of the Agent Clip Transition Graph. (To let it know it exists, sine it is not a part of the clips commeing from the “agent node chain”)

Each point in the clip transition graph geometry represents an animation clip, and each two-point polygon represents a (one-way) transition between the clips. During a state transition, if the points corresponding to the input and output states’ animation clips are not directly connected, the Crowd Transition DOP will use the shortest path between the two clips.

So lets first create a transition between “idle” clip to a “walk” clip.

  • Create an Agent Clip Transition Graph and connect the output of the agent chain (before it goes in to a crowd src node) to the first input of the Agent Clip Transition Graph.
  • Connect the output of the Agent Clip Properties node to third input.

  • Agent Clip Transition Graph
    • Transitions
      • Compute Transition Graph : off
        • We will do this manually for now
      • Extra Transitions : add as many as you need.
        • Clip A : idle
        • Clip B : walk
      • Transition Regions : add as many as we need
        • more regions means that the agents have more “time windows” to react to a state change, meaning they will be able to faster transition into a reqiested state.
      • Sync Frame A : 25
        • Specifies a frame in Clip A where the pose is similar to Sync Frame B in Clip B.
        • As a guideline we can setup one for every second (25 frames)
        • So the next sync frame, in the second Transition Region (if we add one) should be 50 and the transition region should be set to 50 - 51
      • Transition Region : 25 - 26
        • Specifies the range of frames where a transition may begin. This should typically include Sync Frame A.
      • Sync Frame B
        • Specifies a frame in Clip B where the pose is similar to Sync Frame A in Clip A.
        • Note this frame is the start frame of the loop setup for the clip in the Agent Clip Properties. To set the start frame of the clip, go to the Agent Clip Properties, find the clip and set the Start Frame to 1 (or what you need)
      • Blend Frames : 6
        • Specifies the length of the transition between the clips.
      • Show Guide Geometry: it can be helpful to view this when setting up

Note The Test Simulation: Crowd Transition SOP can be used to quickly preview transitions between particular clips before setting up a crowd simulation. See here

Finally create a OUT_transitions Null node and append to the Agent Clip Transition Graph. We will reference this node from the Crowd Object in our Crowd sim.

Crowd Source

Create a Crowd Source node and append it to the Agen Prep node (if we used one otherwise to the Agent node). If we enter a polygon mesh into the second input (of the source node) agents will be scattered on the incomming geo. If we instead hook up points, the points will be used directly.

  • Crowd Source
    • Setup : Set some initial attributes, number of agents, distribution, velocity etc.
      • Initial State : jump (or something else)
      • Initial Velocity : 0, 0, 0
        • We do not want a constant velocity, we want to move the agenst with the forward movement in the animation clips.
    • Randomize : Do various randomization of the crowd source

Finally create a Null node, append it to the crowd source and call it OUT_crowd_src

Crowd Sim

Lets create a crowd sim using the agent we just wrote to disc.

As usual in Houdini we will do the simulation in a DOP Network. Note that we can feed the agent to the dop network without using a crowd source node, but then we need to do more manual setting of attributes. For instance setting the state attribute on the agent prim using a point wrangle like: s@state = ‘rest’;. The Crowd Source node provides a convenient way of setting initial attributes aswell as randomizing attributes for a more interseting looking sim.

DOP Network

In Object level create a DOP Network name it “crowd_sim” and dive in.

Crowd Solver

Create a Crowd Solver and connect it to the Output node.

  • Crowd Solver
    • Terrain
      • Enable Foot Locking : on
        • Enable Show Guide Geometry to preview when footloocking is used.
      • Enable Terrain Projection : on
        • Set the source to SOP and set the path.

Crowd Object

Create a Crowd Object and connect it to the 1:st Crowd Solver node.

  • Crowd Object
    • Crowd
      • Clip Properties
        • Source : SOP
        • Clip Properties : set the sop path to the OUT_clip_prop null node we created in the crowd_src geo.

Crowd Source

Create a Crowd Source and connect it to the 2:nd Crowd Solver node.

  • Crowd Source
    • Source
      • Geometry Source : Use Parameter Values
      • SOP : set the path to the OUT_crowd_src we created in the crowd_src geo.

Crowd State

Create a Crowd State for each state (animation clip). Connect the states to a merge node and connect the merge to the 3:rd Crowd Solver node.

  • Crowd State
    • Clip Playback
      • Type : Locomotive
        • since we converted our animation to in-place animation and want to drive the agents with the locomotion channel

How To

Test Simulation : Crowd Transition

  • Create a (Test Simulation: Crowd Transition)[https://www.sidefx.com/docs/houdini/nodes/sop/testsim_crowdtransition.html]
  • Connect the Agent sop to the first input
  • if we have an Agent Clip Transition Graph node connect it sop to the second input
  • Connect the Agent Clip Properties sop to the fourth input
  • Specify the Initial Clip : idle
    • This is the clip the transition will start from
  • Clip Sequence : 1 (or a many as you need) Specifies an ordered sequence of clips to transition to, starting from the Initial Clip.
    • Clip : walk (or whaterver you need)
      • The name of the animation clip to transition to.
    • Trigger Frame : 10 (or whaterver you need)
      • Specifies when to activate the trigger and begin transitioning to this clip.
  • If we want to test the foot locking, switch to the Terrain tab and Enable Foot Locking

Inspect Footplant Channel

In the CHOP network that was created to add the footplant channels

  • create a delete node
  • Delete : Non-scoped Channels
  • Channel Names : *planted*
  • Set the display flag to the delete node (an turn off the same on the merge node)
  • Open the Motion FX View and view the channels
  • It can be nice to turn on the Frame Indicator (T) to view the current time in the Motion FX View.
  • Split the viewport and view the animation in the scene view in sync with the channels in the Motion FX View.
  • Note if you want to edit the timing of the footplant channel (or any other channel for that matter) do this

Time Offset CHOP Channel

Lets say that we would like to have the ankle locked earlier/later but not adjust the settings of the foot plant chop node. One way to do this is to edit the foot plant channels created by the foot plant chop.

  • Create a Shift node and append tp the Foot palnt node.
  • Create a Math node and connect the Shift Node and the Foot plant node.
  • Set the Combine CHOPs : Maximum.
  • Connect the output of the Math node to the Merge node (and disconnect the footplant)

Inspect Locomotion Channel

If you want to inspect the locomotion curves of an agent (lets say the agent that we use in our “crowd_src” network) we can do like this:

  • Create a CHOP Network (could do this in the same geo network as the agent we wish to examine) and step inside.
  • Create an Agent chop node
  • Point the SOP path to the Agent SOP node
  • In the Clip Name parm select a clip
  • Append a Delete chop node
    • Delete : Non-scoped Channels
    • Channels Names : *loc*
  • Remove the display flag from the Agent chop and set it on the Delete chop.
  • Open the Motion FX View