+ HOUDINI CROWD NOTES

Houdini crowd notes

Geo (load the fbx)

  • geo
    create a geo node, name it “agent_bake”

Inside this geo node we will create agent nodes for the rest, short and long jumps. The rest network will be used to write out the agent primitive and the other agent nodes will write out the animation clips.


Rest (geo & rig)

Here we will setup the agent primitive to prepare to write it to disc.

  • agent sop:
    name it “rest”
    • agent name: leg
      dont think this name matter, but OCD
    • current clip: rest

    • input: fbx

    • fbx file: leg_rest.fbx

    • convert to units
      could be unchecked to make sure the inported fbx is not to small
    • clip
      • clip name: rest
        it does not matter which clip we use when writing out the rig, but OCD
    • locomotion

      • convert to in-place animation: 1

      • locomotion node: select transform
        select the part of the rig that is translating the character forward
      • locomotion orient: select transform
        select the part of the rig that is orienting the character forward

connect to –>

We will create two agent layers called costume_1 and costume_2. The first layer (costume_1) will have an incomming connection from the agent sop the second (costume_2) will have in connection from the previous agent layer sop and the output will be connected to the out null.

  • agent layer
    we will create two agent layer sops, one for each leg version (connect the first to the second)
    • layer name: $OS
      costume 1 & 2
    • layer bindings
      click the plus to add a layer (we will add 2)
    • transform name: world root
      for both
    • shape: leg_version_1 & leg_version_2
      and the bolt

connect to –>

  • Null
    OUT_rig

Animation clips (Short jumps & Long jump)

Here we prepare to write out the animation clips. We will create two of these networks (one agent sop connected to an out null) we call it long respectively short jumps.

  • agent sop:
    name it “short_jumps”
    • agent name: leg
      dont think this name matter, but OCD
    • current clip: short_jumps

    • input: fbx

    • fbx file: short_jumps.fbx

    • convert to units
      could be unchecked to make sure the inported fbx is not to small
    • clip
      • clip name: short_jumps
        it does not matter which clip we use when writing out the rig, but OCD
    • locomotion

      • convert to in-place animation: 1

      • locomotion node: select transform
        select the part of the rig that is translating the character forward
      • locomotion orient: select transform
        select the part of the rig that is orienting the character forward

connect to –>

  • Null
    OUT_short_jumps

OUT (save to disc)

Here we will render the agents to disk. We will create an agent driver node for each of the agent sop networks we setup earlier. The difference is that we will write out all the outputs (rig, agent layers, shape library, clips, transform groups) in the rest agent rop but in the agent drivers for the animation clips we will only render out the clips (uncheck rig, agent layer, shape library, transform groups)

  • agent driver

    • source

      • source: agent primitive

      • SOP Path: OUT_rig (and OUT_short_jumps/ OUT_long_jumps…)
        point to the out sop null node
    • output

      • agent name: leg

      • rig
        enabled for rest
      • agent layers
        enabled for rest
      • shape library
        enabled forrest
      • clips
        enabled for rest, long_jumps, short jumps
      • transform groups
        enabled for rest

connect to –>

  • merge
    connect all agent drivers to thes merge and render out from this

Geo (load the agents)

  • agent sop:
    name it “agent”
    • agent name: leg
      must be the same name as in the agent name output in the (OUT) agent driver
    • input: disc

connect to first input of: –>

  • crowd source

    • setup

      • initial velocity: 0, 0, 0
        since we will use locomotion to drive the position of the agents, we want to set the initial velocity to 0
    • randomize
      here we can do all sorts of randimizations.
      • layers
        which (geo) layer that will be used
      • states
        which states to use. The states
      • etc…

connect to –>

  • null
    name it OUT_agents

DOP (crowd sim)

  • dop network
    create a dop network node, name it “agent_sim”

Here we will do the crowd simulation. Step into the dop network.

  • crowd solver

  • crowd object
    connect to the first input of the crowd solver
  • crowd source
    connect to the second input os the crowd solver
    • source
      • SOP: point to the OUT_agents null
  • crowd state
    we will create as many state nodes as there are animation clips. We call them the same as the animation clips. Create a merge node and merge the state nodes. connect the merge node to the third input of the crowd solver.
    • Clip name: $OS
      name $OS by default. To make it easier to keep track of the states and anim clips call the node the same as the anim clip.

Locomotion

Since we baked out the locomotion of the character to the animation bclip, the simulation will use this to move the our character (if we set it up to do so)

Locomotion & Motion FX View

If we want to see the locomotion animation curve we can do the following. Step into the geo node where we load our agent from disk (load the agents). Creat a CHOP node and step into it and create the following:

  • agent

    • agent

      • sop path: point to the agent (in the geo context above)

      • clip name: select the clip name

connect to the first in put of:

  • delete

    • delete: none-scoped channels

    • channel names: *loc*

Move the display flag to the delete (and turn of on the agent) We should now see the locomotion curve.


Agent Clip properties

This SOP creates 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.

Go into the geo where we load the agents. Create:

  • agent clip properties
    connect the output from the agent sop to the input.
    • clips:
      click the + to add as many instances as needed
    • clip name: “long_jumps”
      select the clip we want to adjust
    • clip name alias
      specifies a new name that will be used to refer to the modified clip. This can be useful when creating several clips from different sections from the same animation clip.
    • loop range: enable & set range

    • blend while looping: 1

