top of page
kate_logo_2-01.png

Crowd Simulations in Houdini

Intro:

​

*Insert elaborate sigh about getting assigned a crowd shot at work here.* Yeah you all know what I'm talking about. So let's talk about crowds today. Here are some helpful notes to get you started with working with crowd simulations.

​

Agents

​

There are two sections of agents in Houdini. One we will talk about is the association of crowd data with the Agent geometry node, and the other with the Agent Primitives. Let's start with the Agent geometry node.

​

The Agent geometry node is to create and handle agent primitives for crowd simulations. This node generates your characters. It can draw information from cached and baked files, or referenced rigs in your scene. There are four types of referenced information your agent node needs to operate:

​

- A rig

- A shape library. (This is the geometry for the object.)

- Clips. (This is the animation data for your character.)

- And Layers. (This information controls which geometry to assign to your chosen rig, and how to transform it.)

​

The agent geometry node can also handle FBXs, and USD. 

​

This node also has several local attributes. Some being:

​

AGENT: This contains the name of the selected agent. The value of this parameter comes from two different sources. The first being the agentname string attribute on the input. Second, the value from the Agent Name parameter.

​

CACHEDIR: This references the directory for your chosen cache.

​

LAYER: References the Agent Layers parameter. This helps the node select which layer to load for your agent.

​

CLIP: References the Clips parameter. This helps the node select which clip to load for your agent.

​

TRANSFORM_GROUP: References the Transform Groups parameter. This helps the node select which transform group to load for your agent.

​

FBX_TAKE_NAME: This contains the name of your chosen FBX, and it's current take. This works in tandem with your clip variables. 

​

FBX_TAKE_INDEX: This contains the index take of your FBX. This works in tandem with your clip variables. 

​

​

So moral of the story, agents store compressed data. 

​

But what exactly is an Agent Primitive?

​

An Agent Primitive stores references to the types of data mentioned above. These pieces of data stored in the Agent primitive, are referred to as the Agent definition. As mentioned above, layers are an important part of agents. Based on an agent's layer or set of transformations, it can determine what type of geometry is called when the Agent Primitive is unpacked. Each definition can also be referenced from the primitive externally from Houdini. And that's pretty much it.

​

Now before moving forward, we should also mention another Agent tool. The Agent ROP can be used to write Agent Definitions to disk, and create Agent Definitions from FBX files and rigs.

​

Now, let's take a deeper dive into our Agent Definitions(referenced data for agents).

​

Let's start with rigs.

​

Rigs: These store the Agent's transform hierarchy and channels. Each transform is either a single parent to other transforms, or the root of all the transforms. Rigs are pretty essential to any animation rig. Ask your friendly neighborhood TD, they'll tell you all about it.

​

The Shape Library: This contains the different types of geometry(models) that can be used by the agent. Each shape/geometry should have a unique name. Each shape has a primitive name attribute that stores the name of the shape, the shape's geometry, and other names associated with the shape.

​

Layers: These control the Agent's geometry from the shape library. Layers bind the shapes to the transforms to the Agent rigs. They do this with a process called shape bindings. These can also reference an Agent's bounding box.

​

Clips: These provide the animation data to your shapes and rigs. 

​

All of these have their corresponding attributes as listed above.

​

Now for some additional notes on Agents. Let's talk about Agent Deformers. All of the deformers are used while Shape Binding an Agent. 

​

Skinning

​

Skinning is a type of deformer. It is mostly associated with adjusting rigs, and capturing rig transforms. It needs to be used when the shape's geometry is in its rest position. Otherwise, you will have mixed results in how the geometry interacts with the rig's animation. Lots of popping may occur if you get this wrong.

 

Blends Shapes

​

These take your input shapes and use the weights from your channel values. You can think of blend shapes as a more complicated version of the Blend Shapes SOP. The agent's channel values will determine the Blend Shape's weight values. A lot of the time, Blend shapes will take the point ID attribute from shapes to better match up points between different inputs. But this is optional.

​

Setup

​

