The Wind-up Cow Tutorial
Introduction to computer animation
using Maya
Part 2: Texturing
The first thing you need to decide when creating shaders is what "material" to use. We will discuss all the possible materials in class, but for this cow toy we will most likely want to use a Phong. The material determines what sort of surface the object has (as in how it reacts to light). A Phong is a plasticy looking material. To create a new shader open the multilister >Window>Rendering Editor>Multilister. In the Multilister menu click on >Edit>Create. This opens the "Create Render Node" window. It opens to the materials tab, where all of the possible materials are listed. Click on the shader ball named "Phong".
Our first shaders will be simply solid colors. To choose a color, double click on the shader Group sphere in the Multilister, and the attribute editor for the Phong opens. Click on the square of color (initially it will be gray) to open the color chooser. Select you color on the color wheel or from the palette and click accept. For the horns of the cow choose a yellow. Now the Phong in the Multilister is yellow.
To assign the shader to an object, select the object (in this case, the horns) and in the Multilister menu click >Edit>Assign. That is it. You can also Middle Mouse drag the shader onto an oject in the view window. Now create orange, red, white and black Phongs and assign them to the cow as in the scene below:
I used a dark gray Blinn shader for the key. A Blin is used for a more metallic look. Don't texture the mouth, arms, body or head just yet.
Creating Animatable Eyes
Now we will create an eye assembly which will allow for animation of the direction the cow is looking as well as the ability to blink. We want to build the eye assembly at the origin so we first need to hide the rest of the cow Box-Select all of the Bee surfaces and press "display> hide> hide selection" ( hot key- cntrl h). Or place them in layers and hide the layers.
Create a nurbs sphere. (this time you can reset
the option box to use the defaults). In the channel box rename eyeball. Before
we create aim-constrain the eyeball to a locator, however we need the put a
texture on the eyeball surface so that we can tell which way it is looking.
The Eyeball Shader
To better see the texture as we work, select the sphere, and hit hot key 3 (smooth display) and 6 (show textures). Blinn is the shiniest material, a good choice for an eyeball so create a new Blinn. A new Blinn shader ball appears in the multilister. With this shader ball selected, click on your sphere, and in the multilister click on assign. Your sphere should now look shiny although still gray. Double click on this shader ball (or use hot key cntrl a) to open the attribute box for the shader. In the box for ramp rename it eyeball". Under "common material attributes" there is a line called color. You sill see a color box (grey by default) with a slider, and a small checker box to the right.
This little box is for mapping the attribute. Click on this box. The "create render node" box opens again. This time we want to create a "ramp" map for the color, so click on "Ramp". The attibute box for the ramp now appears, and your sphere should appear red, blue and green. Change the ramp attibutes as folows:
Type - U ramp
Interpolation - none
This changes the direction of the ramp and makes the edges sharp. We only need two colors for the eyeball. The ramp color box still shows red, blue and green. Each color has a square box with an x inside on the right side. Click on the x-box for the blue color to delete it. Each color also has a small circle to the left. Click drag the red and green circles up or down to adjust the placement of the colors.
NOTE: The eyeball at this point should be looking straight up along the Y axis. This is correct for now - DO NOT rotate the sphere. This is important for when we do the constraint.
The eyeball ramp attributes
Once you have the two colors properly placed, we want to change them to black and white (or whatever color eyes you character has) . Select the green color (click on little green circle) then click on the green box next to "selected color". The "color chooser" box opens. Select a black shade in the color chooser by clicking on it, then press Accept. Change the red on the ramp to white the same way.
The Aim Constraint
Now we have an eyeball with a pupil, and we can aim constrain it. Close the Attribute editor and the Multilister. Group the eyeball to itself, creating a group node. Name this new node eye_group. Switch to the "Animation" menu. Click on (create> Locator). A green t appears at the origin, (which in this case is inside your sphere). Move this locator along the X axis until it is in front of the eyeball. Rename it eye_aim. When you aim-constrain something you should no longer rotate it directly with the rotate tool. Moving the locator will cause the eye to rotate. The aim-constraint and the pupil texture ramp are actually aimed in different directions. That is why we need to greate the extra node (eye_group). We can constrain eye-group to the locator, and still be able to rotate the eyeball because it is lower in the hierarchy. Now select the eye_aim, then shift-select the eye_group (the order of selection is important) and press (constrain> aim). Now you can rotate eyeball so that the pupil is looking directly at the eye_aim (locator). Now select only the eye_aim, and move it - the eyeball should always look toward the locator. Try rotating the eye_group, and you will see that it is constrained and can no longer be rotated with the manipulator.
To review the steps:
1. Create Sphere (eyeball)
2. group eyeball to itself (eye_group)
3. create locator (eye_aim) and place it in front of eyeball
4. select eye_aim, shift select eye_group and >constrain>aim
5. rotate eyeball until it is looking at eye_aim.
6. test my moving eye_aim and the pupil should follow
*****
*NOTE Please use a primitive sphere for your eyes, and for now DO NOT modify its shape. In order for the eye to rotate properly it must remain a sphere. later you can use a lattice deformer to change the eye shape. If you modify the shape of the sphere this is what happens:
The eyeball modeled with a lattice can rotate according to its original spherical shape maintining the modeled shape witin the lattice. The eyeball modeled directly, with no lattice, rotates according to its own center pivot, and thus in an oblong eye, such as the one pictured above, when modeled with a lattice the pupil will seem to be moving on the surface of the eyeball. When modeled without a lattice will pivot right out of its socket. After we have modeled the eyelid and made the second eye we will reshape them with a lattice.
*****
To add an eyelid create another sphere and make is slightly larger than the eyeball. (If your eyeball scale is 1 try 1.02 for the eyelid) Manipulate the lower hulls to form a half sphere with a lip fot form the eyelid. Name the new sphere eyelid, and assign it a plain white Phong shader.
Now we want to duplicate this set-up for the other eye. Shift-select eye_group, eyelid and eye_aim, and position them on the characters left side, then press (edit> group) (*Note do the selecting in the outliner or hypergraph rather than box-selecting in the panel view, and be sure you pick eye_group not eyeball to maintain the grouping you did earlier) (Hot key cntrl g). Name this new group eyeset. Move the eyeset into place. Now press (edit> duplicate> option box). In the duplicate option box click on "duplicate upstream graph". This ensures that all connections (such as the aim constraint) are included in the duplicate. (*NOTE: Due to an apparent bug in Maya your new eyeball may have a funky looking color or texture - simply reassign the shader and it willbe OK.
New eyeset with funky shader
We now have eyeset2. You can rename each item in a hierarchy with a prefix. select eyeset and >modify>prefix hierarchy names and type L_ in the box. Now each node in L_eyeset has an L_ infront of it. Select eyeset2, and prefix R_. Then scale R_eyeset2 to -1 in X to place it on the right side of the head. We can now control the eyes independently, however we will certainly want to control both eyes with a single control. to do this shift select the two locators (L_eye_aim and R_eye_aim) and group them. Rename this group Eye_Control. Since this is a new group the pivot point is at the origin, we want it to be at the center of the group (that is between the 2 locators) Select the Eye_control group and >modify>center pivot .
We now have a single node for both eye_aims to control the eyes , however there is nothing to see in the view panels to represent this node. We can choose it in the hypergraph or outliner but it is much handier to use a visual handle in the view panels when animating. Everything in Maya is actually born with such a handle - it is just invisible by default. In order to make the Eye_Control handle visible, select it, and press (display> object component> selection handle). A very small t icon appears at the pivot center of the group, this is the selection handle. Choosing this handle chooses the Eye_Control node. If you plan on only controlling the eyes as a team (which is typical unless you want your bee to cross his eyes) you can hide the locators (select L_eye_aim and R_eye_aim) by pressing (display> hide> hide selection).
Up to this point the eyeballs have been perfect spheres. We needed to keep the spherical shape in order for the rotation of the eyeball to work with aim constraint. We can now modify the shape with a lattice to fit the cow. Switch to the Aimation menu set, select the groups which represent the eye geometry (do not include the eye controls or aims) and click >deform>create lattice. A wire box appears around the eyes. This is the lattice. Switch to component mode (F8) and be sure the selection mask for lattice points is on. (it is the same mask as for CVs). In the channel box you can increase the divisions of the lattice - I used 5 T divisions, 5 U divisions and 2 U divisions. Now you can manipulate the lattice points much the same as you would CVs, to make the eyeballs and eyelids the proper shape without interfering with the aim constraint. Notice also that if you rotate the eyelid it conforms to the shape of the eye as it blinks.
eyeballs and eyelids modeled with lattices
IPR Test Rendering:
Although you can see the shaders somewhat in the viewports, it is a good idea to test render as you add textures to see what you really have accomplished. To set up for the IPR (Interactive - Photographic - Rendering) maximize the perspective window and tumble and dolly in to get a good view of the surfaces. Since these renders are just tests we will reduce the quality in order to speed things up.
Open Render Globals - (window> render globals), and under the "Common" tab, change the folowing attributes:
Resolution: Render resolution:
320 x 240 (this is about half size so the rendering will be quicker)
Anti-Aliasing Quality: medium quality
Set up the perspective window to get a good view of the surface and press (Render> IPR Render into new window). Click drag a select box aroung the area you may adjust in the render window to identify the region for the render to update. Now as you make texture changes - such as color, transparency etc. they are quickly updated in the render window. DO NOT CHANGE THE VIEW IN THE PERSPECTIVE WINDOW. . When you are satisfied, close the render window.
Texturing the rest of the surfaces
(Once again, I'd like to remind you that this tutorial covers just the basics. You may embellish your model textures to your heart's desire. In class I will be showing you more information about texturing such as bump and displacement maps, as well as how to animate textures.)
Open the multilister (*note: texturing can also be done in the hypershader but for this excercise we will use the multilister). Be sure that all you surfaces are in smooth display mode (3) and that all views indicate show hardware textures (6).
Since the arms and hooves are a single surface we can use a ramp to make them two colors. Create a Phong shader and assign it to the arms. In the shader attribute box click on the map for color (just like we did for the eyeballs), and select "ramp". Change type to U ramp and interpolation to none. Now just like the eyeball shader, delete a color, and change the remaining color to black and white. Move the black and white up or down until, in your perspective window, the arm is white and the hoof black.
You can assign this same shader to the other arm.You can also use a Ramp texture for the mouth, making the inside red and the outside orange.
The cow so far:
Painting Textures:
You can actually paint in 3 dimensions in Maya. We will paint the spots onto the cow's head and body. To paint the body go to the Rendering menu set. Select the cow's body and click >Texturing>3D Paint Tool and open the option box. To begin with if you hold your mouse over the surface a large red circle with an X appears. The surface is not yet paintable. The first step is to assign a texture. Scroll down in the 3D paint window to the button "Assign File Texture" and click it. A box opens asking what resolution you want to use for the resulting image file (512 x 512 should be fine) Maya now knows to create an image file of whatever you paint to be used as the color in your shader. (It is a good idea to use a .jpg or .tif format for the file so that you can later open it in Photoshop or other image editing software to modify or refine it.) Now when you hold the mouse over the body of the cow a large red circle appears without the X. This is the outline of your paintbrush, indicating that the texture has been assigned and surface is paintable.
Scroll back up to the top of the 3D paint window and, under the category "Flood", change the flood color to white and click "Flood Paint". This makes the entire cow body white, and we can paint on black spots. In the category "color" change the paint color to black. Obviously the size of the paint brush is too big. To make it smaller, either change the slider in the box marked radius, or you can change it interactively in the view window. You do this by holding down the "b" key and Middle mouse dragging in the view window. With a smaller brush you can begin to paint on the spots. (Note: labeled Artisan there are several brush profiles to choose - you want the one wth hard edges).
When you are happy with the spots scroll back dow in the 3D paint window and click "Save Textures". That is it - Now create a shader the same way for the cow's head and she is done.
Final Textured Cow
Go to: Part 3. Animating