The Arms and Legs


The Arms and Legs

Two of the main areas on a model that need to be tested are the arms and legs, in particular the elbows, shoulders, and knees. These areas are important because they bend the most as the character moves around the game world and interacts with the environment and with other characters.

Setting Up the Arm Skeleton

Let's start by loading the file called Kila_Optimized.mb and focusing in on her left elbow. You can see the elbow in Figure 6.1, and up to now there are no major problems with it. Let's put a basic skeleton in and see how it bends.

1.

Switch to the top view so that you are looking down on the arm. Switch to wireframe mode (press 4) so that you can see the joints as we place them.

Switching Views.

Use the number keys to cycle through the viewing modes in Maya.

  • 4 switches to wireframe mode

  • 5 switches to shaded mode

  • 6 switches to textured mode

  • 7 switches to lighted mode


2.

To begin placing the joints, switch to the Animation menu set (F2). Go to the Skeleton menu and select the Joint tool. Leave the options alone for now; we are going to use the default settings. We will explore joints in more detail in Chapter 11, "Skeleton Setup."

3.

Following Figure 6.2, place the first joint just before the shoulder, then one at the shoulder itself, then at the elbow, and finally at the wristmaking four joints in all. Press Enter to confirm the placement. Don't worry about renaming the joints; they are only temporary.

Figure 6.2. Place four joints: before the shoulder, at the shoulder, at the elbow, and at the wrist.


The joints are now correctly placed in the X and Z axes, so next let's check the Y axis.

Tip

You can adjust the size at which joints are displayed by going to Display > Joint Size.

4.

Switch to the front view (Figure 6.3, left), and you'll see that the joints at this stage all lie in the wrong place in the Y axis. You need to move them up so they are positioned down the center of her arm. If you select and move the first joint you placed, it will also move the rest, because the other joints are parented to this one and thus inherit its movement. This will put the arm into the basic position for us.

Figure 6.3. Move the joints up so they lie down the center of the arm.


5.

To fine-tune the positioning of the remaining joints by moving each in turn until they are all correctly positioned down the center of the arm (Figure 6.3, right).

Once you have the main shoulder joint in place, you can use the Rotate tool to position the rest if you prefer, although it's not essential.

Tip

If a series of objects are placed in a hierarchy, you can select the children or parent by using the arrow keys. Pressing the up arrow will move up the chain; pressing the down arrow will move down the chain. This process is called "pick walking."

Figure 6.1. For our first skeleton area, focus in on Kila's left elbow.


This is all we need to do at this stage to build a basic skeleton, so let's continue with our arm setup.

Skeleton Binding

Now we need to attach the mesh to the joints. The skeleton essentially drives the model and deforms it for us.

1.

Select the first joint of your skeleton. Then hold Shift and select the geometry so that you have both the skeleton and the mesh selected.

2.

Open up the options for a smooth bind (Skin > Bind Skin > Smooth Bind).

3.

Make sure your Smooth Bind options are configured in Figure 6.4. The important sections are Max Influences and Dropoff Rate.

Figure 6.4. Setting Smooth Bind options


Smooth Bind Settings

Max Influences specifies the number of joints that can influence each vertex. For example, setting this to 1 would mean that the forearm joint only influenced the vertices near it, which could make the character deform badly and look quite rigid. This number may depend on the game engine you are using, so discuss the setting with your lead artist first. Usually, 2 or 3 is a good number for Max Influences.

Dropoff Rate dictates how rapidly a joint's influence decreases as it moves away from the joint. The default is 4, which works well for most characters.


4.

When you're ready, click Bind Skin to continue. The wireframe on your mesh should turn pink, indicating that the joints are connected to the mesh.

5.

Switch to the top view and turn on Smooth Shade All in the Shading menu.

In Figure 6.5 you can't see the joints, but it doesn't matterMaya has a priority list that dictates which things get selected before others. Joints are higher on this list than polygons, so if you drag a selection over the forearm you will select the elbow joint.

Figure 6.5. Select the elbow joint and rotate it to bend the arm.


6.

Do this nowdrag a selection around the forearm and rotate the elbow around the Z axis. This is shown in Figure 6.5, right.

Note

Because this is a default bind, the elbow joint may influence the torso. Don't worry about this now; we will address this issue in the next section.

Although the geometry does bend, it's not a very natural looking elbow. What we can do now is tweak the way the joints influence the elbow by painting the weights around it.

Painting Weights

Different 3D applications use various techniques for adjusting the way joints drive geometry; Maya's is one of the best and friendliest I have used. When you paint weights, you paint a joint's influence onto the mesh, telling Maya what areas are influenced and by how much.

