Create a Facial Animation Setup in Blender - Part 2
In this part of the tutorial we will learn how to add drivers to the shape keys we created in part one, and add controller bones to complete our basic face rig.
Since we are focusing only on the face, we will create a small armature just for the head for now (assuming that it is continuing from chest.) If your model is already rigged, you can skip this and start with the Creating Driver Bones section. To start, select the model by Right Clicking, and then press Shift-S and select Cursor to Selected. This will move the 3D cursor to the center of the object.
Press Shift-A and add an Armature.
In the Armature properties, check on X-Ray so we can see the bone through the object.
Press 3 on the Numpad to get into a side view. And with the Armature selected, press TAB to enter into Edit mode. Select the bone by Right Clicking, and press G to move it near the neck as shown in the following image. Select the tip of the Bone, and move it down (with the B key) to the top of the neck.
Select the tip of the Bone by Right Clicking and then press E to extrude a bone for the head. Name the bones - Neck and Head.
Press TAB to exit Edit mode. Select the Head, hold Shift and select the Armature. Then press Control-P and choose With Automatic Weights to assign the object to the armature.
Select only the Armature. Press Control-TAB to get into Pose mode and select the Head bone. (The selected bone will be highlighted in light blue.) Now select the Head (object) and press Control-Tab to enter into Weight Paint mode.
Now assign the head vertices to the Head bone by just painting them. Set the Weight value to 1.00 and in the Options panel, tick on X Mirror. This will allow us to paint symmetrically.
Paint the head with full weight, so it's assigned to the selected (Head) bone.
Remove the neck vertices by painting them with 0.0 Weight, as we don't want the head bone to effect the neck vertices.
Now select the Neck bone. Weight paint the model appropriately to assign only the neck area to the bone.
Creating Driver Bones
Now we will create the bones which will trigger the shape keys. The position of the bones doesn't matter, some people like to have a separate control, while others like to have it on the face itself. We will cover both cases in this tutorial.
Press Control-TAB to exit Weight Paint mode. And with the Armature selected, press TAB to enter into Edit mode. Press Shift-A to add new bone, and then select the new bone (by Right Clicking.) Place it (using the G key) above the eyebrow, and Scale it down using the S key.
In the Bone properties, rename this new bone to anything you like, for example EB-raised.l (l for left). Uncheck the Deform option as we don't want this bone to deform the mesh.
You can also change the display type for the bones. In the Armature properties and under the Display panel, click on the Stick Button.
Select the new bone and press Shift-D to duplicate it. This way the duplicated bone will have the properties of the original one (like the size and the deform option unchecked.) If you prefer to create a new bone, then make sure that the Deform option is unchecked. Name this new bone EB-corner.l or anything else, but use a relevant name.
Select the new bone and press Shift-D to make another duplicate. Name this RB-last.l (or anything else) but use a .l extension. Now place it over the outer corner of the eyebrow. This will trigger the EB-corner shape keys.
Similarly add two more bones - one to trigger the shape key for the upper eye lid, and another for the bottom eyelid. Place them appropriately and name them EL-upper.l and EL-lower.l.
Create (or duplicate) another one for the nose Shape key. Name this nose.l.
Moving downwards, add another bone to trigger the upper lip deformation (or disgust) shape key. And a second one to control the smile and frown.
If you created a shape key for a cheek puff, then create another bone for it and place it on the cheek. Name it cheek.l
Add one for the chin as well. This will trigger many shape keys- Jaw open (aa), jaw right, and jaw left. Since this one is in the center, there is no need to add an extension like .l or .r.
Now we will create bones to drive the phonemes shape keys. I created four, so I will add four bones. Name them - Mouth-F, Mouth-O, Mouth-U, Mouth-EE and Mouth-MPB. Lets place them away from the face for now.
Lets also add bones for the eyeballs. Press TAB to exit Edit mode. Select the eyeballs by Right Clicking and then press TAB to enter into Edit mode. Hover over the left eye and press L. This will select all the connecting vertices.
Press Shift-S and select Cursor to selected. This will move the 3D cursor into the center of the eyeball.
Press TAB again to exit Edit mode. Select the Armature and press TAB to edit. Then press Shift-A to add a bone. The new bone will be created at the 3D cursor's position. (We need the eye bone to be exactly in the center of the ball.) Name this new bone - eyeball.l and make sure that the Deform option is checked, as we want to deform the eyeball with this bone.
Select the tip of the bone and press G to move it down, pointing outwards. (Hold Control to snap while moving.)
Select the new bone and press Shift-D to make a duplicate. Move this one away from the face, but keep it exactly in-line with the eyeball bone. (Hold Control to snap while moving.)
Uncheck the Deform option, as we don't want this bone to affect the vertices of the face or the eyeballs.
Also check the placement of the bones in the side view. Press 3 on the numpad to to get into a side view, and then select the individual bones and press G to move them. Place them just outside of the head with a little distance in between them and the mesh.
Select the Head bone, press Shift-S and select Cursor to Selected. This will move the 3D cursor to the center of the face.
Press A to deselect any bone. With the B key, drag select only the bones for the left side (all bones with the .l extension), including eyeball.l and eyetrack.l, for which we need a mirror copy on the right side.
Press the . (period) key on the keyboard to make the 3D cursor the center pivot for rotation and scaling.
With the bones selected, press Shift-D to make duplicates, Left Click without moving the mouse to confirm the same position. The duplicate bones will share the same position with the original ones.
With the new bones selected, press Control-M and then X to make a mirror copy along the X axis. The 3D cursor will serve as the center point.
The new bones will have jumbled extensions but we want each one to have .r extension. So with the new bones selected, click on the Armature menu in the footer of the 3D window, and then select Flip Names. This will add a .r extension to the mirrored bones.
Press B to drag select all the controller bones. Hold Shift and then Right Click on the Head bone to select it last. Press Control-P to make it the parent bone and select Keep Offset, so that the position of the bones is kept the same. This way all the facial controller bones are now children of the head bone, so they will follow the movement of the head bone.
Press TAB to get out of Edit mode, and press N to bring up the Properties shelf. Under the Display panel, uncheck Relationship Lines. This will hide the dotted lines representing the parent/ child relationship between the objects.
Assigning a Custom Shape to the Bones
Too many of the bones on the face look the same, so lets give them a custom shape. This will not affect the functionality, but it will give us a nice and neat graphical interface. But to do so, we need to create an object first. So in Object mode, create an object using any shape you want (I like to use a simple diamond shaped plane.) And then name it Shape, or anything else you want.
In Pose mode, select the bone. Click on the Bone properties and in the Display panel, select your new object using the Custom Shape option.
Sometimes the bone may appear too small or too large, or the rotation might be off. To fine tune the look, edit the object not the bone.
You can also turn on the Wireframe option to achieve a more minimized look. Assign the custom shape to all driver bones.
Similarly, assign custom shapes to the driver bones, eye track bones and the Head bone. Then turn off X-Ray in the Display options to reduce the clutter.
You can also move all the objects you created for the custom shapes to another layer. Press B and drag select all objects, then Press M and select the second block to move them onto a second layer. Switch back to layer one by pressing 1 on the keyboard.
Setting up Shape key Drivers
Split the window into two and select the Graph Editor for any one view.
Switch to Drivers Mode.
In Object mode, select the Head. Then select the first shape key - EB-angry.l, Right Click on the Value slider and select Add Driver.
In the Drivers window:
- Select the Shape Key Value Driver.
- Press N to bring up the Properties shelf. In the Drivers panel, select Averaged Value for the Type.
- In the Object/Bone field, select Armature.
- And in the Bone field, select the bone which you want to assign the shape key to. Here we want the shape key for angry eye brows, so I selected the eye brow tip bone.
- Select Y Location for Type, as we want to trigger the shape key when the bone is moved in a Y location, i.e. vertically.
- In the Space field, select Local Space.
Again in the Drivers window:
- Add a new Modifier, and select Generator.
- Type -10 into the lower box. Since we want the shape key to be triggered when the bone is moved downwards, the value we use is negative. You can increase or decrease this value according to your liking.
Test it by moving the bone in Pose Mode. The shape key should be triggered when the bone is moved downwards. If the bone needs to be moved too much then you can increase the value to -20.
Similarly, select the next shape key and add a Driver. Right Click on the Value slider and select Add Driver.
- Select the shape key Value Driver.
- Press N to bring up the Properties shelf. In the Drivers panel, Select Averaged Value for the Type.
- In the Object/Bone field select Armature and choose the appropriate bone. Here I have to selected EB-angry.r
- Select Y Location for the Type, as we want to trigger the shape key when the bone is moved in a Y location, i.e. vertically.
- In the Space field, select Local Space.
- Add a new Modifier, and select Generator.
- Type -10 in for the Coefficient value. We use a negative value because the bone is to be moved downward on the Y axis to trigger the shape key.
Test by moving the bone in Pose mode. The shape key should be triggered when the bone is moved downwards. If the bone needs to be moved too much, increase the value to -20.
To save time we can copy a driver setting and paste it onto a new shape key, instead of repeating the steps. We can then change only the name of the bone, transformation type and the modifier settings accordingly. To copy a driver, hover the mouse over the Value of a shape key which already has a driver (indicated with purple). Right Click and select Copy Driver.
Select the next shape key and Right Click on its Value slider. Then click on Paste Driver.
Go ahead and paste the driver onto all the shape keys. We don't have to copy it again, so just keep on pasting the driver into the value. You can also Right Click on the 0.00 Value right next to the shape key in the list, to add, copy and paste the driver.
Paste the Driver for all shape keys.
Assign the Driver values.
- Select the next driver in the Drivers window.
- Assign it to appropriate bone. In this case I need to assign it to the corner eye brow bone, to which we also assigned the angry shape key driver. This one bone will trigger two shape keys - EB-angry.l when moved downwards, and EB-sad.l when moved upwards.
- Since we want to move the bone vertically, we will select Y location in Local space.
- In the Generator Modifier, type 10 (positive) into the value for Coefficient. We need to trigger the shape key when the bone is moved upwards, therefore the value here is +10 and not -10.
- Finally press Update Dependencies.
Test by moving the bone up and down in Pose mode.
Similarly update all the drivers with their corresponding bones, type and modifier values. And finally press Update Dependencies. Things to be kept in mind are:
- Select the appropriate bone for which you want to trigger that particular shape key. One bone can be assigned to many drivers. For example, here I have assigned the chin bone to the jawright, jawleft, and Mouth-AA shape keys.
- Choose the correct Type according to the movement of the bone. If a shape key should be triggered when moving the bone vertically, then select Y location. If you want to trigger a shape key when the bone moves horizontally, select X location. Here I have used X Location for the jaw-left driver because I want it to be triggered when I move the chin bone horizontally (right) along the X axis. You can also experiment with Rotation and Scale types. For the Mouth-AA driver I have selected Y Location, because I want it to be triggered when the bone is moved up and down vertically along the Y axis.
- In the Modifier value, choose a positive value if you want to move right or up, and choose a negative value if the bone needs to be moved left or down.
Again test the bones in Pose mode. Press Alt-G to reset the location of the bones and Alt-R to reset the rotation.
Eye Bone Settings
In Pose mode, select the left eye bone (here it's named eyeball.l), and turn on X-Ray if it is not visible. In the Properties panel, click on the Bone Constraint button.
Click on Add Bone Constraint and select Track To.
In the Target field select the object you want the eye bone to track to (here we have Armature.) And in the Bone field, select the eyetrack.l bone we created. Now the eye bone is tracked to the eye track bone.
Move the eyetrack.l bone and you will see that eyebone.l is tracking wherever the bone is moved. (The white line in the image below is superimposed.)
Similarly, do it for the other eye bone.
Now select the eyeballs. We made them a separate object in the previous part of the tutorial, and now we'll further make each ball a separate object. With the eyeballs selected, press TAB to enter into Edit mode.
Select one eyeball, press P and click on Selection to make the selected vertices a separate object.
Select the left eyeball and then hold Shift to select the left eye bone (eyebone.l). The armature must be in the Pose mode. Press Control-P and select Bone to make the bone a parent. Now the eyeball is assigned to the bone.
Similarly, parent the right eye bone to the right eyeball.
Now we can see that the eyeballs follow the tracking bones.
Lets create one more parent bone which can govern both of the tracking bones, so that we only need to move one and the rest will follow. With the Armature selected, press TAB to enter Edit mode. Click at the center of Armature to move the 3D cursor to the center. In a side view click near the tracking bone.
Press Shift-A to add a new bone. Make sure it's in the center of the tracking bones, and name it eyecontrol.
Select the two bones first and then select the new eyecontrol bone. Press Control-P to make it the parent bone, and select keep Offset to keep the current position.
Now select the eyecontrol bone and then select the Head bone. Press Control P to make the head the parent. Select Keep Offset.
Press Control-TAB to enter into Pose mode. Now by moving only the eyecontrol bone we can move both eye track bones. And when you need to tweak the eyes individually, you can still move them using the individual eye track bones.
Create a new object and give the bone a custom shape.
Switch to Object mode and add a new Plane, then delete two of its vertices to make a line.
Place the object near the phonemes controllers (in Object mode) and duplicate the lines (in Edit mode) as shown in the next image. You can also add text beside each of them.
Set the Head bone as their parent. Select the new object, the text objects and then the Head bone, press Control-P and select Bone.
Our basic face rig is now ready.