Книга: Introducing Character Animation with Blender
Назад: Chapter 8: Facial Animation and Lip Sync
Дальше: Chapter 10: Further Issues in Character Animation

Chapter 9

Animation for Production

So far, you’ve learned most of the basics for making your character move and express himself. Producing an animated movie requires that simple elements of animation be combined with each other and integrated into a scene. Furthermore, even a simple animated production can benefit from keeping processes such as modeling and texturing separated from animation and setting up a well-integrated production pipeline.

Blender has a number of tools to enable you to create animation for a production environment. The armature proxy system and the Non-Linear Animation (NLA) Editor are two of the most significant. The armature proxy system enables you to link rigged characters from external files in a nondestructive way so that the model can continue to be updated even while animation is progressing. The NLA Editor provides a layer of abstraction to work with the actions you created in previous chapters so that you can control looping and speed of actions and combine multiple actions.

. When you do this, a file browser window opens, and you can navigate into another .blend file to select the datablock you want to link (Blender’s file browser treats other .blend files identically to directories).

Linking

f0901.tif

When you link a datablock in this way, the instance in the receiving .blend file cannot be edited. You can only edit the object in the original file, which is now referred to as a library. When you make changes to the object in the library file, the changes will also be applied to the linked instance. When you link datablocks, the relationship on the disk between the library .blend and the linking .blend file becomes important. If the .blend files are moved with respect to one another or if the library .blend is renamed, then the linking .blend file will be broken.

A useful cousin to linking is appending. Append is also found in the File menu and carried out identically to linking. However, when you append a datablock, the appended datablock is a complete and independent copy. The appended object or datablock is no longer dependent in any way on the original file and may be edited. Changes in the original file will have no effect on objects or datablocks appended from that file.

Linking Rigged Characters with Proxies

In the case of props or other things that do not need to be animated or can be animated at the object level, ordinary linking is sufficient. However, rigged characters are more complicated. In particular, the armature needs to be poseable, which is not possible using ordinary linking. For this reason, proxy rigs are used.To link and proxy a rig for animation, it’s necessary to first prepare the library by ensuring that the entire character rig—meshes, armatures, and all—are grouped together in a single group. If you haven’t done that already, do it now.

Using the file from the previous chapter, select all the objects in your Captain Blender rig: the body, the eyeballs, the Empty object that controls the logo mapping, and the rig, as shown in . Press Ctrl+G to group the objects. Grouped objects are displayed with a green wireframe, and in the Properties window under Groups, a group called Group will be displayed for objects in that group, as shown in . Change the name of that group to CB-Rig, as shown in . Now that these objects are grouped, you can append or link them to another .blend file in one step. Save the file with a name that identifies it as a library or resource for the character.

Selecting all the objects in the character rig for grouping

f0902.tif

Grouping the objects

f0903.tif

Changing the group name

f0904.tif

To create a proxied rig from the rigged character in your library, follow these steps:

1. Open a new Blender session. Save the session immediately, as shown in , giving it a meaningful name. Saving is necessary for linking, because the linking process depends on creating a relationship between two relative locations on the hard drive. When you’ve saved the file, delete the default cube.

Saving the fresh session

f0905.tif

2. Choose Link from the File drop-down menu. In the file browser, navigate to the library .blend file on your hard disk. Click the .blend filename to navigate into the .blend file, and then click Groups to navigate into the Groups virtual directory. You should find a datablock there called CB-Rig (or whatever the name of the group was that you created when you prepared the library), as shown in . Select this datablock, and click the Link/Append From Library button in the upper right of the file browser. The grouped rig will appear in your 3D viewport, as shown in . If necessary, press Alt+G to return it to the center of the space. Notice that this group instance can be selected only as a unit. You cannot select individual objects within the group.

Linking the CB-Rig group datablock

f0906.tif

The linked group

f0907.tif

3. Press Ctrl+Alt+P to create a proxy object. When you do this, a menu will open, as shown in , to enable you to choose which object you want to make a proxy for. Choose the rig object. This will make a proxy for the armature. This new object will be named CB-Rig_proxy. If you select it and enter Pose mode, you will be able to pose the character, as shown in .

The Make Proxy menu

f0908.tif

Posing the proxy armature

f0909.tif

4. This step is not strictly necessary, but it’s a good idea to help avoid accidentally selecting the group instance when you want to select the proxy object. Open an Outliner window, and choose Current Scene in the display drop-down menu in the header. To the right of the CB-Rig entry, click the little arrow icon to toggle selectability of the CB-Rig group instance (see ). When this is toggled off, the group instance will not be selectable in the 3D viewport. This will make it easier to select the proxy rig every time. You will never need to select the group instance when animating.

Toggling the CB-Rig group instance to be unselectable

f0910.tif

