Building Emotion: The Basics of the Eyes, From Sybex | 2 | WebReference

Building Emotion: The Basics of the Eyes, From Sybex | 2

Building Emotion: The Basics of the Eyes, From Sybex

The Eyeballs

Create a polygonal sphere of Radius .8, subdivisions along axis of 20, along Height of 4, and make it native to the Z axis. Move the sphere to -0.25, 0, -.01. Scale the sphere to 0.1, 0.1, 0.01. You should have a very flat sphere sitting in the right eye socket of your face. Rename the sphere REye, and assign it the same material of the eyebrows, black.

Since we already have a material created, right-click over the object and from the Marking menu at the bottom select Assign Existing Material, then select the material you created for the brows. Duplicate the eyeball and move it across the other side to 0.25, 0, -0.1. Rename the new object LEye. Your new practice face should look like Figure 7.7.

Figure 7.7: Box Head is almost born. There's just one more noisy bit to go…

Save before you continue, just in case any problems arise. The one last thing to do is import your spline mouth from Chapter 1 (or load it from the CD). It should show up right in the middle of Box Head. If it doesn't, feel free to move it into place. Select Mouth (the spline itself), and then Face, and parent them, making Mouth the child of Face. Move Mouth to 0, -0.3, 0.1 and scale it to 0.25 uniformly. Duplicate Mouth and scale the duplicate to 0.01 uniformly-very, very small (Figure 7.8). Now, be sure you have construction history turned on, and loft Mouth and Mouth's duplicate together. Once this is done, turn construction history back off. Now, so you can see it, assign the black lambert material to the loft, and you're ready to go!

Figure 7.8: Box Head looks mild-mannered, but the things that come out of that mouth…!

Parenting Our Face Together

Now that we have the pieces we need, it's time to rig them up for use. First, let's start with the eyeballs. Create a locator and scale it to 0.1, 0.1, 0.1 so that it's very small and not too obtrusive. Duplicate the locator and name the duplicate "Eyes." Make both REye and LEye children of Eyes and then make Eyes a child of Face. We will use this locator to control our eyes' positions in the sockets. Duplicate the original small locator and rename the duplicate Brows. Parent both eyebrows to Brows and make Brows a child of Face.

Rigging Our Face

The first thing we'll need to do is create a slider control, similar to the one we made in Chapter 1 for the mouth, so we can control the things that we need to.

Creating Our Control

We'll make one slider control out of a locator and circle that we'll duplicate for the other ones we'll need. We'll make one slider control out of a locator and a circle, and duplicate it to create the other ones we'll need.

Create a locator, scale it to 0.25 uniformly, and move it away from the face. Rename the locator Ctrl_Prnt. Now create a NURBS circle of Radius 0.1 and native to the Z axis. Make the circle a child of Ctrl_Prnt and rename the circle "Ctrl." If you now type zeros into the translate channels for the circle, it should center itself on Ctrl_Prnt (Figure 7.9).

Figure 7.9: A NURBS circle is the slider of choice for most of my setups; by hiding locators, selection is easy.

In the Attribute Editor, limit Ctrl's motion so that it can only travel between -1 and 1 in X and Y axes and cannot move in Z, a minimum-maximum limit of 0 and 0. Now, with Ctrl still selected, open the Channel Control (Window ¢ General Editors > Channel Control). Select all but translateX and translateY from the left-side window and hit the "Move" button on the bottom-left side of the window. Now, the only attributes you'll see for Ctrl are translate X an Y. Go ahead and close the window.

If you're having trouble locating the particular windows for applying translation limits, see the tutorial in Chapter 1.

The circle is now going to be used as a slider with which we can control aspects of the face! You can move the slider's location without affecting its output value by moving it from the Ctrl_Prnt level. Ctrl_Prnt can be anywhere you like in your scene, just as long as...values for the Ctrl itself are 0 and 0 in X and Y; or we'll use those attributes to drive our expressions.

Rigging the Face Control

