Tutorial 8: Working with Crowd Animation

Lesson 6: Creating a Crowd of Swimming Bipeds

In this lesson, you'll use a Surface Follow behavior to make a crowd of swimming bipeds stay afloat as they swim on an animated ocean.


Cloning the bipeds

You can clone a gang of bipeds from a single one with Shift-Move.

  1. In the Main toolbar, select biped1 from the Named Selection Sets.

  2. Hold down the SHIFT key and move the biped with the mouse, using the transform gizmo.

    It doesn't matter where you move the biped.

    The Clone Options dialog appears.

  3. Set the number of copies to 5 and click OK.

    You don't have to change the Name field.

    Five bipeds appear next to the original one.

    Tip: You can also clone bipeds one at a time using Edit menu > Clone.

Setting up the behaviors

  1. Select the Crowd object.

  2. On the Modify Panel > Setup rollout > Behaviors group, click New and choose the Surface Follow behavior.

  3. In the Surface Follow Behavior rollout, click the None button and select the Plane01 object in the viewport.

    This defines Plane01 as the surface to follow.

  4. Add a Seek behavior.

  5. In the Seek Behavior rollout, click None, and then select the green pyramid (Buoy) in the viewport.

Scattering the delegates

In this section, you'll use Crowd's Scatter facility to clone the delegate and distribute the clones.

  1. In the Setup rollout, choose Scatter.

    Some of the Scatter parameters are already set up for you.

  2. On the Clone tab, confirm that Object to Clone is set to Delegate01.

  3. Change the How Many setting to 5.

  4. Verify that, in the Position tab > Placement Relative to Object group, "Plane01" appears on the button.

  5. In the Rotation tab > Look At Target group, choose Selected Object, then click the None button and pick Buoy from the list.

    You have not yet generated clones or locations, so there is only one delegate in the scene. You can use the All Ops panel to perform all scatter-related operations simultaneously.

  6. On the All Ops tab, in the Compute column, turn on Clones, Positions and Rotations, and then click the Scatter button.

    The six delegates are now scattered on the surface. Next, you'll redistribute them using random seeds.

  7. Turn on Inc Seed for Positions and click Scatter again.

    This increments the random seed value. As a result, the six delegates move to different locations.

  8. Keep clicking Scatter until you find a random placement you like. Then click the OK button to exit the dialog.

    Tip: You can use this dialog to select and scatter other objects in the scene. Click the Select Objects to Transform button and select the other objects.

Assigning Behaviors

  1. In the Setup rollout, click the Behavior Assignments button.

  2. Group the delegates into a team.

    This method is covered in Lesson 1, Getting Started with Behaviors.

  3. Assign the Seek behavior to the team.

    Assignments are displayed in the window on the right.

  4. Close the dialog.

  5. In the Solve rollout, click the Solve button.

    The delegates seek the buoy for 100 frames and then stop.

    Tip: To Solve, you can click Solve in the Solve rollout, or press S with Plug-in Keyboard Shortcut Toggle turned on.

  6. In the Setup rollout, click Behavior Assignments.

  7. Assign the Surface Follow behavior to the team.

  8. Close the dialog and solve again.

    Now the delegates seek the buoy, but also follow the surface.

  9. In the Solve rollout, change the End Solve frame to 160.

Associating the bipeds and delegates

  1. In the Setup rollout, click Biped/Delegate Associations.

  2. Below the Bipeds list, click the Add button.

  3. In the Select dialog, click the All button and then click Select.

  4. Below the Delegates list, click the Add button.

  5. In the Select dialog, click the All button and then click Select.

  6. Click the Associate button to connect the bipeds and the delegates.

    Nothing changes in the viewport yet. There is more to set up before the bipeds move to the delegate positions.