You’ve now created a proxy rig to do your animating. The Mesh objects are all traditionally linked to their library sources, so if the meshes change in the library, they will change in this scene without affecting the animation. You can now animate exactly as you would ordinarily animate.

From here on, you should do any posing or positioning of the character in Pose mode. This includes simple positioning of your character in space. Do not move the rig proxy object or the group instance in Object mode. If you want to relocate your character in the 3D space, enter Pose mode and do so by moving the root bone, as shown in . Notice that the object center remains at the origin of the space.

Moving the root bone in Pose mode

f0911.tif

. It shows a representation of the Timeline, and the area at the left displays its channels. Both editor views serve the similar functions of arranging or modifying a set of underlying F-Curves to output an animation. Although the DopeSheet displays a simplification of many F-Curve views, with each key representing one or more F-Curve keys, the NLA Editor enables the combination of actions.

NLA Editor

f0912.tif

The main type of element in the NLA Editor is called a strip, and each strip represents one of your already-created actions. In this way, you can use the NLA Editor to place many different actions on the Timeline as strips, layering them, repeating them, and applying other parameters to them to generate a final animation.

Linking Actions to the NLA

To understand the relationship between individual actions and the animation created by the NLA Editor, you’ll take a look at a very simple example. Start a new blend, delete the default cube, and add an armature object with a single bone. Make sure you have your workspace set up so you can see a 3D viewport, an Action Editor, and an NLA Editor simultaneously, as shown in . (You will probably also want a Timeline visible.)

3D viewport, Action Editor, and NLA Editor

f0913.tif

You’ll create two actions. The first action will have the bone swing gently from side to side. Rotate the bone slightly to the right, and key the rotation at frame 1, as shown in . The key will appear in the Action Editor as you expect. In the NLA Editor, a channel will be automatically created for the armature object. Under this channel, slightly indented, is a channel representing the current action, as you can see in .

Press the up arrow key on your keyboard to advance 10 frames to frame 11. Rotate the bone to the left extreme, and key the pose, as shown in . Copy the key from frame 1, and move the duplicate to frame 21. Rename the action SideToSide, as shown in , and notice that the name of the action channel has changed to reflect this in the NLA Editor. Also, set the end frame in your Timeline to 20 to make this animation repeat smoothly.

Keying a first bone pose

f0914.tif

The keyed pose

f0915.tif

Second bone pose

f0916.tif

SideToSide action

f0917.tif

Now that you’ve finished creating the SideToSide action, you’ll create a new action called FrontToBack. To do this, you could simply select Add New from the Actions drop-down menu, which would duplicate the SideToSide action and give you a new action called SideToSide.001. In this case, however, start fresh with a new, blank action. To do this, click the X to the right of the Actions drop-down menu, which unlinks the SideToSide action from the armature. Note that this does not delete the action from your .blend file.

When you create actions, Blender gives them a fake user by default. For this reason, actions remain part of your .blend file, even when they are not in use by any object. (Recall the discussion of fake users in Chapter 1.) To fully delete a created action from your .blend file, deselect the F icon in the Action Editor. After you do this, assuming that no objects are using the action, the action will not be persisted the next time the file is closed.

For now, rest assured that you’re not likely to accidentally delete actions. All this does is remove the action’s association with the armature and thus remove it from the NLA Editor. Select the bone, and press Alt+R to clear any rotations on the bone so you can truly start fresh with the new action, as shown in . Although you have unlinked the action from the armature and removed it from the NLA Editor, notice that the bone stays in whatever position it was in when you unlinked the action. If you want to start from a completely clean slate, be sure to select the bone and press Alt+G and Alt+R to clear any translations or rotations.

Starting fresh with a clear Action Editor

f0918.tif

To create the second action, simply rotate the bone forward a bit around the x-axis and key the pose in frame 1. Again, this will automatically create an action called ArmatureAction, which you will rename to FrontToBack. As you can see in , FrontToBack is now the active action; as such, it is represented in the NLA Editor under the Armature channel.

Creating FrontToBack

f0919.tif

Finish creating a back-and-forth swinging motion around the x-axis by keying a back frame and duplicating frame 1 to frame 21.

You now have two actions created. You can select the active action using the drop-down menu in the DopeSheet header, as shown in . Currently, the active action is FrontToBack because that is the last action you worked on. The active action is also the one represented in the NLA Editor.

Selecting the active action

f0920.tif

Working with NLA Strips

The NLA Editor wouldn’t be much use if all it did was display the currently active action; as you can guess, it does considerably more than this. To insert an action into the NLA Editor so that you can incorporate it into the final animation, you need to create an NLA strip from the action. The NLA strip for an action is separate from the action itself; it is a representation of an action that the NLA Editor can process in various ways.