connect to –>

  • null
    name it OUT_clip_properties

Foot planting

To avoid the foot sliding on the ground we can use foot planting. Lets go into the bake agents node. It is possible to add this in the geo node where we load the agents from disc, but it can be nice to write this to the bclip that we store on disc. We add the agent prep between the agent node and the null. We need to create and agent prep for each of the streams: rest, short and long jumps.

  • agent prep

    • additional channels
      click the “create foot palnt CHOP network” this will setup a chop network where we can add the footpalnt channel.
    • modified clips: autogenerated
      if you change the name of the chop network make sure to update this path

CHOP (autogenerated from agent prep)

This chop network that we generated from the agent prep will write out all the incomming channels and the merge node lets us add additional channels. We need to create two foot plant nodes and merge it in with the other channels. We need one for the ankle and one for the toe since they are the part of the rig that will interact with the ground and that we want to be “planted”. In the example below we will do the ankle, we need to do one for the toe aswell. Lets step into the chop network and create:

  • foot plant (ankle & toe)
    lets call it “ankle_plant”
    • foot plant

      • source: agent
        depending on what the source is set to various attributes gets displayed in the ui of the foot plant node.
      • sop path: path to agent (“long_jumps”)
        point to the agent that we wish to add the foot plant channel to. Make sure it is the agent node and not the null out node.
      • clip name: “long_jumps”
        the clip that we wish to add the foot plant channel to
      • transform name: ankle
        the transform node that we wish to create the foot plant for
      • channel name: $OS
        since we use $OS the name of the node will be used as channel name

Create on more for the toe (the foot plant node will be called toe_plant, and the transform name will be toe) merge in the two foot plant nodes.

Click reload on the agent prep nodes. No lets go to the out context and write out the clips (again)

Setup the foot plant (use the plant channels)

Now lets step into the load_agent network. insert an agent prep between the agent node and the crowd source. We need to add information of which foot plant channels and which bones that are involved so that the crowd solver can use this information. Click reload on the agent to relaod the clips from disk.

  • agent prep

    • agent

      • lower limbs
        click the plus to add ui inputs
        • upper leg: “thigh”

        • knee: “calf”

        • ankle: “ankle”

        • toe: “toe”

        • ankle plant channel: ankle_plant
          the plant channel we added in the chop network
        • toe plant channel: toe_plant
          the plant channel we added in the chop network

We can use a “test simulation: crowd transition node” to verify our foot planting. Connect the agent to the first input and the agent prep to the fourth. Make sure that the foot locking under the terrain tab is checked.


Terrain projection

Here we can define a ground geo and have the foot planting stick to the geo. At object level lets create a geo node and call it ground. Step into the geo and create a grid. If we want we can add a mountain to deform it, add a color and hook it up to an OUT_ground null.

Step into the crowd sim and select the crowd solver.

  • crowd solver

    • particle motion

      • orientation update

        • adjust up vector: enum
          if the terrain is really deformed we might want to set it to “set to terain normal” default is “unchanged”
    • terrain

      • enable terrain projection: 1

      • sop path: point to the OUT_ground null

      • offset: float
        how much the chracter rig will be offset from the ground (feet & tow still planted)
      • stick to deforming geometry: bool
        if the geo is deformed or moved the crowd will stick to it

We might need to adjust the ankle and toe offset of the agent prep. Step into the agent_load geo and select the agent prep that we added to implement the foot locking. Make sure that the display flag is set to the agent prep. Adjust the offset so that it aligns with where you wish to have the foot planting to occur.

  • agent prep

    • ankle offset: vector

    • toe offset: vector


Path following

To add behaviours to the agents we add nodes between the state nodes and the solver. So for instance if we want the crowd to follow a path we can add a pop steer path node between the states and the solver. Note that if we want it to only affect a certain state we set it between the state ond the solver if we have multiple states merged and we set the node after the merge the behavour we affect all merged states.

create a curve in a geo node (possibly in the ground geo) and hook up and OUT_curve at the end. Step into the crowd sim and add:

  • pop steer path

    • output attribute: crowds steerforce

    • anticipation: 0.1
      to make it stay close to the path
    • path variance: 0.1
      to make it stay close to the path

If we get a result where the agents are not behaving as predicted we might need to enable the “project forces of the crowd solver.

  • crowd solver

    • particle motion

      • velocity

        • project forces: 1
          this is off by default. By enabling it we make sure that the forces ar perpendicular to the up vector
    • orientation update

      • max turn rate
        this controls how fast the agents are allowed to turn. Generally you can get a way with a higher turnrate when the camera is further away from the crowd. When you are closer a high turn rate can look bad, so then it can be dialed down. Note that lower turn rate makes the agents harder to control (sticking to a steer curve, avoiding obstacles) since they take longer to adjust their direction.

Obstacles

To create an obstacle we lay down a geo node add some poly spheres to encompass what we want to avoid and hook up to nulls. Inside the crowd sim we add a popsteerobstacle node.

  • pop steer obstacle

    • sop path: path to geo