Duplicate the Ctrl_Prnt hierarchy (the locator and circle, both) and rename the duplicate circle Ctrl_Face. (The locator's name is of no real consequence.) Select Face, and in the Channel Box click the rotateY attribute. If you then right-click, you can select Expressions from the menu that appears. In the Expression Editor, type:

Face.rotateY = Ctrl_Face.translateX * 15

When you've typed that in, hit the Create button on the bottom-left corner of the window to create your expression. Now, click another attribute of Face's-which attribute doesn't matter. Enter the following in the expression window:

Face.rotateX = Ctrl_Face.translateY * -35

You can enter any expression in the Expression Editor in relation to any object and attribute at any time. The only danger in doing so is overwriting another expression that you've just written. To keep that from happening, you need to clear the window; to clear the window, you just have to select an attribute that has no expression.

As before, hit the Create button to make your expression take effect. If you close the Expression Editor, you should be able to drag the Ctrl_Face slider left, right, up, and down and see the whole face move, as in Figure 7.10. Set the slider to 0,0 and we'll continue with our setup.

Figure 7.10: Box Head looking top (screen) left and then bottom (screen) right. I had to cheat and move his eyes to help the images, since with his parallel lines, both poses tended to look very similar!

  

Throughout this chapter, remember to select the circle, not the locator!

Rigging the Eye Control

Duplicate the original Ctrl slider hierarchy again (not the one with Ctrl_Face), and move it away so it has its own space. Select the circle and rename it Ctrl_Eyes.

Select the locator that is parent to both eyes; it should be named Eyes. In the Expression Editor, enter and create both these expressions, one at a time:

Eyes.translateX = Ctrl_Eyes.translateX / 10
Eyes.translateY = Ctrl_Eyes.translateY / 10

As before, create both expressions and then close the window. When you move the new Ctrl_Eyes slider around, the eyes should move (Figure 7.11). Once that's working, set the Ctrl_Eyes slider to 0,0 and keep moving along.

Figure 7.11: The eyes posed on opposite corners of their range

  

Rigging the Upper Lids

Duplicate the original Ctrl hierarchy, move it away to its own spot, and rename the circle Ctrl_Lids. Select UprLids, and enter the following expression:

UprLids.translateY = (Ctrl_Lids.translateY / 5)

Notice the parentheses; they're there because of how we're going to change this expression in just a moment. . When you move the Ctrl_Lids slider, its up and down motion should control the upper eye lids' height. There's one problem, though. Select the Ctrl_Eyes slider and move it around. See how the eyes are moving around and the lids are not relating to them? Figure 7.12 shows that when you pull the EyesCtrl slider up, you have a sleepy-eyed character, and when you pull it down, you have an alert character. Now, maybe for some people that's good enough, but not us. Knowing what we know about lids and eyes' relationships, this expression needs work.

Figure 7.12: The ol' eyes-up-being-sleepy and eyes-down-being-excited just doesn't cut it.

  

Having read Chapter 2, we know that the upper lids should follow the eyeballs' motion so that we aren't spontaneously changing expression like this. I was animating this effect manually myself for over a year when a friend of mine who also was doing the work of facial setups smartly decided that maybe this should be automated, as it's something you always want to happen. Taking his lead, we'll need the upper lids to consider the eyeball movement as well.

Since we want to mimic the eyes' motion as well as what we're doing already, the easiest thing is to simply add the eyes' expression into the lids' expression we already have. On UprLid, change the expression from this:

UprLids.translateY = (Ctrl_Lids.translateY / 5)

to this:

UprLids.translateY = (Ctrl_Lids.translateY / 5) + Ctrl_Eyes.translateY / 10

When you modify an expression instead of creating it, you must first select the object and attribute so the old one appears. When you've finished with your changes, you click the Edit button instead of the Create button to update it.

Now if you test the Ctrl_Lids up and down motion, you'll see that it does the exact same thing as before. The difference is apparent when you use the Ctrl_Eyes slider. The lids now move up and down with eyeballs, too! To reiterate, all we did to create this effect was to add in the same math we're doing for the eyes themselves.

This expression leaves something to be desired, since, if the eyes look all the way up, the upper lids can't close to the bottom. For the level this face is at, that's an acceptable flaw. In the automatic setup, there's a more robust expression for the upper lids' movements. For most of the Ctrl_Lids slider's movement, it behaves like this, but for the last part of the slider's range, the expression calculates the total remaining distance between upper and lower lids, and moves to a percentage of that distance, based on the slider's value" Closed will always mean closed regardless of where the eyes are, but the lids, when opened, will follow the eyes' motion as well.

Created: March 27, 2003
Revised: November 7, 2003

URL: http://webreference.com/3d/stopstaring/1