Setting up for the final animation
It's time to mix together everything we've done!
Our goal is to have several strips in the NLA Editor that we can move around and adjust. The strips will be:
- lip sync
- blink (several separate blinks)
We can check off #1 and #2, we have the walkcycle and wave actions already in the NLA Editor. We have the lip sync animated, but it's not in the NLA Editor yet.
Adding shape keys to the NLA Editor
The NLA Editor was originally designed only to work with armatures. In recent versions of Blender, we now have the option to add shape key actions (like the lip sync action) to the NLA Editor, but it's not as straightforward as with armatures.
Note that down in the NLA Editor, the Plane (the name of the character mesh, since that's what it started as and we never renamed it) has a row. I've kept the name "Plane" to remind us of how far we've come! (If you want to rename it, use the OB: text box in the Link and Materials panel, under the Edit buttons, or, the Object and Links panel under the Object buttons).
- Press C to create a strip from the lip sync action.
A strip is created, but it's only a placeholder for now. It's a single frame long and it's actually BEFORE frame 1. We have to change some settings to let the NLA Editor know we want this lip sync action to be a strip.
Note that there are no keys in the Lip sync channel right now.
- Change a window to the IPO Curve Editor. I changed the Action window into an IPO Curve editor.
- In the IPO Curve Editor, change the IPO Type to shape.
Several curves appear. These curves are another way of visualizing the keys we added for the lip sync. The X-axis of the IPO window is time, or frames. The Y-axis of the IPO window reflects the slider setting, or how strong the shape is activated. Each curve is for a different shape, and they are color-coded. The dots on the curves are the actual keys.
If you compared the IPO window with the Action Editor, you'd find that the frame number of each dot in the IPO curves matches the frame number of each key in the Action Editor. Both views are useful.
You can fine-tune the animation through the IPO curves. RMB to select a curve, and ⇆ Tab to enter the curve's edit mode, where you can adjust the shape of the curves. This is where you have the finest control of the keyframes in the animation, and is often the place to go for really fine-tuning an animation.
For now, we're going to leave the IPO curves alone, but before we leave the IPO window:
- Click the button next to the IPO Type menu (I'm actually not positive what the tool tip actually means, but I know this is what needs to be done for everything to work).
Note that there are now keys visible in the NLA Editor for the Lip sync action, and the NLA strip returned to its true length.
NLA Strips for shape keys
In summary, in order to add shape key actions to the NLA Editor, you have to:
- Important: Go back to the NLA Window and make sure NLA mode is activated for both Armature and Plane.
- Important: Select the armature and turn off Rest Position
- Press AltA in the 3D Window to view the animation. The character walks AND talks!
Now what happens if we want to adjust where in the walkcycle he says the words? We can easily slide the Lip sync strip where we want it, but the sound won't follow. The sound strip is not in the NLA, it's in the Sequence Editor. Slightly confusing, and future versions of Blender may change this. For now, we have to do things by the numbers.
- Select the Lip sync strip in the NLA Editor and press N to bring up the Strip Properties panel (if it's not already visible).
- Take note of how long the strip is: Action Start is 1, and Action End is 22, so the strip is 21 frames long. Strip Start and Strip End are currently the same, but we're about to change that.
- We need the frame to start on an integer, because a limitation of the Sequence Editor is that we can only start the sound clip on an integer frame. One way to do this is to move the NLA strip for the Lip sync with G, and then round the Strip Start: and Strip End: number boxes down. I moved the strip to 50.42 (and it went to 71.42) then I typed in the Strip Properties the Strip Start: 50 and Strip End: 71.
- Switch to the Sequence Editor.
- Select the sound clip with RMB and move it with G.
- Move the sound clip so it starts on the same frame as you typed in for the Strip Start in the previous step (I moved it to frame 50).
- Play the animation - the sound and lip sync should now occur at frame 50.
Now we'll add some eye blinks to add a little realism. First, create a single blink action:
- Select the armature.
- Set the armature to Rest Position in the Armature panel under the Edit buttons.
- Select the character mesh.
- Select ADD NEW from the menu at the bottom of the Action Window.
- Rename the action to Blink.
- Add a 0.0 key for Upper lids close and Lower lids close at frame 1.
- At frame 3, move the sliders for these two shapes to get a good closed eye shape.
- At frame 5, add 0.0 keys again.
Now convert the "Blink" action to an NLA strip:
- With the action still selected, switch to the IPO window.
- Make sure Shape IPO Type is selected in the IPO window menu.
- Enable IPO curves for this action by pressing the button.
- In the NLA window, press C to convert this action to an NLA strip.
Now, duplicate the blink strips:
- With the Blink NLA strip selected, duplicate it with CtrlD. A second Blink strip appears.
- Duplicate these strips as many times as you want blinks.
- Move the strips along the NLA Editor to where you want the character to blink.
- Enable NLA mode for the Armature, and AltA to view the animation!
Package the sound file (optional)
You can pack the sound file in with the .blend file so that you can send the file to another computer that doesn't have the sound file. To do this,
- Go to the Sound buttons
- Click the Pack button to package the sound file in the .blend. This will make the file size increase, but is very convenient when you're moving files around.
Rendering the animation
Animations with sound
Blender is not yet capable of rendering an animation with sound. What you have to do is save the rendered animation (video only), then add the audio track in another program such as VirtualDub.
When you're ready to render an animation:
- Choose a camera angle and set it with CtrlAlt0 NumPad. Or, if you're feeling advanced, animate the camera! (Hint: insert keys with I. The keys will show up in the IPO window).
- In the Buttons window, select the Render buttons.
[User edit] You need to select the two layers (for the mesh and the eyes). Otherwise, only the mesh will be rendered.
- In the Output panel, click the folder icon in the first row to choose an output directory. Once you've navigated there, click the SELECT OUTPUT PICTURES button in the file browser.
- Set the start and end frames to animate, either in the Timeline or in the Anim panel under the render buttons.
- Set the size of the output in the Format panel. A good size to start is 320x240.
- Set the output type to AVI Raw.
- Press the ANIM button. The animation will be rendered to the output directory you specified as an .avi file.
Directions for adding sound with VirtualDub
The .wav file that we animated to was short, and appears somewhere in the middle of the animation. We can have Blender add the appropriate amount of silence to the beginning and end of the sound clip and export it so it's the exact same length as the animation. To do this,
- Go to the Sound buttons
- Click the MIXDOWN button. It appears nothing happened . . . until you look in the Output directory (the directory you set in the Render buttons Output panel). There you will find a new .wav file, named after the Start: and End: frames you set in the Timeline window (something like "0001_0120.wav").
Later builds of Blender will include the FFMPEG library, which will have a multiplexing option, allowing you to interleave audio with video in one step. For now, you can use the instructions below.
Here are instructions for adding audio with the excellent free program VirtualDub.
- Download and install VirtualDub if you don't already have it.
- Load the MyAnimationFileName.avi file you created into VirtualDub
- Go to Audio>>Wav audio and load the .wav file you just exported from Blender.
- Optional: Go to Audio>>Interleaving.
- In the "Audio skew correction" section, enter a number of milliseconds into the animation you want the sound to start. This will take some playing around with to get right.
- Go to File>>Save as AVI and save the .avi file to disk. The .wav file will be added to the .avi.
Previous: Sound and lip sync