Crowd As computers and software grow faster and more powerful, it's natural to expect that 3D animation can incorporate many more characters than before. But, as in the real world, with greater power comes greater responsibility (usually) and definitely more work, and computer animation is no exception. Every character in a scene must interact in a desirable way with every other character, so the more characters in the scene, the greater the complexity of scene setup. With large numbers of moving characters, the task of keeping things straight manually can become nearly impossible.Enter character studio's amazing Crowd feature (Figure 15.57).Figure 15.57. Biped crowd system using Delegates.
Crowd is all about animating and managing large groups of objects; it has nothing to do with walking or gesturing or inverse kinematics or body structure or motion capture. In fact, Crowd is so different from the rest of character studio that it could almost be considered a separate program. But it's nicely integrated with the rest of cs, so that it's relatively easy to use Crowd to control a large cast of Bipeds. Demonstrating this would go a bit beyond the scope of this book, but the introductory exercises should give you a good idea of what's possible.Using Crowd Crowd uses procedural animation to produce its effects. When you animate with procedures, you use algorithms to create the motion, rather than specifying it explicitly, as in keyframing. This is roughly equivalent to particle animation, except that Crowd uses algorithms better suited to how multiple characters should behave when interacting with each other. When you use Crowd, you specify the number of characters, give each a set of behaviors, and then run the simulation to test your scene.The basis of a Crowd simulation is the Delegate. Much as delegates at a political convention act for the voters they represent, a Crowd Delegate serves as a stand-in for the character it represents. Your simulation should contain as many Delegates as the objects the Crowd will ultimately have.The second important element in a simulation is the Crowd object itself. The Crowd object doesn't act directly in a simulation, but it provides access to all the Crowd controls, including behaviors and cognitive controllers.Here's the standard sequence for creating a simulation with Crowd:
1. | Add one or more Delegates. | 2. | Assign one or more behaviors to each Delegate or group of Delegates. | 3. | Test and refine the simulation until the results are satisfactory. | 4. | Assign characters or other objects (such as birds or fish) to the Delegates, and then create the animation. |
Of course, the above is a bare-bones outline; working with Crowd can become quite complex, partly because for ultimate control you need at least a nodding acquaintance with MAXScript, the scripting language included with 3ds max. Again, this introductory material won't cover that, but it's covered adequately in the program documentation.Starting a Crowd The best way to begin using Crowd is simply, with a single Delegate and behavior.
1. | Reset or start 3ds max. In the Create panel, click the Helpers category and then the Object Type rollout > Delegate button (Figure 15.58).Figure 15.58. Choose Delegate in the Helpers > Object Type rollout.
Note, in the Geometry Parameters rollout, that the default dimensions of the Delegate are 10 by 15 by 10. This really just shows the default proportions, though. You can't automatically create a Delegate of this size; you have to drag it out in the viewport. | 2. | In the Perspective viewport, drag out a Delegate of roughly the default dimensions (Figure 15.59).Figure 15.59. The Delegate is pyramid-shaped.
The Delegate resembles a pyramid pointed in the positive Y direction. Its simple geometry allows for fast generation of crowd simulations, and the shape makes it easy to see which direction it's heading. | 3. | Try rendering the scene, and you'll find that the Delegate doesn't render. In fact, if you examine its object properties, you'll see that it can't be made renderable. However, you can associate any object with a Delegate, so it's not a problem if you need to render a simple test animation. | 4. | In the same Object Type rollout, click the Crowd button, and then drag a Crowd object off to the side of the Perspective viewport (Figure 15.60).Figure 15.60. The Crowd object is a wireframe octahedron.
Like the Delegate, the Crowd object doesn't render. In fact, even in a shaded viewport it appears as a wireframe object. Also, because it's simply the control center for the simulation, its exact position in the scene is unimportant. You just need to have one there.Next, you'll use these two objects to create a very simple animation. | 5. | With the Crowd object selected, go to the Modify panel. In the Setup rollout, click New, and then from the list in the Select Behavior Type dialog, choose Wander Behavior. The Wander behavior causes the Delegate to move forward continuously and change direction randomly at regular intervals.The drop-down list in the Setup rollout now contains the single behavior Wander. You can rename it whatever you like. | 6. | Click the name Wander, and use the keyboard to change it to MyWander. You'll need to use another dialog to assign the MyWander behavior to the Delegate; it's a simple matter of a few clicks. | 7. | In the Setup rollout, click the Behavior Assignments button (Figure 15.61). This opens the Behavior Assignments and Teams dialog.Figure 15.61. Click the Behavior Assignments button.
 | 8. | In the left side of the dialog, click the Delegate01 entry and then the MyWander entry to highlight both, and then click the New Assignment button; it's the tall button with the right-pointing arrows (Figure 15.62).Figure 15.62. Highlight the Delegate and behavior, and then click the New Assignment button.
