Blender Eye Rig Tutorial
I’m using Avastar with Blender to make avatars for Second Life. But this should work with any workflow and bones in Blender. Oh, and this is for a spherical eye. (Or a segment of a sphere.)
Build your rig, put in the eyes, add the Avastar rig or build your own rig, blah blah blah… This tutorial ONLY deals with the eye and eyelid bones.
Click the images to view the full size.
IMPORTANT: You will most likely optimize your model’s polygon count by removing the back of the eye. Do not do this until after you rig it. We’ll be using the sphere’s center, so we need the whole thing.
1: Turn on visibility for the Face bones (Green eye for the Pose bones), AND remember the “Extra” which contains the Eye bones.
For a non-human rig you’ll want to UNCHECK the Eye Focus and Alt Eye Focus.
Hide all the other bones except the GREEN Eye (and/or AltEye if you’re using those) and Eyelid bones.
2: AND, with each Eye bone selected in turn, find the Damping Track that makes it point at the eye target. If you do NOT have a humanoid rig, and your eyes do NOT face forward, and you will NEVER use an eye target to position your eyes, set the influence to zero and DELETE THIS MODIFIER, for the sake of your sanity.
I swear, Avastar keeps turning these things back on at unexpected times, and you have no idea how many times I come back to my avatar, after editing the hands or something, to work on the eyes and find, OMG MY EYES ARE TWISTED WTF!?!??! ::cough::
Especially if you find you are ever going to change the base pose of your avatar, and use the Restpose button with “Apply to Meshes” turned on. Eye Targets Must Die!
Step 1: Grab your eye(s) and go into Edit Mode.
Use L to select all the vertices/edges/faces (it doesn’t matter) of one eye. Make sure your Action Center is set to Median Point (or Bounding Box center). You should see the axes in the center of your eye.
Press SHIFT-S: Send Cursor to Selected. This is where the center point for the eye rotation should be — and the eyelids too, if you want them to slide along the surface of the eyeball.
Step2: Switch to the Rig, Edit Mode.
Grab the head of each Eye/Lid bone and press SHIFT-S: Send Selected to Cursor.
Note: zoom out your view and make sure Blender did the same to the other side. (Also make sure you have X Mirror turned on, in however many places it needs to be turned on! Options for one. Not sure if there’s more.) If not, press G and wiggle the bone head around until the other side matches up with it. I swear, sometimes Blender is a moron and won’t keep the bones symmetrical if I type in a number, or use the Transform dials, or use these snap to commands. Today, while doing screenshots for the tutorial, it behaved properly. I still don’t trust it :X
Yes, we’ll be sticking the Eye and Eyelid bones all on top of each other to start.
Step 3: Back to the Eye mesh, Edit Mode.
Select that one vertex that is in the center of the eye. (Yes, I have the wrong seam marked for a nice UV map; ignore that :X)
SHIFT-S: Send Cursor to Selected.
Now go back to the Tails of the Eye/Lid bones and SHIFT-S: Send Selected to Cursor. How easy is that!?
Step 4: Bone Roll.
This is for compliance with the Second Life avatar rig. It is optional.
To view the bone axes, go to the Far Right panel area, under the Little White Man icon. Display section: Axes checkbox. You could also set the working axis to “Normal” instead of “Global” (I don’t know why, but “Local” doesn’t work on bones), but those axes will disappear while you rotate the bone.
The eye bone should point from the center of the eye straight out the pupil, with the Y axis as the long axis, the Z axis straight up in relation to the eye, and the X axis horizontal. Or, basically, X rotation will look up and down, Z rotation will look side to side, and the Y axis will make your eyeballs spin in their sockets. (What? Cartoons and dragons of Pern could use this!)
In this example, my eyes are on a 45 degree slant. (Not to mention they’re facing outwards, not forwards, but we took care of that with the bone head and tail.)
First, select the Eye bone and set the Roll to 0. (Right (N) Panel, Transform Section at the top. Roll dial.)
Then, drag on the dial to roll the bone until you see the X axis horizontal to your eyeball, and the Z axis vertical. You will probably see the wireframe lines to guide you.
Make SURE that Blender is rolling both the left and right bones simultaneously. If it doesn’t, you may have to copy and paste your Roll value from one dial to the other. Remember to change polarity when you do this. (ie: 65 will become -65; -4.28 will become 4.28.)
You should also copy the Roll to your Eyelid bones. Yes, numerically, because you want precision here. (Don’t you? No? Carry on, then.) The pose copy thing won’t help either :X
MAKE DOUBLY SURE that once you’re done, the BLUE bones have the same roll as the GREEN bones you just edited. (This is for Avastar, specifically. I’ve had trouble changing bone roll in the middle of working on the model weight paints, but not when setting up the skeleton for binding.)
Step 5: Open the Eyelids.
How far depends on whether you model your eyelids open or closed, but do open them at least a little, to save yourself the headache of trying to grab the suckers when you want to pose and/or weight paint your model. You could also make the eye bone stick out further, to make that easier to grab.
But to do this… Go into Pose Mode.
Select an Eyelid bone (not the eye; it will take a few clicks probably). Press R X X to activate rotation on the local X axis. Which we set up with our bone roll to be up/down or open/close. Rotate the bone until the tail touches the edge of your eyelid. (Or where one would be, if you had one — since my demo model… well, don’t ask!)
Do the same for the other Eyelid bone (Upper/Lower). Select both eyelids and the eye, Copy Pose, then select the same bones on the other side and Paste Mirrored.
Step 6: Restpose.
Now is the time to zoom out and make TRIPLY SURE that your bones are all mirrored properly, all the rolled axes are rolled properly, etc etc etc.
In Avastar, go to the Rigging section and find the “Apply as Restpose” button. MAKE SURE that if you have anything already bound to your rig, that you turn OFF the option to apply the pose to the meshes, or that nothing ELSE has moved on the mesh that you weren’t expecting. (Maybe you extended a pinky bone to weight paint it and forgot to put it back or something. That will get baked to the mesh shape!)
Then press the button.
Step 7: Binding.
Now is the time to hit Save before everything goes to heck. Um, or before you hit the Restpose button :X
Go into Object Mode, select your rig, select your mesh, and bind them together! (You should know how to do this from Avastar and other tutorials.) You can go into weight paint mode, grab all the vertices of each eye, and set them to a level of 1.0 for their respective eye bones. (Not shown in this tutorial.) But that should be it. Your eye should then rotate perfectly on its center, never pop out, and… I dunno, just be totally awesome. And eye-like.
Remember! You can cut the back off of it now. :)
(As for weight painting your eyelids, good luck! Eyelids are the bane of my existence…!)