Render de Martes

How to create a toon eye rig in maya!

If you ever needed to create a toon rig in maya based in a 2d animation, and you want to have complete control over it, you are in the right spot!

We are going to create this:

Dowload maya scene! Click here!

Step 1: Stuff to have before going into Maya

This may be a little obvious but not really!  We need everything separated and some masks!

  • Eyelids sequence

We may have as many images for the sequence as we want, i recommend 7 png, 3 to close and 4 to open, at least that’s what they told me in Animation 7 course in my university! Once we have the images, the naming is really important because Maya need to recognize the sequence, i recommend: EyelidClose.####.png 

Drawings by:
  • Pupil with white background

The pupil is going to be moving free, so we need to have it in another file. We can name it whatever we want. in this case: pupil.png

Drawings by:

  • Mask 1 for the eye so can see the pupil!

This part is the most important and the one that gave me headaches the first time i do this system, and it’s actually pretty simple! Just go to Photoshop and do this to create the mask:

  1.  Open each of the Eyelids sequence files
  2. Click the middle where the pupil is going to go and click it with the magic wand to select the center, then the outter part
  3. Shift + f5 to fill it with black
  4. Ctrl + Shift + i to inverse the selection and grav the outer part
  5. Shift + f5 to fill it with white
  6. save the files with the namespace similar to the other sequence EyelidCloseMask.####.jpeg (This time they can be jpg or png, it doesn’t matter)
  • Mask 2 for the eye in general

The creation of these mask is the same as the past! just easier because we don’t need the inner part!

With these 4 components we are ready to go!

Step 2: Creating the material

We are going to setup the textures, then create the controllers and finally connecy everything together!

  • PolyPlane with shader!

Lets start with a simple poly plane! assign the desire Material and rename the file!  In this case i drop the specular to zero!

Now lets open the hypershade, select the geometry and load the shader! (I know this is basic but be patience, we will get to the interesting part!)

  • Create some file Nodes and a layerTexture!

Les start with the files!  We need a file texture and a layer texture to start with!  You can create them by using the tab key on the keyboard! If you haven’t use the layer node in Maya, dont worry, is pretty easy!

  • Theese are the nodes we need to create! Try to name them the same way i did so you can copy and paste some expressions we need to write!
  • Connections are actually easy too! With the MMB just grab the node and move to the correct place:
  • Layers>ColorMaterial
  • EyeMask>OpacityMaterial
  • Eyelid>LayerNode
  • EyelidMask>OpacityEyelid in layer node
  • Pupil>LayerNode
  • Alpha is luminance and remove opaque!

What else do we need to do so its ready? Just 3 more steps conserning the masks!

Lets mark alpha in luminance in EyelidMask and in Overall eye mask! This is to make sure the eye will render transparency and to show the pupil in the material!

Next we need to remove the opaque in the polyPlane in case we are rendering with Arnold!

  • Make the files images sequences

Now! Lets start moving the textures! Lets make them images sequences first! Just dont do it with the pupil!

After checking in the files the image sequence option Maya just created an expression for you! That expression is this:


That means if you move the time slider the texture will be changing by frame! im not going to move it becouse i want to delete it and create my own expression but if you dont trust me just go ahead and move the time slider!

Step 4: Lets make some nice controllers

For this part we are goint to need 2 scripts i made for you! If you dont know how to use scripts in maya please go here:

We need to download this ones:

Text to Curve

Square Sliders

Once we have them lets start by creating a Slider, if you run the SquareSlider script your scene should look like this:

Name = Name of the slider. In this case i will use R_Eye (please use the same names i do so you can follow easily)

Size = The limit of the controller position, in this case 3 is enough. The script goes from -3 to +3, we are going to delete the negatives.

Type of slider:  in this case Vertical (actually the script is not finish yet so both buttons do the vertical type, shhhh don’t tell anybody!!!!)

Then we use the text to curve to create the letters above the slider, this one works by typing the  text we want and choosing a color from the slider, by default is white

Now lets limit the Controller in Y to Zero and move the CVs of the curve to a nice position! (Right Click control vertex and move)

DONE! Let’s connect Everything with expressions!

Step 4: Connect Everything!!!!!!!!

First the eyelids!!!

Lets open the expression editor: (Window>Animation>ExpressionEditor): Then go to select filter menu and select by Expression Name.

Please delete expression 1, 2 and 3. We dont need them and cant continue working if they are affecting the nodes.

We are going to create a new expression, just write the expression Name and put  //  in the expression, then click create. (in Mel we can put text that doesnt affect the code by using //, so if we put // in the expression we can click create and save it.)

The expression that we are going to write is actually really simple. We need to say to maya that the slider = the eye frame, so when it on 0 the slider the texture is 1, when its on 1 the texture is 2 and so on.





Copy and paste it in the expression editor and you are done with the closing part! We still need to create the pupil part! (Expressions works like this: object.Attribute = object.Attribute , you can use maths to help you!!)

Lets create the pupil Controller!

We already have the slider so lets use it! Just duplicate ‘R_EyeVSlider_GRP’ and rename it, parent to the existing curve and scale it! (just look at the two images down if i dont explaing nicely)

Change the limit information of the new controller! 

because of the script we use the controller have some limits in translations, lets changed so it can move from -1 to +1 in X and Y!

WE are almost done by now! Now we just need to connect this new controller to the place 2d texture of the pupil. we do this simply by going to the expression editor again and write this:

place2dTexture3.offsetU = -R_EyeVSliderPupil.translateX/10;

place2dTexture3.offsetV = -R_EyeVSliderPupil.translateY/10;

This is saying that the translate in x controls the offset of the texture in U and the Y controls it in V! The /10 is because the original translation was to strong so i want it a little slower! 

Step 5: Organization and UI are key!

Thats it! We are done! Just change some names and organize the outliner!

Download maya files here!

Posted in 3D