On this page

Overview

You have a character with some animation cycles, and you want to use it as an agent in a crowd simulation. The crowd system doesn’t work directly with characters. Instead, you first create an agent primitive from the character. The agent primitive contains the character information (such as the rig) as well as crowd-specific information.

Note

The crowds system generally assumes your characters are digital assets. Character assets are a good idea and much easier to deal with than characters made of loose objects.

When you're testing with a relatively small number of agents, you can configure the SOPs to grab the information it needs from within Houdini. However, this is inefficient since Houdini needs to cook the character’s network to get the resulting geometry for the crowd sim.

When you scale up to a larger crowd and render, you will need to bake the agent data to a more efficient form on disk. This has several advantages over getting the information from within Houdini:

  • It’s faster to get the agent information from the baked files than to recook the Houdini scene.

  • The renderer can efficiently load only the information it needs for each frame from the baked files.

  • The baked files can be shared between multiple IFDs, multiple renders, and multiple scenes.

Once you bake the agent data, you work with those baked files in the crowd system rather than the original character, and you only need to re-bake the files if the source character or animation/mocap change.

You probably want to create a scene file just for baking out characters, not do it as part of the actual crowd scene.

You can generally treat baked agent files as you would textures. You create them once, possibly check them into a resource control system, re-use them across scene files, and only recreate them if something changes "upstream".

See setting up a simulation for how to use the agent files once they're baked out.

Set up a character for baking

  1. Create an instance of the character asset, and set up the animation cycle.

  2. In the Crowds shelf tab, click Bake Agent.

  3. Enter the name of the "agent class", for example footsoldier. This will be the same for the different animation cycles of the same character.

    Click Accept.

  4. Enter the name of the current animation clip, for example walk. Click Accept.

    • The tool creates a render network for baking agents if it doesn’t already exist.

    • Inside the render network, the tool creates a render node for baking this particular animation clip.

Bake the agent files

  1. Go to the object level, and select the render network (agent_bake).

  2. In the node’s parameters, the Cache directory controls where the render nodes inside will put their files. (The tools automatically set up channel references on the render nodes that look at this parameter.)

    The default is $HIP/agents, meaning the files will be written to a folder next to the current scene file. You may want to change this to use $JOB if you're using project management. Or you can change it to a custom location for your project/site.

  3. In the parameter editor, click Render to bake out all clips.

Tip

You can dive inside the render network to re-render an individual clip.

Baking different animation clips

You need to bake each animation clip (such as a walk cycle) of the agent. Different people have different philosophies of how to associate animation with characters, so it’s impossible for the shelf tools to know how to set up the animation on your characters for you.

You will need to make sure that when the agent render node bakes a certain clip, the character is performing the correct animation.

  • If your asset has a parameter that sets the character’s animation cycle, you can create separate instances of the asset, set each to a different animation, and then bake each one.

  • You can set up each animation in a separate take, bake it, and then on the render node for the clip set it to render the take corresponding to the clip.

Crowd simulations

Getting started

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 which controls the agent’s animation and which behaviors it runs.

  • Clips

    How to associate animation with agents in certain states.

  • Triggers

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

Next steps

  • Foot planting

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

  • Transition graphs

  • Attributes

    Useful attributes for reading in triggers, or that you can set to affect behavior.

  • Sensors

    How to make agents behave differently based on their virtual senses.

  • Diversity

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

  • Weights

    How the Houdini crowd solver decides which behaviors to apply to an agent at each time step.

  • Terrain

    How to specify terrain geometry for agents to walk across.

  • Obstacles

    How to set up obstacles for agents to avoid.

  • Dynamics interaction

    Tips on setting up interaction between agents and other types of dynamics.

  • Ragdoll simulation

  • Adding direction

    How to assert manual control over different aspects of the crowd simulation.

  • Fuzzy Logic

  • Caches

    Tips for efficiently caching and loading crowd sims.

x