In this quick example, you build a simple rig for controlling eyes and ultimately animating them.
Before getting started, I should note that while the eye rig you have at the end of this section works well, I don't recommend that you use this exact rig in a full character without some modifications. The modifications aren't too drastic; mostly you need to replace the Empties in this rig with bones in an armature. I go over using bones in more detail in Chapter 11. In the meantime, work your way through this example, and you'll be much better prepared when you get into more complex rigs.
If you worked through the practical examples in previous chapters of this book, you should have a nice, textured eyeball. If you haven't worked through those examples, that's okay, too. I provide an eye model for you to work with on this book's companion DVD and Web site.
This practical example starts off a bit differently from the previous ones in this book. Instead of opening the existing model .blend and working directly in that file, you start this project from the default startup scene (Ctrl+N) and append your eye model. To do so, use the following steps:
All that's left in your scene now is the camera and a Point light.
Blender's File Browser appears. When you left-click the .blend file, the File Browser allows you to drill down into the file. You're looking at the innards of your .blend file.
You see an object named eye. If you're working on a file from the practical examples in Chapters 5, 7, and 8, I'm assuming that you named your model. If you're using the model provided on the DVD or Web site, the eye object is definitely named.
Blender brings up your eye in the 3D View.
At this point, your Blender screen should look like the screenshot in Figure 10-12.
After you have your eye model in-scene (see preceding section), you can set up the rig. I recommend that you do the next steps from the front orthographic view (Numpad 1, Numpad 5). First things first: Most characters have two eyes, so you're going to need two eyes:
If you're using a different custom eye model, the number of units you move it may be different. The idea here is to offset the eye to the right of the Z-axis.
Again, your move in the X-axis may not be exactly -3.0. Just double the value you used in Step 1 and negate it.
You can name it from the Item panel in the 3D View's Properties region or from Object Properties in the Properties editor.
Adding .L and .R as a suffix for left and right parts of a character is a good practice to get into.
Now you have a disembodied binocular character. Sweet! For the next step, you need to add the controls for your new eyes. For this step, you're going to use Empties — three of them, to be exact: one for each eye and one for overall control:
The Empties may be obscured by your eye models, so you may find it easier to select them using the Outliner or by quickly toggling wireframe viewport shading (Z).
Moving them about 6 units forward (GY-6) should be enough.
Because both Empties are selected, the 3D cursor should snap right to the Y-axis.
At this point, all the elements for your simple rig are in place. Your setup should look like the screenshot in Figure 10-13.
All your pieces and parts are in place; the actors are all on stage, if you will. The next step is getting your Empties to control your eyes. To do this step, you need to set up a couple constraints. Specifically speaking, the workhorse of this rig is the Track To constraint. Use the following steps to apply that constraint to the left eye:
Remember: Prisoners last.
Your eye flips around and faces away from the Empty. The next step fixes that issue.
Your eye flips back to pointing in the correct direction.
The control for your left eye is now ready to go. Go ahead and play with it. Select eye_control.L and grab (G) it around your scene. Your eye should follow it around. Right-click or press Esc to stop grabbing the Empty and it should go back to its original position. From here, you have two options. You can either repeat the preceding steps used on eye.L and apply them to eye.R, or you can take advantage of a handy Blender add-on: the Copy Attributes Menu. This menu was a built-in feature in previous versions of Blender, brought into the current version of Blender as an add-on.
To enable the Copy Attributes Menu add-on, bring up the User Preferences editor (Ctrl+Alt+U) and go to the Add-Ons section. Left-click the check box to enable the add-on labeled 3D View: Copy Attributes Menu. After you enable this add-on, close the User Preferences editor and go back to the 3D View. Now you can use the following steps to copy the Track To constraint from eye.L to eye.R:
Remember: Children first.
When you choose Copy Selected Constraints, Blender provides a menu.
POW! Your eye.R object now has a Track To constraint with the exact same settings as eye.L.
Of course, a small problem is that eye.R is pointing to the wrong control Empty. Fortunately, this fix is easy. Select eye.R, go to its Track To constraint, left-click the Target field, and choose eye_control.R from the menu that appears. eye.R should now point to the proper control Empty.
At this point, you're basically done with your rig. The only downside is that you have to select both eye_control.L and eye_control.R to control the direction of both eyes simultaneously. You can parent each of the Empties to the large eye_control Empty between them to solve this issue:
This step isn't critical, but it does help prevent you from selecting those empties and moving them accidentally.
Your simple eye rig is now complete, and you can start animating your eyes. You can control regular eye movement by grabbing (G) the eye_control Empty and moving it around your scene. If you want to cross your character's eyes, you can scale (S) the control down. And if you want your character to look like a crazy person, try rotating (R) the eye_control Empty.
If you'd like, you can set up basic three-point lighting (see Chapter 9) and set your 3D View to use Textured viewport shading (Alt+Z) and GLSL display shading (NDisplayGLSL). And if having two disembodied eyes floating in the scene makes you too uncomfortable, you may want to add a sphere as a simple stand-in head.
After you have a basic rig created, you can start animating your eyes. Start by switching to the Animation screen layout (Ctrl+←Ctrl+←) and make the modifications described earlier in the section “Customizing your screen layout for animation.” You may also want to increase the size of the Graph Editor on the left of the screen as well. Then select the camera in the 3D View and adjust its location and orientation to frame your eyes to your taste. Your screen should look like Figure 10-14.
This specific example is a simple animation of a character rolling its eyes. As a quick test, roll your own eyes and try to figure out how long that action takes. Trying for myself, to get the right feel of the action, it feels like the action takes a full second. I've also noticed that my eyes seem to move faster at the end of the motion than at the beginning. Bearing all this information in mind, you can start animating:
This keyframe is the starting point for your animation.
You can move forward by scrubbing in the Timeline or Graph Editor or by changing the Current Frame field in the Timeline's header. Blender's default behavior is to have motion happen at 24 frames per second (fps). This action takes 1 second to complete, which is why you go to frame 24.
You've now animated your character's eyes looking from left to right.
You can test the timing of your animation by pressing Alt+A or left-clicking the play button in the Timeline. Press Esc or left-click the pause button to stop playback.
Because I noticed that my eyes move faster at the end of the motion, I want this keyframe to be closer to the end of the action.
When you play back your animation, your character should now be successfully rolling its eyes.
See? Animation can be easy!