So...now onto some general setup tips. 

​

Let's talk about Source Points

​

Source points are the starting points where your agents will start to move from. However, you will need to create your own custom source points for placing your agents in specific areas. If you don't create any source points, Houdini has you covered. The Crowd Source Surface Node will automatically scatter a set of points in a given area.

​

Triggers and Transitions are next.

​

Triggers are "trip wires" that let Houdini know at which state, or stage of the simulation your agents are at. For example how far away they are from their destination. While you sim out your crowds Houdini will look at each agent and check for a series of Trigger Nodes. If a trigger is applied to the simulation, Houdini will look for a transition attached to the trigger to change the agent to a new state. For example, a trigger transition might be changing the agent from a walk cycle to a run. Houdini will also automatically blend these transitions together.

​

Let's briefly talk about Terrain

​

You can have crowds interact with terrain objects. but there can only be one in the setup. Otherwise, the whole system gets too overwhelmed. You have to make your terrain a static RBD object, and  then your agents will follow the terrain. Make sure to place your terrain and other obstacles before the behavior merge node in your setup.

​

Now that you understand some of the harder concepts of crowds, let's talk about the crowd shelf tools. Are they good to use? Or should you create your own setup from scratch? Well that is entirely up to you. Both ways are good, but if you are new to crowds, shelf tools might be the better way to go.

​

Most of the shelf tools already have networks set up and ready to use. They come with a geometry network to handle the agents, and a simulation network to run the overall crowds. When you work with the simulate shelf tool, you'll also be able to create a fast demo of a crowd. 

​

To turn a piece of character geometry into an agent, select it's object node and click the agent shelf tool. Then choose from the popup window whether or not you are importing the character's rig from an FBX, USD, or LOP node. Then specify the path, agent name, and clip name. Also, it is a good procedure to add nulls at important areas in your crowds network. Where the rig comes in; add a null. Where the simulation ends; add a null. You get the general idea.

​

​

Adding Dynamics

​

 

Let's talk about adding dynamics to your crowd simulation. These additional dynamics could be clothing, FLIP simulations, or others.

​

Currently, Houdini only supports one-way interaction from agents. This means agents can knock something over, interact with an object, or each other. However, any other simulation type such as RBD or FLIP cannot interact with a crowds sim. So if you want your crowd of people to be swept away by a wave, you might run into a few issues.

​

Here are some general tips.

​

- The more additional information you add to your crowd sim, the more heavy it will become. Try and cut out information you don't need. For example, use a Delete SOP to remove any agents that are not interacting with your collision.

​

- Always enable the Generate Collision Layer parameter when working with Collisions on agents. This will create good collision detection.

​

- When working with bullet solvers, use the Agent Edit SOP to switch agent layers to the proper collision layer. Customizing layers will help improve collisions. Also use an Agent Unpack SOP to unpack the agents.

​

- You can use the RBD Fractured Object, and other collision shelf tools to create RBD shapes.

​

- If your collision objects are animated, make sure you set the Initial Object Type parameter to Create Animated Static Objects. This is located on the RBD Packed Object DOP.  This will make sure the RBD simulation will keep your animation data.

​

- If you'd like to create a secondary simulation such as clothing on top of your agents, you must unpack your agent geometry. Same goes for almost any other additional effects.

​

- If you'd like to use vellum for your agents clothing, you can associate cloth with agent shapes and simulate the cloth with the overall dynamics of the crowd. Vellum is pretty easy to incorporate into a crowds simulation because it is SOP based, and so are the crowd tools. You can also use the Simple Crowd Cloth node to help integrate the clothing onto your agents better.

​

- Keep in mind, where you set up your agents definitions, is the same place where you will add your vellum cloth on top of your imported geometry. You'll need to also create a new SOP chain to create your cloth simulation/geometry. Then define the outputted geometry for the agents to handle.

​

- When working with the vellum constraints for your cloth, make sure to attach the agent's rest geometry to the third input of your constraints node. Make sure you have at least two vellum constraint nodes in your vellum setup. One for handling the cloth constraints to the agents, and the other for attaching it to the geometry.

 