The new assignment appears in the Behavior Assignments list in the center of the dialog (Figure 15.63).Figure 15.63. The Behavior Assignments list shows all Delegate/behavior assignments.
The entry shows the name of the Delegate, its assigned behavior, the Weight value, and its active status (the X means it's active). |
That's it for the setup; easy enough, right? It remains only to generate the simulation.
1. | Click the OK button at the bottom of the dialog to accept the changes and close it, and then, in the Solve rollout, click Solve.With but a single Delegate and a simple simulation, the solution takes only a few seconds. As it progresses, you can see a blue line projecting from the Delegate, showing the direction in which the behavior is exerting force on the Delegate from moment to moment. This diagnostic tool can be particularly helpful when you're analyzing complex simulations. | 2. | If you can't see where the Delegate went, zoom and/or pan the Perspective viewport until you can, and then play the animation. |
That's it for this introductory lesson, but here are a few ideas for things to try so you can learn more about the process:- Change the Wander Behavior rollout settings to modify the results of the Wander algorithm. In particular, try different Seed values.
- Click the Delegate to see its keyframes, and then reselect the Crowd object and use its Smoothing rollout to reduce the number of keyframes.
Getting More Crowded We'll conclude this introductory look at Crowd by simulating a group of 50 Delegates wandering and avoiding each other.
1. | Reset or start 3ds max, and then, as in the previous lesson, add a Delegate and a Crowd object. Also add a Wander behavior to the Crowd object.The Delegates tend to collide while wandering. Let's slow them down so they'll stay in a limited area. We'll also allow them to wander in three dimensions. | 2. | Go to the Modify panel, select the Delegate, and in the Motion Parameters rollout, turn off Constrain To XY Plane and set Average Speed to 2.0.Next you'll use a special facility within Crowd to create a group of Delegates. | 3. | Select the Crowd object, and then in the Setup rollout, click the Scatter button (Figure 15.64).Figure 15.64. The Scatter button opens the Scatter Objects dialog.
Scatter makes it easy to generate multiple Delegates or other objects if you like. You can specify a surface or volume in which to scatter them, as well as give them randomized orientation and scaling values. The Scatter Objects dialog lets you experiment with different setups so you can get just the results you want. The first panel that comes up in the Scatter Objects dialog is Clone, where you can create any number of copies of a source object. | 4. | Click the Object To Clone button. In the Select dialog, click Delegate01 and then click the Select button. Set How Many to 49, keep the other settings at their default values, and then click Generate Clones. This generates the clones in the same location as the original, so you can't see them all yet because they are superimposed. | 5. | Go to the Position tab of the Scatter Objects dialog. Click In Radial Area (in the second group box, labeled Placement In Area), and change the Radius value to 50.0 (Figure 15.65).Figure 15.65. Click In Radial Area and then set the Radius value.
 | 6. | Click Generate Locations to scatter the Delegate copies within a spherical volume whose radius is 50 units (Figure 15.66). If you like, click it several times to see how changing the Random Seed value, which increments automatically each time you click, affects the placement of the Delegates. You might also try turning on In XY Plane to place the Delegates in a single plane parallel to the home grid. When you're satisfied, click OK to close the Scatter Objects dialog.Figure 15.66. The 50 Delegates are scattered within a 50-unit sphere.
 |
The easiest way to assign behaviors to multiple Delegates is to form a team. You'll do this next.
1. | In the Setup rollout, click the Behavior Assignments button. | 2. | In the right side of the Behavior Assignments and Teams dialog, click New Team to open the Select Delegates dialog. In the dialog, click All, and then click OK. The Delegates appear in the Teams list under the title Team0 (Figure 15.67). You can change this name by editing the field at the top of the Teams group box.Figure 15.67. The Delegates have been added to Team0.
The team name also appears in the Teams list on the left side of the Behavior Assignments and Teams dialog. You'll assign behaviors to the team, but first you'll need to add them to the list. | 3. | In the Assignment Design group, click New Behavior, and then from the list choose Avoid Behavior. Also, be sure the Wander behavior is added. Multiple behaviors need to be added individually in separate operations.Now both behaviors appear in the Behaviors list. | 4. | Highlight the Team0 team and the Avoid and Wander behaviors (drag or use the Control key to highlight both behaviors). Note that Team0 is highlighted in the Assignment Design section and not in the (far right) Teams section. Click the New Assignment button (Figure 15.68).Figure 15.68. The Delegates about to be added to Team0.
 | 5. | Click OK to close the dialog. At this point, the correct behaviors have been assigned, but the Avoid behavior hasn't been properly set up yet, so if you run the simulation now it'll be as if Avoid isn't working. | 6. | In the Solve rollout, click the Solve button. The Delegates move more slowly than before, and they interpenetrate freely. Of course, real-world crowd members can't pass through one another, so we want to avoid this in simulations as well. | 7. | In the Setup rollout, click the drop-down list and choose Avoid (Figure 15.69). The Avoid Behavior rollout appears in the Command panel.Figure 15.69. You can add behaviors with the dialog, but must use the Command panel to set them up.
 | 8. | In the Avoid Behavior rollout, click the Multiple Selection button, and then use the Select dialog to select all the Delegates. | 9. | Solve the simulation (Figure 15.70), and then go to various frames near the start of the animation and arc-rotate the Perspective viewport to check for interpenetrating Delegates. You probably won't find any. Even with the default settings, the Avoid behavior is very effective at preventing collisions and interpenetrations of Delegates.Figure 15.70. The Delegates now wander freely without interpenetration.
 |
This concludes our introduction to character studio's Crowd feature. Obviously, there's a great deal more to Crowd, but we'll leave it to you to explore on your own, and encourage you to do so. In addition to being an excellent, professional-level animation tool, Crowd is a great deal of fun to use. |