Let's get ready to adjust the weights on Kila's elbow.

1.

Select the mesh and go to Skin > Edit Smooth Skin > Paint Skin Weights Tool, and open up the options window. Figure 6.6 shows the options now available to you.

Figure 6.6. The Paint Skin Weights options


Also notice that in the perspective view, your geometry now has grayscale shading all over it; you can see this in Figure 6.7. This is an interactive display of the area that the current joint is influencing. White is maximum and will inherit 100% of the joint's movement; black represents no influence.

Figure 6.7. The influence is displayed for the currently selected joint.


Tip

In the Paint Skin Weights options you can select which joint to work on in the Influence panel. You can also right-click a joint that is bound to the mesh and select Paint Weights from the marking menu.

2.

Leave the Paint Skin Weights window open, as you'll need to refer back to it as you paint. Move your mouse curser over the geometry and you'll notice that the pointer changes to a paintbrush icon with a red circle around it (Figure 6.8). This shows you where you are painting as well as how large your brush is.

Figure 6.8. The mouse pointer changes to indicate where you are painting and the size of your current brush.


Note

To change the brush size, just hold down B, then click and hold the middle mouse button. The cursor will change to two horizontal arrows; now just scrub the mouse sideways to alter the size.


Options for Painting Skin Weights

There are lots of options to play with in this tool, as you can see in the Paint Skin Weights options window. Typically, I only use the few I have highlighted in Figure 6.9, but feel free to experiment with the other brushes and options until you find a way of working that you're comfortable with.

Figure 6.9. The weight-painting options I frequently use are highlighted here.


Opacity (in the Brush panel) and Value (in the Paint Weights panel) work together:

  • Value sets the amount by which the joint influences the skin. A setting of 1.0000 will fully influence the vertices. This value is the maximum a vertex will be influenced. If you set it to 0.5, a vertex will only be influenced by 0.5, no matter how much you paint on (unless your paint operation is set to Add).

  • The Opacity setting dictates how much of the Value will be painted by each stroke. So if your Value is 1 but your Opacity is 0.25, you will only paint one-quarter of the full value each time.

The Paint Operations (in Paint Weights) you can perform are as follows:

  • Replace is the paint operation I tend to use most often. This operation simply replaces the current influence with whatever you are painting. I find it quick and easy to get good results by only using Replace.

  • Add will add on top of the current influence.

  • Smooth averages the influence values of adjacent vertices, much like a blur operation would soften the edge between a black area and a white area in an image. Smooth is quite handy when, for example, you have a large area that needs a gradual, smooth deformation.

  • Scale reduces the influence on joints that are farther away.

The various brush types are represented next to Profile in the Brush panel. These influence the way you paint; choose among a fine brush stroke, a solid brush with smooth edges, a solid brush, and a square brush.


Elbow Weight Painting and Testing

Now that you've seen the weight-painting options, let's paint the elbow and see if we can get a good shape when it is bent.

1.

Set Value and Opacity to 1 (their highest settings). Select the solid brush, which is third from the left, and choose joint, which is the elbow joint.

2.