​

Collisions

​

Getting your agents to collide or avoid each other or objects can be difficult. Here are some useful tricks to get you started.

​

- When trying to get agents to avoid an object you can specify static DOP objects by using behaviors. This is the easiest way to do so.

​

- Make any object an obstacle in your simulation, start by making it a static object. Then select it and click the obstacle button on the crowd shelf tools.

​

- Keep in mind that collisions and avoidance systems are calculated using the geometry around the character/agents skeleton.

​

​

Tips

​

Here are some general crowds tips to help you problem solve in your simulations.

​

- If your agents have a collision layer, that layer will be used as the agent's bounding box. If there is none, the current active layer will be used instead. Keep in mind, the bounding box will be determined by how maybe shapes are referenced in the chosen layer. Also ensure your collisions have an accurate representation.

​

- A lot of time in production, the majority of crowds work will be to push a bunch of agents across a path.

​

- Dropping into wireframe mode will help you reduce lag in your viewport.

​

- Clean up your rigs!

​

- If there are any locomotion actions or movement in your setup between agents, they will refuse to change their speed. This can be tricky to change. FYI any initial velocity will override the direction of your agent.

 

- Ensure your agents have rotation limits on their joints. (no one likes dislocated elbows.)

 

- You can calculate your orient attribute from normals.

 

- Increasing substeps on bullet solvers can hugely help any ragdoll simulations you create.

​

​

References:

​

crowd simulation: http://www.cgchannel.com/tag/crowd-simulation/

​

HOUDINI 15 CROWDS MASTERCLASS: https://houdinitricks.com/houdini-15-crowds-masterclass/

​

Houdini Crowds | Award winning tool by SideFX: https://80.lv/articles/houdini-crowds-award-winning-tool-by-sidefx/

​

Crowd simulations: https://www.sidefx.com/docs/houdini/crowds/index.html

​

Crowd basics: https://www.sidefx.com/docs/houdini/crowds/basics.html

​

Crowd simulation - Tutorials?https://www.reddit.com/r/Houdini/comments/bb99wj/crowd_simulation_tutorials/

​

Introduction to Crowds in Houdinihttps://bubblepins.com/blog/introduction-to-crowds-in-houdini

​

HoudiniCrowd: https://www.tokeru.com/cgwiki/index.php?title=HoudiniCrowd

​

Crowds for Feature Film in Houdini: https://www.cgcircuit.com/course/crowds-for-feature-film-in-houdini

​

MURE: fast agent based crowd simulation for VFX and Animationhttps://www.researchgate.net/publication/305455310_MURE_fast_agent_based_crowd_simulation_for_VFX_and_Animation

​

A few notes on Houdini Crowd Simulations: https://tosinakinwoye.com/2018/10/25/a-few-notes-on-houdini-crowd-simulations/

​

TAG ARCHIVES:
HOUDINI CROWD SIMULATION TUTORIAL
https://lesterbanks.com/tag/houdini-crowd-simulation-tutorial/

​

Atoms Crowd: https://atoms.toolchefs.com/atoms-crowd/

​

NEW VFX TOOLS, AND HOW VFX PROS ARE USING THEM: https://www.vfxvoice.com/new-vfx-tools-and-how-vfx-pros-are-using-them/

​

Crowd simulations in Houdini: https://cgpress.org/archives/cgtutorials/crowd-simulations-in-houdini

​

Crowd Simulation (Houdini, Mantra)http://alinikkhouy.com/crowd-simulation-ii---ali-nikkhouy.html

​

Agent Primitives: https://www.sidefx.com/docs/houdini/crowds/agents.html

​

Crowd basicshttps://www.sidefx.com/docs/houdini/crowds/basics.html

​

Setting up a crowd simulationhttps://www.sidefx.com/docs/houdini/crowds/setup.html

​

Attaching cloth to agents: https://www.sidefx.com/docs/houdini/crowds/cloth.html

​

​

bottom of page