Now that each joint manipulates the mesh, we can animate them to create various facial expressions. In the model's present state, this would be a long and tedious job, so we will add a rig to the joints much like the one we created for the hands.
We will first add the ability to create quick poses for common facial expressions, and then we will create a small library of mouth shapes to help speed up any lip-synching. Finally, we will create individual controls for the eyes and eyebrows.
Before we implement the rig controls, we will need something to manipulate them, so let's first create a series of dynamic attributes that will drive the joints.
The most obvious place to put attributes is the HeadControls icon, so select this first.
The HeadControls icon already has quite a few attributes on it, but we'll hide some of these later in Chapter 15, "Finalize and Clean Up."
Go to Modify > Add Attribute to open the Add Attribute window.
Start with a basic Boolean called _ (a single underscore). This may seem to be a strange name, but this is going to be a dummy attribute, acting as a divider to help us quickly navigate the Channel Box and get to the attributes we need.
Right-click on the new attribute's name in the Channel Box, and select Lock Selected from the menu. This turns the attribute gray, which will also help us visually.
Now we will create the first section of actual attributes. Create four Float attributes called Happy, Shock, Angry, and Injured, giving them a minimum value of 0 and a maximum of 10. These will form the main facial poses.
Create a second divider attribute, this time called __ (two underscores); you can't repeat attribute names on the same object. Remember to lock this, too, using the same method as in step 4.
Now we will add the attributes that will drive the mouth and form the various mouth shapes we need for lip-synching.
Create 10 attributes this time, all with a Data Type of Float and having a minimum value of 0 and a maximum of 10. Call these O, CDENSZ, AKI, L, MPB, FV, Ooo, Ahh, Smile, and Frown. These names represent the sounds the mouth will form.
Create and lock a third and final divider named ___ (three underscores). You will now add attributes to control the eyelids and eyebrows.
Create six new float-type attributes named LeftInnerBrow, LeftOuterBrow, RightInnerBrow, RightOuterBrow, LeftEyeLids, and RightEyeLids. Give these a minimum value of 10 and a maximum value of 10.
Your Channel Box should now resemble that shown in Figure 13.24.
Figure 13.24. The HeadControls icon with extra facial animation attributes added
We have all the attributes we need for now, but feel free to add more if you want them. In the next section, we'll wire them up.
Rig Creation, Main Poses
With the main controls for the facial rig created, we will now use Set Driven Key to connect the controls to the joints. First we will define the main facial poses.
Open the Set Driven Key dialog box (Animate > Set Driven Key > Set), and load HeadControls in the Driver section. (Select HeadControls and click on Load Driver.)
Next select all the joints associated with the face, and click on Load Driven.
Select the Happy attribute next to HeadControls, and select all the translation and rotation attributes next to the joints. Your Set Driven Key dialog box should look like that in Figure 13.25.
Figure 13.25. Set Driven Key with all needed objects loaded
Click on Key to store the base pose for the Happy attribute.
Repeat steps 3 and 4 for the Shock, Angry, and Injured attributes, storing their base poses.
Now we can start building individual poses for Kila.
Select the HeadControls icon, and set Happy to 10 in the Channel Box.
Position each face joint, using rotations and translations so that Kila looks happy (Figure 13.26a). Make sure you use a facial expression reference at this stage, or even grab a mirror and copy your own smile.
Figure 13.26. The four main face poses: Happy, Shocked, Angry, and Injured
Click on Key in the Set Driven Key dialog box, and then test the Happy attribute.
Set Happy back to 0. Set Shock up to 10 in the Channel Box, and select Shock in Set Driven Key. Remember that moving the timeline back to 0 will pop the joints back to their default position.
Adjust the face joints so that Kila appears shocked (Figure 13.26b), and set a key to store this pose.
In Set Driven Key, select Angry next. Then set the Shock attribute back to 0, and Angry to 10.
Give Kila an angry-looking face like the one in Figure 13.26c. Press Key in Set Driven Key to store it in the Angry attribute.
Finally, set Angry back to 0 and Injured to 10, and then select Injured in Set Driven Key.
Give Kila a face expressing that she has just been hurt and is about to cry (Figure 13.26d). Set a key to store it.
Setting these poses means we can quickly give her face movement and the ability to express emotion.
Rig Creation, Mouth Shapes
Using Set Driven Key again, let's connect up a set of attributes that will make Kila talk.
You should still have the Set Driven Key dialog box open; if it's not, reopen it. Reload HeadControls into the Driver section.
You will only be controlling the mouth area, so reload just the jaw, lips, and tongue joints into the Driven section. Select the rotation as well as the translation attributes in the list on the right.
Work your way down this section of attributes, starting with O and ending with Frown, setting a key on each one to store the default pose.
Select O again in Set Driven Key, and set the same attribute to 10.
Now adjust the joints of the mouth to make her look like she is saying the letter O (Figure 13.27a).
Figure 13.27. Kila's mouth shapes
Try to exaggerate the mouth shapes slightly when you create them. This will give the animators a bit more flexibility when they are doing lip-synching.
Set O back to 0, and set the attribute named CDENSZ up to its maximum of 10.
Our mouth shape is similar when we say any of the letters C, D, E, N, S or Z, so we can combine them into a single attribute for Kila. Adjust the mouth as seen in Figure 13.27b. Make sure CDENSZ is selected in Set Driven Key, and then set a key.
Next up is AKI. Set this to 10, remembering to reset the CDENSZ attribute to 0.
As you did for CDENSZ, pose the mouth so she is saying the letter A, K, or I (Figure 13.27c). This is quite similar to the CDENSZ mouth shape, but the mouth is open slightly more. Then select the AKI attribute and set a key.
The L pose is next (Figure 13.27d). Set the L attribute to 10 and the AKI attribute to 0. Pose the mouth, this time remembering to pose the tongue under the upper teeth. Then store the pose by setting a key on the L attribute in Set Driven Key.
Set MPB to 10 and reset L back to 0.
You could just use the default pose to get the look of M, P, or B, but as you can see in Figure 13.27e, creating a pose where the lips are closed tighter will emphasize the shape. When you're done, set a key on the MPB attribute in Set Driven Key.
Next is FV. For this shape we want to tuck the lower lip under the upper teeth (Figure 13.27f). First set up the attributes by setting FV to 10 and MPB back to 0. Pose the mouth and, with FV selected in Set Driven Key, set a key.
Next set Ooo to 10 and FV to 0. Pushing the lips forward and together slightly will give us the Ooo shape seen in Figure 13.27g. Set the key for Ooo in Set Driven Key.
For Ahh, you want just a general open-mouth shape. Manipulate the jaw joint and then position the outer lip joints so you end up with a mouth like the one in Figure 13.27h. When you're done, set the key.
Kila won't be miserable all the time, so you need to make her smile. Set the Smile attribute to 10 and reset the Ahh attribute to 0. Give her a lovely big smile as in Figure 13.27i, and set a key on the attribute.
Finally, implement the Frown. Set Frown to 10 and Smile back to 0. Then adjust the joints to make her look sad (Figure 13.27j), and set a key on the Frown attribute.
The principal shapes for the mouth are now set up and ready to be animated. Because we're using joints, we're not restricted in the number of poses we create for this element, so feel free to make more if your character needs them. You might want to assign more options to the tongue, allowing her to stick it out or something similar, but only add what will actually be used. It's a good idea to consult with your manager to make sure vital expressions are covered, but a conversation with the animator is also important at this point. There may be some mouth shapes needed for quick lip-synching.
Rig Creation, Eyebrows and Eyelids
The final facial areas we will rig are Kila's eyelids and eyebrows. These are key areas in expressing emotions, so it's crucial that we add the ability to animate them quickly and easily.
You should be getting the hang of setting driven keys by now, so in the procedures from this point on we can safely leave out some of the details.
With the Set Driven Key dialog box open, make sure HeadControls is loaded into the Driver section, and that the four main eyebrow joints are loaded into the Driven section.
We first need to store each joint's default position, but each eyebrow attribute should only affect one joint, so we will need to work on the joints individually.
As demonstrated in Figure 13.28, select LeftInnerBrow next to HeadControls, and then all the translations and rotations next to L_InnerBrow. Set a key.
Figure 13.28. Select a single attribute and a single joint and set a key.
Do the same for the other three Brow attributes, making sure you have only the corresponding joint selected in the Driven section.
With the base pose keyed, we can now define the extremes these joints can move to.
First set the four eyebrow attributes to 10; then adjust each eyebrow joint so they are raised as far as they can go (Figure 13.29, middle).
Figure 13.29. Key both extremes for the eyebrows.
When you are satisfied with the pose, store it in the Set Driven Key dialog box. Do this by going through each individual attribute on the HeadControls icon and setting a key on the joint it will control. Don't select all four joints at the same time.
Now set the attributes to 10 so that we can define the lowest point to which the eyebrows will go. Move the joints so that the eyebrows are like those in Figure 13.29, right, and set a key on eachone attribute to one jointin Set Driven Key.
Now rig the eyes.
With Set Driven Key open and Head Controls loaded in the Driver section, load all four eyelid joints into the Driven section.
Select the LeftEyeLids attribute in the Driver section, and then all the rotations and translations for L_UpperLid and L_LowerLid in the Driven section (Figure 13.30). Set a key to store the default pose.
Figure 13.30. Select the joints and attributes associated with the left eyelids.
Store the default pose for the right eyelids, selecting RightEyeLids and then the R_UpperLid and R_LowerLid joints.
Now work on closing her eyes, as shown in Figure 13.31, left. Start by setting the LeftEyeLids and RightEyeLids attribute to 10.
Figure 13.31. Rig the eyelids so she can open and close both eyes or either eye.
Close the eyes by rotating both the upper lid joints around the X axis so that they cover most of the eyeball. Then rotate the lower lids up to meet them.
Before you set a key to store the pose, translate all four joints out along the Z axis so that the eyeballs don't pop through the lids.
Follow the same procedure for storing the default pose (steps 2 and 3) to store this one.
Now we will widen her eyes. This time set the LeftEyeLids and RightEyeLids attribute to 10, which will reset the eyelids for us. Then, rotating around the X axis, open her eyes wider (Figure 13.31, middle). Store the pose in Set Driven Key.
Kila's facial rig is complete now. Not only can she open and close her eyes, but she can also open each eye independently (Figure 13.31, right). Save the scene as Kila_FaceRig_Jnt.mb.
This completes the tasks of this section. With the facial rig you've constructed, Kila can communicate with the player. If you'd like to, you can add further controls to the joints to allow extra manipulation of her lips and jaw (as I have in the Kila_FaceRig_Jnt.mb file on the CD).
Let's now explore the other method for creating facial movement: blend shapes.