You can use several different methods to animate your scene. Each method has advantages and disadvantages, of course, so before deciding which method to use, read the following sections for a quick review of each method's capabilities. Path Animation You got a glimpse of what path animation can do in Chapter 4, "Diving In: Your First Animation." Generally, in this method, you create a NURBS-based curve and then attach an object to it in your scene (in Chapter 4, the object was the fish). The object then follows the curved path to simulate motion. You can choose at which time the object is positioned at any point along the path, so the object can reverse itself, pause, or oscillate, if you want. You'll revisit this method in Chapter 13, "Cameras and Rendering," to fly the camera along a path into the lobby. Nonlinear Animation Nonlinear animation (known in Maya as the Trax Editor) is a more advanced method of animation. Unlike keyframing, nonlinear animation is completely independent of time. You blend and layer animation sequences called clips to set up the motion for objects. A timeline lets you drop in clips of animation wherever you like and blends clips that overlap. In addition, you can stretch or shrink clips to make the animation keys within them occur faster or slower. You can also use this method to explore variations in parts of the animation without losing your previous work or affecting other parts of the animation. For example, if you want a character to run rather than walk, you can make the walking part of the animation a clip and then adjust the leg motion without affecting the way the rest of the character moves. If you're satisfied with the changes to the leg motion, you can make that running motion a clip and blend it with the rest of the character's animation without losing your previous work on the character. Keyframe Animation Keyframe animation is the standard animation method, and the one you'll use in this chapter. In this method, you set keys for an object's extreme positions and let the computer fill in the in-between motion. For example, if you're animating an arm that will bend, you set a key with the arm fully extended and another key with the arm in a flexed position. Maya then fills in the motion known as the in-betweens that span between the arm's two key poses. Keyframing also depends on time. Simply put, a key is an anchor point for a particular attribute at a designated time. When the animation reaches that specified time, the object's attribute will be at the value you set (keyed). When preparing an animation, you generally specify the range first, as you did in the previous section. You can then place keys for numeric values throughout the range by using the Channel Box or hotkeys. As you set keys, you specify the time at which those changes in the attribute's value take place. To set keys with the auto keyframe method, you click the Auto Keyframe button in the Range Slider (it turns red to indicate that it's enabled). The idea with auto keyframing is that anything that changes creates a key. With auto keyframing, you can animate quickly by simply dragging the Time Slider to a given frame and then changing an attribute. However, you must set one initial keyframe on an attribute for the auto keyframe method to "activate" for that attribute. note Maya offers the option to change an attribute based on other keyed attributes. This is called set driven key animation. For example, you could tie a bouncing ball's motion to a change in its color or the intensity of the light shining on it, so that the ball is more brightly lit when it bounces to its highest point. Tutorial: Hold the Elevator, Please To see how keyframe animation works, you're going to bring your lobby to life. In this tutorial, you'll create a new camera and animate it to travel from the entrance to the elevators, where you'll then animate the glow for the arrows above the middle elevator. Just after the elevator has signaled its arrival, you'll open the doors of the center elevator. This concludes the basic animated elements of the scene, but leaves an opportunity for you to return later, possibly with the character you'll rig in Chapter 12, "Character Animation." Several new details have already been placed in the scene, such as lights above the elevators and operational doors on the middle elevator. You can start by opening the scene file noted next to the DVD icon. This scene contains your fully textured lobby with the lighting added and includes several more detailed elements suggested at the end of Chapter 5, "Modeling with Polygons." On the DVD ch11tut01.wmv |
Use the Preferences dialog box to change the frame rate used for your animation. In the Categories list, click Settings to display the General Application Preferences. Under Working Units, in the Time list box, select the NTSC (30 fps) option. On the DVD Chapter_11\ch11tut01start.mb |
In the Categories list in the Preferences dialog box, select Timeline again. Under the Timeline section, change the Animation Start/End frames to 1 and 600; the Range Slider will be updated accordingly. Next, go down to the Playback section. In the Playback Speed list box, select the Real-Time (30 fps) option. That means when you click the Play button in the playback controls (on the Time Slider), the active viewport regulates itself to play the animation at 30fps. That is, it will skip frames if necessary to keep up the pace. To finalize the changes, click the Save button at the bottom of the dialog box. Notice that the Time Slider shows only 120 frames, but 600 frames are displayed in the Animation End Time text box. This allows you to work in the area the Range Slider focuses on. First, create a new camera (Hotbox | Create | Cameras | Camera). In the Channel Box, set Translate X, Y, and Z to 100, 29, -233. Next, set Rotate Y to 145. Then, set Scale X, Y, and Z to 4. tip The scene is somewhat complex at this point. If interaction seems sluggish in the Perspective view, try turning off the layers for the plant stands and the furniture. Also, viewing the scene in Wireframe mode helps performance while playing the animation. Now, switch the Perspective view to the new camera. To do this, select the Panels option at the top of your Perspective viewport (Panels | Perspective | Camera1). Then turn on the Shaded view (hotkey: 5). You should see the camera facing toward the front doors in the lobby with the elevators just offscreen to the right. Enable Auto Keyframe mode. After you set a key for an attribute, the Auto Keyframe mode automatically places a key each time the attribute is changed at a different point in the timeline. Using the Time Slider, set your current frame to 0. In the Channel Box, right-click over Rotate Y, and choose Key Selected. Attributes that have been keyed are represented in the Channel Box with a shaded (orange, by default) text box. Look at frame 0 in the Time Slider to see that the red bar representing the key that has been set. With a key set at frame 1, drag on the Time Slider. You'll see a slider move across it, indicating the change in frame. Drag the slider to frame 60, or just type 60 in the Current Frame text box. In the Channel Box, change Rotate Y to 115 to set another key. Go to frame 65 in the Time Slider, and open Hypershade (Hotkey: Alt+h). Double-click over the ElevUpLight material to open the Attribute Editor for this material. Scroll down to the Special Effects section, where you'll find the Glow Intensity bar. The number should still be set to 0 at this point. Right-click over the words Glow Intensity in the bar, and choose Set Key. Move the Time Slider to 70, and return to the Attribute Editor. Now, change the value for Glow Intensity to 1. This creates a glow on the material of the upward-pointing arrow above the center elevator doors. To test-view this effect, use the IPR render you learned about in Chapter 10, "Lighting," to view the scene at frame 65. Then, just pull the Time Slider to 70 and see the glow automatically increase in the test render. With the elevator signaling its arrival, you need the elevator doors to open. First, move the Time Slider to 80. Then open the Outliner (Hotkey: Alt+o), and select ElevatorDoorLeft. In the Channel Box, right-click over Translate Z, and choose Set Key. The value should still be 0 for Translate Z. Now, move the Time Slider to 100. With ElevatorDoorLeft still selected, enter 11 for Translate Z in the Channel Box. You should see another red line appear in the Time Slider at frame 100. You need to perform a similar process for the right side of the elevator. Select ElevatorDoorRight in the Outliner, and pull the Time Slider back to 80 to set the first key. In the Channel Box, set the beginning key by right-clicking over Translate Z, and choosing Set Key. The value should still be 0. Next, pull the Time Slider to 100 and change the value in the Channel Box for Translate Z to 11. Play the animation using the controls to the right of the Time Slider. Watch as the camera turns from looking at the entrance of the lobby toward the elevators. As the camera stops, you can't see the glow of the arrow until it's rendered, but you'll see the elevators doors slide open just after that. Everything moves fine, but some parts of the animation seem jerky. In the next section, you'll work with the Graph Editor to smooth out the animation of the camera and the elevator doors. Before going any further, save your scene as ch11LobbyAnimation. |