Facial Setup with UI part 1

In this tutorial we will be setting up eye controls for our character. For the eyeballs themselves we will simply aim them at a controller. The eye lids have layered controls that will allow them to move automatically as the eyeball pivots while still allowing the eyelids to blink using UI controls.

1. First create a joint named head_jnt and place it where the neck meets the skull.

2. Select the eyeball geometry and click display>transform>rotate pivots this will cause a green dot to appear at the pivot of the eye.

3. Snap a joint to the pivot and name it "eye_L_jnt"

4. Snap three joints along the top and bottom eyelids and name them according to the image below. Skin the eyelid joints to the face.

Tip: When weighting the eyelid joints rotate the eye_L_jnt down as if the eyelid is closed, then adjust weights. When your finished 0 the rotate on the eye_L_jnt.

5. The joint hierarchy should look like the following.

Now we will create a hierarchy that will allow us to control the eyelids with expressions and with UI controls..

6. Create an empty group and name it upEyeLid_grp_L and snap it's pivot to the center of the eye and freexe transforms.

7. Copy this group three times and name each of them, upEyeLid1_ctrl_L  upEyeLid2_ctrl_L upEyeLid3_ctrl_L.

8. Parent these groups to the upEyeLid_grp_L .

9. Parent Constrain each of the upEyeLid joints to it's similarly named ctrl groups we just created.

Now select any of the upEyeLid*_ctrl_L groups and you should be able to rotate in the x axis to make the lid joints move up and down.
(Note: All of the ctrl groups should have their pivot at the center of the eye.

Let's add an aim constraint to the eye_L_jnt  to control where the eyeball is pointing.

10.  Click Create>Locator and snap the locator to the center of the eye geometry then translate it away from the face.

11. Name the locator eyeLook_ctrl_L, then aim constrain the eye_L_jnt to the locator.
(NOTE: When creating the aim constraint, set the Aim Vector to Z (0,0,1) and the Up vector to Y (0,1,0))

12.  skin the eyeball to the eye_L_jnt

13. Freeze Transforms on the locator then move it around to make sure the eye is following the locator.

Now we will add an expression that will connect the rotation of the eye joint to the rotation of upEyeLid_grp_L .  This movement will simulate the way that the eyelid naturally follows the movement of the eyeball as it rotates.

14. Open the expression editor window>animation editors>Expression Editor

15. select eye_L_jnt and upEyeLid_grp_L, they will appear in the script editor object pane.

16. Now we will create an expression that links the movement of the eye joint to the movement of the upEyeLid_grp_L.

upEyeLid_grp_L.rotateZ = eye_L_jnt.rotateY/3;
upEyeLid_grp_L.rotateX = eye_L_jnt.rotateX/3;

Repeat Steps 6-9  and 14-16 for the bottom eyelid

Now we will create UI controllers for the individual joints.

1.  create>nurbs primitives>circle and name it  upEyeLid1_ctrl_slider and rotate X to 90 then Freeeze Transforms

2.  create>nurbs primitives>circle  options    set Degrees: Linear and Sections: 4 and name it  upEyeLid1_ctrl_rail
    and rotate Y to 45 then Freeeze Transforms, then rotate X to 90 then Freeeze Transforms again

3. Scale  upEyeLid1_ctrl_rail so that it encloses the upEyeLid1_ctrl_slider_L at Y=1 and at Y=-1

4. select the rail and click display>object display>template this make the rail unselectable in the UI.

5. Select the slider and open the Attribute Editor and go to Limit Info>Translate and set the Trans Y min -1 and max 1

6. Duplicate the rail and slider twice so you have one for each upEyeLid joint and name accordingly.

7. Place them  in a row like the image above then lock and hide all attrs on the sliders except Tranlsate Y

8. Group the sliders and rails and name the group upLid_L_UI and move and scale the group to the side of the face.

9. Connect the sliders to the ctrl groups using an expression.

upEyeLid1_ctrl_L.rotateX = -upEyeLid1_ctrl_slider_L.translateY*15;
upEyeLid2_ctrl_L.rotateX = -upEyeLid2_ctrl_slider_L.translateY*15;
upEyeLid3_ctrl_L.rotateX = -upEyeLid3_ctrl_slider_L.translateY*15;

Repeat for the lowerEyeLid group