To create an NLA strip for an action, click the snowflake icon to the right of the action’s name in the action channel. When you do this, the action will be converted to an NLA channel and be made inactive as an action, as shown in . The name of the created strip is the same as the name of its corresponding action.

Creating an NLA strip

f0921a.tif f0921b.tif

Now, in the Action Editor, select the SideToSide action from the drop-down menu and make it the active action. Note what happens (see ): the active action channel in the NLA Editor now contains SideToSide, but the FrontToBack NLA strip remains in place. After an NLA strip has been created for an action, the strip remains in the NLA Editor regardless of what happens in the Action Editor. NLA strips can be deleted like anything else in Blender with the X key, but don’t do that now. Instead, click the snowflake icon to create a strip for SideToSide, which will appear as shown in . You can select strips in the same way as you select other objects in Blender—by right-clicking or by selecting all strips and keys with the A key.

SideToSide as active action

f0922.tif

NLA strip for SideToSide

f0923.tif

Action Output and NLA Output

Animation generated from the NLA Editor is based upon the interaction of NLA channels. The NLA channels are organized by precedence from top to bottom; by default, you will see the animation for the topmost channel in the 3D viewport.

When you select an action in the Action Editor, the action appears as a red channel across the top of the NLA Editor, as you have seen. In this state, the active action is the animation that plays in the 3D viewport, overriding whatever other animation has been created in the NLA Editor. While this action is in this raw action state, there’s not much you can do with it in the NLA Editor. If you want to integrate it in some way with other channels in the NLA Editor, you must convert it to a strip as described previously.

Once the actions have been converted to strips, they can be combined in several ways, determined by the Blending value of the uppermost strip. The default Blending value is Replace, meaning that the uppermost strip will override the strips below it. So, for example, if you play the animation that you just created, you will only see the SideToSide movement. However, if you change the Blending value to Add in the Properties Shelf (toggled visible with N key), then the F-Curve values of the two action strips add to one another, resulting in a diagonal swinging movement that is the sum of SideToSide and FrontToBack, as shown in .

Multiplicative blending and subtractive blending are also available. However, these blending options are less frequently used, and their results are less intuitive than additive blending. For most armature animation, you will use either replacement or additive blending.

The two strips playing with additive blending

f0924.tif

More Fun with NLA Strips

NLA strips are more than simply instances of actions. They also have a number of properties of their own that determine their behavior and how the action they contain interacts with the whole animation. You can see the properties of the selected strip in the Properties Shelf in the right side of the window. As always, the Properties Shelf is hidden and shown with the N key.

Among other things, the strip’s transform properties determine the starting and ending points of the strip and the number of repetitions of the action the strip represents. When first created, the number of repetitions is 1, and the length of the strip is identical to the length of the action itself. Select the topmost strip, SideToSide, and set the Repeat value to be 3 while keeping the End Frame value at 21, as shown in .

Changing the repeat value of the strip

f0925.eps

You can now see the difference between playback modes very clearly. The bone swings back and forth at triple speed, per the repeating strip, three times for every one forward-backward swing.

You can isolate individual strips by clicking the little dot to the left of the strip’s name. This will show you only the selected strip’s animation result in the 3D viewport.

.

3. Raise the Empty object up along the z-axis so that it is somewhere around the middle of Captain Blender’s body, as shown in . This is the point at which the camera will aim.

Initial camera and empty positions

f0926.tif

Adjusting the location of the Empty object

f0927.tif

4. Position the camera directly in front of the Empty object, some distance away, as shown in .

Initial camera position

f0928.tif

5. Select the camera first, and then choose the Empty object second (making sure no other objects are selected). Having them on their own layer should be helpful for this. Press Ctrl+T, and select the TrackTo constraint, which causes the camera to point directly at the Empty object at all times.

6. Next, with the same objects selected in the same way, press Ctrl+P to create a parent relationship. This parents the camera to the Empty object so that when the empty moves, the camera also moves.

7. Press 0 on the numeric keypad to go into camera view. In this mode, you can select the camera object by clicking the rectangular line around your view. Move both the camera and the Empty object to create a nicely framed view of your subject. Remember that to move the Empty object or the camera up or down, you can select the object and translate along the global z-axis. To zoom the camera in and out, select the camera and translate along the local z-axis. Press G and then press Z twice. Your shot should wind up looking something like the example in .

View from the camera

f0929.tif

8. Press 7 on the numeric keypad to get back into top view, and select the Empty object. Key its rotation. Move forward 10 frames; rotate the empty slightly counterclockwise, constraining the rotation to the z-axis; and key its rotation again.

