Phil Barrenger's - 3D Stuff
 
 
Tutorials - Controlling eyes with the mixer

This tutorial is aimed people moderately familiar with xsi, though I have tried to make it as accessible to beginners as possible.

Why use the mixer for eyes? Quaternion rotations that's why. You can do the same tutorial but link directly to the x and y rotaion of the eye, which will use euler rotations, to see exactly why quaternions make your life better.

Download tutorial Files : Start Scene
Completed Scene

Learning outcomes :
1) Add actions to the mixer.
2) Using Curves as animation helpers.
3) Use 'Link With' to control animation.

1) Review the start file  

The starting file is very simple but there are a few things to be aware of.

1) All the objects that will be animated have their transformations zeroed out. This helps to keep things clean later on when we are setting expressions etc. It also makes re-setting things very simple.

2) The null at the front of the eye controls the cluster of polygons that make up the pupil.

3) eye_control_camera is a camera that is setup to use as a view for animating the eye controls.

4) I have used position limits to limit the movement of the eye_control_pupil circle to be within the circle.

5) I have transform setups applied to the eye_control_pupil so that on selection you are automatically put into transform oxy mode.

fig.1
2) Creating the Action Sources for the mixer  

Select the 'eye _parent'null and press control + Mk to open up it's kinematics property page. Lock this ppg as we will need it often.

Mark the x and y Rotation axes (by holding down shift while clicking them.) Go to Animate / Actions / Store / Marked Parameters - Current Values. In the window that pops up type 'eye neutral' as the name for the action, leave the other options as the are and click ok. This creates an action source for the eye control in it's default rotation.

Next we will create an action source for the up position. With the 'eye _parent' still selected set it's x rotation to -30.

NOTE: Because the mixer will normalise our animation you need to make these initial rotations go further than they need to - you can always use the link with to reduce them a little later.

Mark just the x rotation. Follow the previous instructions for making an action source only this time call the action 'eye up'.

TIP : when selecting " Marked Parameters - Current Values" to make the source the second time around you can simply 'middle click' on the " Animate / Actions / Store" button and it will use the last function that was called from this menu. This works for all xsi buttons and can save a lot of time.

Next we make the action source for the down position. Mark the 'eye _parent' x rotation if it isn't already and change it's value to 30. Middle click the "Animate / Actions / Store" button and name the source "eye down'.

Return the x rotation value to zero.

Now we can make the left and right sources. Mark the 'eye _parent' y rotation and change its value to -30. Middle click the "Animate / Actions / Store" button and name the action 'eye right'.

Change the y rotation value to 30, mark it, middle click the "Animate / Actions / Store" button and name the action 'eye left'.

Now we are ready to add the sources to the mixer and set up the controls.

fig.2

fig.3
Adding sources to the mixer

With the 'eye_parent'selected open an animation mixer view (alt + 0 (zero)). Create five animation tracks (shift + a). Now open an explorer view (8), expand the Mixer - Sources - Animation to reveal the five sources that we have created. Click and drag each source onto a separate track. Once all the sources are in the mixer right click on one of them and choose 'clip properties' from the menu. Now select all the green clips, this makes the ppg that opened up from 'clip properties' into a multi ppg - meaning that any changes made will be made to all the selected clips. In the time control tab change the source clipping - out value to a value larger than your total scene length to ensure that the clips affect the entire scene range (i'd suggest a value of around 2000 to be safe for all your scenes.)

Set the weights of all the clips except for eye_neutral to zero.

Ok, so what we have now gives you a pretty good idea of where we are going. If you adjust the weights of each of the clips you will see that the eye rotates around quite nicely. All that is left is to create some simple link with expressions to make the setup a little more intuitive and fun.

fig.4
Animation Setup

Now we are going to link the weight of each clip to the position of the eye_control_pupil circle.

 

Right click on the eye_up clip in the mixer, choose clip properties, lock the ppg that opens up. Select the eye_control_pupil circle and press control + Mkto open it's kinematics ppg, lock it as well.

Right Click on the weight animation divot and choose link with from the menu, now navigate through the scene to the local pos y of the eye control pupil curve as shown in fig5. This creates a relationship between the weight and the pos y that is driven by a fcurve. At the moment the driving fcurve only has on key on it which means the values are constant, we'll fix that now.

In the eye control pupil's kinematics ppg, which you should still have open and locked, change the position - y value to 2.5. Change the clip weight, in the clip properties ppg, to 1. Right click on the weight animation divot and choose Set Relative Values. You can now translate the eye control pupil up and down and the eye will rotate up and down! However the relationship is not linear, which we want. To address this click the animation divot of the clips weight property (which will have changed to a new icon with an L on it to indicate that it is being driven by a 'link with' expression).
This will open up an fcurve editor with our' link with' fcurve already selected. Click the Linear Interpolation button shown in fig.6 to 'straighten' the curve.

Ok, so far so good, we just need to replicate this process on the other clip weights.

Right Click on the weight animation divot and choose 'copy animation'.

Unlock the clip properties ppg and then select the eye_down, eye_right and eye_left clips from the mixer. The ppg should update with the properties for these clips. Right click on the weight divot and choose 'paste animation'. This will paste a copy of the 'link with' expression onto each of the clip weights, however we need to change the fcurve for each to get the correct results, at the moment they are all linked to the pos y value of the pupil circle.

Select only the eye_down clip, the ppg should refresh again. Left Click the animation divot to bring up the fcurve editor. Select the second key on the curve and change itsframe from 2.5 to -2.5. This will make the eye_down weight equal 1 when the eye control pupil pos y value is -2.5. Play with the eye control pupil to see the results.

Now we need to set up the left and right clips. These are a bit different as we have to change the link from the pos y to the pos x.

Select the eye_right clip in the mixer, again the ppg will update. Right click on the weight divot and choose expression editor. An expression editor opens up showing the expression for the link with.

change the expression from :

l_fcv( eye_control_pupil.kine.local.posy )

to

l_fcv( eye_control_pupil.kine.local.posx )

click apply in the expression editor to apply the changes.

How easy was that?

now do the same for the eye_left clip.

Almost there, we just need to flip the fcurve for the weight of the eye_right clip.
Select the eye_right clip, ppg will update. Left click the weight divot, select the second key, change it's frame to -2.5 as you did previously.

Whoooooo Hooooooo, that's it. If all went according to plan and you followed my cryptic directions then you should now be able to move the eye_control_pupil around and the eye will follow.

fig.5

fig.6

Suggested further development

1) Make a compound clip out of the five clips so that the main mixer isn't too cluttered.

2) Set up more controls for pupil dilation and anything else you can think of.

3) Use the eye_control_camera as a view for animating - or if you make a textured view (application / views / textured view) and select all the animation controls, now lock the textured view - you now have a floating eye animator window. You can also incorporate textured views into custom layouts and place one on your second monitor! = yummy.