Creating a Motion Flow file

  1. Select any part of any biped and open the Motion panel.

  2. Turn on Motion Flow Mode.

  3. In the Motion Flow rollout, open the Motion Flow Graph by clicking the Show Graph button.

  4. Create a clip in the motion flow graph.

  5. Right-click to stop creating clips, and then right-click the clip.

  6. In the clip1 dialog, click the Browse button, and then choose rtswimforward.bip from the tutorial 8 subdirectory.

  7. In this file, frames 0 through 80 comprise a cycle.

  8. Change the end frame to 80.

  9. Close the dialog.

  10. This is a file based on the swimmer you created in Tutorial 2: Freeform Biped Animation.

    The rtswimforward.bip file has been modified so there is forward motion for the swimmer. The delegate will take its forward speed from the movement of the center of mass in the .bip file.

    Tip: You can use Layers to add forward motion to a .bip file. Create a new layer, animate the Body Horizontal track, and then click Collapse Layers.

  11. In the Motion Flow Graph dialog, choose Create Transition.

  12. Click the clip to loop the animation.

    This animation can now be repeated to fill the 160 frames of the crowd simulation.

  13. In the Motion Flow rollout, choose Save File.

  14. Name the file myswimloop.mfe.

    You've just saved a motion flow editor file that loops rtswimforward.bip.

Creating a Shared Motion Flow

  1. In the Motion Flow rollout, choose Shared Motion Flow.

    The Shared Motion Flows dialog appears.

  2. Click New to create a new Shared Motion Flow.

  3. In the Parameters group, click the Load .mfe button and select the myswimloop.mfe file you saved earlier.

  4. Click the Add button, click All, and then click Select.

    All of the bipeds appear in the Bipeds Sharing this Motion Flow group.

  5. Click the Put Multiple Bipeds in Motion Flow button, and then click OK.

    You must designate the random start clip so the crowd simulation can solve.

  6. In the Motion Flow rollout, open the Motion Flow Graph by clicking the Show Graph button.

  7. In the *SHARED* Motion Flow Graph dialog, click Select Random Start Clips, and then click the rtswimforward clip in the graph.

    The clip is now displayed in purple with a probability value of 100.

    Since there is only one clip in this graph, it is 100 percent probable that this clip will be used to start.

    Normally, you would have to tell the delegate to use the random start clip that you set here, but this has already been done for you. You'll learn how to do it in the next lesson.

  8. Select the Crowd Object in the viewport.

  9. In the Modify Panel, click Solve.

    After a pause, the bipeds snap into position over the delegate objects.

  10. When the solution is finished, play the animation.

    The bipeds are all swimming above the surface of the water. This is because Crowd always uses the default distance between the delegate and the biped's center of mass as an offset between the two, even if the biped's orientation has changed from its original standing position. You can correct this, allowing the bipeds to swim on the water surface, by changing the Surface Follow behavior's Offset value.

Adjusting the biped positions

  1. Select the crowd object and go to the Surface Follow Behavior rollout.

  2. Change the Position On Surface group > Offset setting to 50.

  3. Solve again.

    The delegates are correctly offset 50 units below the surface. But during the solution, the bipeds are still above the water. This is because, for optimal efficiency, Crowd doesn't apply the offset to bipeds associated with delegates until after it solves the simulation.

    Also, when the bipeds reach the buoy, they don't turn around to try to seek it again, but just keep swimming in the same direction. This is because the motion flow network, with its single motion clip, doesn't provide any means for the bipeds to change direction. This situation is covered in the next lesson: Advanced Crowd/Bipeds.

  4. Play the animation.

    The bipeds are swimming in the water.

Varying the animation

If you want the bipeds not to swim in unison, you need to vary the frame of the animation at which each biped starts. You can do this by letting the software choose a different, random start frame from the motion clip for each biped.

  1. On the Setup rollout, click the Multiple Delegate Editing button.

  2. In the Delegates to Edit group box, add all the delegates.

  3. In the Biped group box, to the right of the Value 1 and Value 2 columns, turn on Random and SET.

    When you turn on Random, the Value 2 parameter becomes available.

  4. Change the Value 2 setting to a different frame number, such as 8.

    This means the software will start the rtswimforward motion clip at a different, random frame for each biped. For example, one biped might start swimming at frame 0, while another might wait until frame 4 to start moving.

  5. Click the Apply Edit button to make the changes and exit the dialog.

  6. Solve again, and then play the animation.

    The bipeds no longer swim in unison.

    In the final lesson, Advanced Crowd/Bipeds, you'll learn how to apply character studio's motion synthesis engine to crowd-influenced bipeds to create motion flow scripts that avoid collisions with other bipeds.