9. With the empty selected, open an F-Curve editor window. Select the first point, and place it manually at x position 1 and y position 0 by inputting the values directly in the Key X and Key Y fields. You want the Empty object to complete a 360-degree rotation in 101 frames. So, set the second point to Key X value 101. For the Key Y value of the second point, remember that you must express angles in radians. There are 2π radians in a complete circle, but you don’t need to calculate this yourself. Simply enter 2*pi in the field, and Blender will automatically calculate the value to 6.283, as shown in . Make sure that the handle types are set to Vector for both points and that the extrapolation type is linear.

You should now have a smooth camera rotation that cycles after 100 frames. Set your Timeline end frame to 100, go into camera view by pressing 0 on the numeric keypad, and click Play to watch the rotation from the camera’s point of view.

Setting the F-Curve point values

f0930.tif

Using NLA Strips to Sync Walk Cycle Repetitions

To make your character walk, you first need access to the Walk action that you created previously. You can append the Walk action datablock from the library file in the same way you append any other datablock. Choose Append from the File menu, and use the file browser to navigate into the CB-CharacterResource.blend virtual directory. There, you will navigate into the Action virtual subdirectory, as shown in , and select Walk. Click the Link/Append From Library button.

Appending the Walk action

f0931.tif

Now Walk will appear in the Action Editor drop-down menu. Select the CB-Rig_proxy object, enter Pose mode, and select Walk from the menu, as shown in .

Convert the Walk action to a NLA strip as you learned to do in the previous section. Set the repetitions to 2, and set the End Frame value to 101, as shown in . When you’ve done this, you’re finished. Your character’s walk cycle will play twice for each complete rotation of the camera, and both movements will repeat smoothly after 100 frames.

For a quick preview, play the animation with only the armature layer and the camera layer visible, which plays back much faster than including the mesh in the view and shows how smoothly the cycle point turned out.

Selecting the Walk action

f0932.tif

Settings for the NLA Walk strip

f0933.tif

Mixing Actions: Walking and Talking

The real power of the NLA Editor is in its capability to combine multiple actions into a single animation. When several animations overlap, Blender decides whether there are any F-Curves that overlap each other (that is, curves that influence the same values), and if so, it assigns a precedence to the curves (or, if you chose additivity, it adds them). In cases where curves do not conflict, such as when separate F-Curve channels are involved or when the F-Curves belong to different bones or objects, the motion from all F-Curves is played simultaneously.

For this example, you can continue working on the same scene that you worked with for the previous example, but you will need to append the Speech action, just as you appended the Walk action in the previous section.

To set up a nonlinear animation using the two actions Walk and Speech, follow these steps:

1. Select CB-Rig_proxy, and enter Pose mode. In the DopeSheet, in Action Editor mode, select the Speech action (you need to have appended this action from the library already, or it will not show up in the drop-down menu). When you’ve done this, the action should display in the Action Editor and the NLA Editor, as shown in . Notice that the Walk strip is already present.

The Speech action

f0934.tif

2. Create an NLA strip from the Speech action by clicking the snowflake icon. You need to decide whether Blending for this should be additive or replacement. They are both possibilities to consider here. With additive blending, the swinging of the arms will be incorporated into Captain Blender’s gesticulations, which makes it look like he’s talking while hurrying or doing some kind of cardio exercise. Be careful, though; in this case, the additive effect on the fingers causes them to crunch up unnaturally. For this example, use Replace blending. The NLA strips will look as shown in .

The two action strips in the NLA Editor

f0935.tif

3. Place your Speech action strip along the Timeline where you want it by selecting it and moving it with the G key. Set the Blend In and Blend Out values to 20 to create a very smooth transition between the Walk poses and the Speech poses. This particularly affects the arms. A shorter Blend In value will make the transition from the lower action strip pose to the higher action strip pose more sudden. The Blend Out value corresponds to the end of the higher action strip. The results look like .

Preview your animation, and watch Captain Blender walking and talking at the same time while the camera rotates.

The combined action strips in motion

f0936.tif

Actions for Nonarmature Animations

Actions were originally developed as a way to organize armature movements. However, in Blender 2.5, they have been expanded to work for all kinds of animation. In , you can see location, rotation, and scale keys on the default cube object displayed in the F-Curve editor, the Action Editor, and the NLA Editor. This action can be converted to an NLA strip in the same way as any other action.

An action on the default cube object

f0937.tif

You’ve covered quite a bit of ground at this point, and by now you should have a pretty solid basic understanding of how to do character animation in Blender. You know how to build and animate a character using armature deformations and shape keys, and you know how to combine basic animations to create more sophisticated ones in the form of actions in the NLA Editor. There are still a few topics left to cover, though, before you’ll be ready to produce your own animated shorts to completion. In the next chapter, I’ll go over a few more tips and techniques related to character animation that I haven’t had the chance to discuss so far.

Назад: Chapter 8: Facial Animation and Lip Sync
Дальше: Chapter 10: Further Issues in Character Animation