To begin, make sure the vertices away from the elbow are fully influenced by their respective joints. While we have the settings on maximum, paint around the section of vertices highlighted in Figure 6.10, making them pure white. (Most of these are already fully influenced by the elbow, but it doesn't hurt to check.)

Figure 6.10. Set the vertices just out from the elbow, to be fully influenced by the elbow.


3.

Reset Value to 0 and paint over the upper arm (Figure 6.11), removing any influence the elbow has over this area.

Figure 6.11. Remove the influence from the upper arm.


4.

Set Value to 0.5 and paint over the middle section of the arm, highlighted in Figure 6.12, so that the elbow and upper arm both influence this area. You will probably have to select joint2 and paint the area again, since both joints will be influencing this bend.

Figure 6.12. Paint the middle of the arm so that both the shoulder joint and the elbow joint influence it.


5.

We now have each row of vertices weighted neatly. Put Value back to 1, select the softer brush (second from the left) and move Opacity down to about 0.2.

Go ahead and work some more on the elbow area and see if you can achieve an acceptable result. You will end up with the elbow looking much like that in Figure 6.13 (left). Not looking very good, is it? We could spend more time painting the area, but we won't get a satisfactory result. No matter how much we try, we will still end up with the sharp angle on the outer edge and the pinching on the inside.

Figure 6.13. The elbow so far


Fixing this will involves adding more polygons to the area, as illustrated in Figure 6.13 (right). We'll discuss that next.

Adding Polygons to the Elbow

We need to add some polygons to keep the elbow from pinching as it bends. These will lie close to the actual elbow. They will only be added at the front and the rear because the elbow only rotates around one axis; we don't need to worry about the top and bottom.

1.

To quickly get the joints back to their original position, right-click the first joint and select Assume Preferred Angle from the marking menu.

2.

Select the mesh and open up the options for Skin > Detach Skin. Make sure the Delete History option is selected, then click Detach.

Note

In the Detach Skin options, Delete History resets the mesh back to its original shape, removing all the weighting information attached. Bake History "bakes" the bend onto the geometry, keeping the mesh in the same pose. Keep History detaches the skeleton but keeps the weighting information. This last option is handy to retain the weights from the original in case you want to add an extra joint to the skeleton after you rebind.

3.

We are back to square one, but with a better idea of how the elbow should be. Let's add some polygons now. Using the Split Polygon tool, cut the front as shown in Figure 6.14. You're cutting from the pivot point of the elbow on the top, to the one at the bottom.

Figure 6.14. Add a small section of polygons at the front of the elbow.


4.

Farther down the arm, add a new subdivision as shown in Figure 6.15.

Figure 6.15. Insert a new section across the lower arm.


5.

The final addition will be a section around the back of the elbow similar to the one we added to the front (Figure 6.16).

Figure 6.16. Add a section at the back of the elbow like the one in the front.


6.

Now that we have these extra polygons, we may as well use them to add a little shape to the elbow area (Figure 6.17). You can also add a slight depression on the inside of the elbow, too, if you haven't already. Delete the history when you're done.

Figure 6.17. With new polygons added, reshape the arm.


7.

To rebind the mesh to the skeleton select the first joint of the skeleton and then the mesh. Go to Skin > Bind Skin > Smooth Bind, making sure its options are still set at Max Influence 3 and Dropoff Rate 4.

8.

Bend the elbow and begin to paint the weights. Start by making sure the vertices on either side of the elbow are only influenced by the shoulder (joint2) or the elbow (joint3).

9.

Set the middle row of vertices to be half influenced by the shoulder and half by the elbow.

10.

Finally, as shown in Figure 6.18, fine-tune the area with the softer brush and smaller opacity setting to get the shape just right.

Figure 6.18. Paint the elbow to achieve a satisfactory bend.


This is a game model, so we're not going to get the elbow perfect, but we have a decent elbow deformation as it now stands. So while we have the skeleton in the arm, let's continue on and check the shoulder.

Shoulder Weight Painting and Testing

The shoulder area can be quite tricky because it has three axes of rotation rather than one. Let's see how it looks when it is rotated.

1.

To begin, make sure Kila's complete torso is fully weighted to the first joint, joint1. It should be completely white, as seen in Figure 6.19.

Figure 6.19. Fully weight the torso to the first joint in the skeleton.


2.

Select the shoulder joint and rotate it down, so her arm is by her side, to see how it deforms. As you can see in Figure 6.20, it's not very good at the moment, but a little painting will sort this out.

Figure 6.20. The shoulder before painting.


3.

Begin by removing some of the shoulder's influence from the top of the shoulder and the area under her arm. Do this by selecting the first joint of the arm and using Add in the Paint Weights options to make these areas influenced more by this joint. This will reduce the amount they are affected by the shoulder joint.

4.

When you're done, tweak the shoulder until it is smooth, with a gradual gradient (Figure 6.21).

Figure 6.21. Adjust the weighting around the shoulder.


We are almost there, but the armpit area seems too high up, making the shoulder look too thin.

5.

While still bound to the skeleton, we can adjust the vertices around the shoulder, bringing the armpit down slightly, as you can see in Figure 6.22. Mesh tweaks after binding are generally not a good idea, but in this case it doesn't cause a problem since we'll be detaching the skeleton toward the end of the chapter.

Figure 6.22. Adjust the vertices to bring the armpit area down slightly.


As you can see in Figure 6.23, the shoulder now looks okay when deformed.

Figure 6.23. The shoulder area now looks better when deformed.


Note

Since we are still using a mirrored instance, the left side will deform just as the right does.


We're not yet finished with the shoulder. It bends in more than one direction, and we need to see how it looks when rotated around the other two axes. We've already worked on the Y axis, so let's reset the arm back to its default position and see how it looks when rotated around the X axis.

You will probably notice, as shown in Figure 6.24, that some minor pinching occurs. As with the elbow, we won't get the shoulder to look perfect at all angles, but the good news is that with a bit of creative weighting these problems can be minimized. There is little point in spending time to make these changes now, however. We are happy with the general topology of the shoulder at this point, so we will spend time adjusting the weights when we come to build the final rig.

Figure 6.24. Some areas still pinch, but we can fix these in the final rig.