Painting Kila's Weights
In Chapter 6, we used weight painting briefly to get an idea of how the geometry would deform. Now we will be applying the final weights, so we have to make sure all areas of her body move correctly.
We will concentrate on her left side, and then copy the weights across to the right when we are done.
Load the file Kila_FaceRig_Jnt.mb and we will start work on her arms.
The arms are probably the most important area to weight correctly. They are always in motion and can move dramatically in all directions, which unfortunately will show off any badly weighted areas.
The shoulder is capable of moving around in all three axes. Not only does it raise and lower, it can move forward and backward, and also twist. Obviously, depending on what your own character's primary actions will be, some of these poses will be more important than others.
Let's first look at the shoulder as it is raised and lowered.
Check to see how the shoulder and armpit areas look. You may need to smooth the armpit slightly but other than that it should look fine.
Now let's examine the shoulder as it rotates forward and backward. With the arm still in its horizontal position, rotate it forward around the Y axis (Figure 14.4). As you can see, we have some severe pinching that needs attention.
Figure 14.4. Rotate the arm forward around the Y axis.
With the first two rotations fixed, we can now test the twist, which is the rotation of the arm around the X axis.
The problem we get to now is one of priority. If we remove some of the shoulder's influence from the shoulder joint to make this pose look good, another pose will look wrong because the weights are then different. We wind up continually altering weights to fix one pose and then having to redo weights on another.
What you have to do is decide which poses the arm will be in for the majority of the time and concentrate on these. For the others, you can get away with the odd pinch or crease because these poses are not seen very often.
The character's texture can play a role in disguising areas that don't deform well. Using darker areas will hide any pinching in the geometry; areas that are lighter or include lots of detail serve to highlight creases and areas that stretch.
The twist pose will be the lowest priority for Kila, so let's see how it looks.
Now the shoulder should look pretty good in the major poses. Before you move on to the elbow, rotate the shoulder around and double-check all the weighting.
The elbow is slightly easier than the shoulder to weight because it only rotates around one axis.
You can see the final elbow in Figures 14.12c and 14.12d.
It's important to realize that you will not get every joint to deform realistically. We are limited to the geometry and the skeleton that we use to deform it, so all we can do is work toward the best possible result. With joint and polygon restrictions, you won't get the character to deform perfectly in all situations.
We've arrived at the wrist. Like the shoulder, it needs all degrees of freedom weighted correctly, but here the weight painting is pretty straightforward.
Again we have to think about priority when working on the wrist. We can achieve a good bend when the wrist rotates around the Y axis or Z axis, but this is at the sacrifice of the X rotation, which makes the wrist twist. Think about what actions your character is most likely to do moreif they are holding weapons, the Y and Z rotations will more likely take priority; but if the character's actions cause the wrist to twist a lot, then the X rotation will have to offer better deformation.
First, rotate the wrist around the Y and X axes to see how it deforms. You will no doubt notice that the geometry moves with the action in a way that makes the wrist appear to bend unnaturally. This is because the weights are evenly distributed between the forearm and wrist joints. We now need to lock some of these weights down.
Now the hand will move quite nicely up and down, left and rightbut look at what happens when you twist it (Figure 14.14). You get quite a bad deformation around the wrist area.
Figure 14.14. The wrist deforms badly when twisted.
In a real arm, the wrist doesn't actually twist around the wrist joint. Instead, it's the ulna and radius bones in our forearm that twist around each other, making the hand seem to rotate. To implement this properly into our character would involve adding an extra joint halfway up the forearm; we didn't include this in our rig because we required a simpler setup.
Many studio's add gloves or long sleeves to their character designs, which can disguise the twist of the wrist. This usually works well, because the hand is essentially detached from the arm and the wrist is hidden beneath the sleeve or glove.
The only solution we have is to continue to pose the hand and edit the weights until we reach a satisfactory result. So let's leave the wrist as is and look at what we can do with the hand and fingers.
We will skip the main palm area until the fingers are done, since these are more important to get right. After the main finger weights in place, we can then go in and make any minor alterations to the palm.
If the geometry making up the fingers doesn't deform correctly, the hands will not work visually. The best approach is to work on the fingers one at a time.
As shown in Figure 14.15d, the main finger is now weighted correctly.
Repeat these steps for the other three fingers and the thumb. First bend the finger, then work on each section until the weighting is correct and doesn't influence any of the other digits.
This procedure will obviously be different if you are using the lower-resolution hands that may have fewer fingers. Just make sure that each section is fully weighted to the joint that rotates it.
Now when you bend all the fingers, they should deform correctly without moving any of their neighboring fingers (Figure 14.16).
Figure 14.16. The fingers now deform correctly.
The final stage for the hands is to weight the palm area so it is almost completely controlled by the wrist joint (Figure 14.17). This will also help you to fill out the base area of the fingers if they are pinching.
Figure 14.17. Weight the palm area to the wrist.
Leg and Waist Weights
For the legs, it is best to begin at the top in the waist area, because the hip can rotate in a number of directions. When that is done, we can address the knee, ankle, and finally the foot.
Now that we have the main hip area locked, we can go in and work on the rest of the vertices, smoothing out the general area while also removing any pinches or creases. To help with this, we will first edit the weights on her thigh. At present, this is partially weighted to the Root joint, causing it to flatten as she raises her leg. Fixing this now will help show us exactly what we need to do to complete the hip.
Finally, be sure to remove any influence the left thigh has over the right.
We have now corrected the hip in one position, but it also rotates backward and out to the side. Move the foot icon back, so the leg resembles that in Figure 14.22.
Figure 14.22. Move the foot back to see how the hip deforms from a different position.
Check to see how the front and back of the thigh look. In Figure 14.23, left, the front looks fine. Maybe a little bit of tweaking is needed to straighten out her sash, but there are no major problems. The rear will need a bit more work. In Figure 14.23b we can see that there is a sharp polygon sticking up; that will need to be fixed.
Figure 14.23. The front weights look fine, but the rear needs work.
Now move the leg around and double-check each position, making sure the hip looks as good as it can before we work on the knee.
As we did earlier with the thigh, we need the lower leg to maintain its volume as it moves. Right now the thigh joint affects it, so we need to remove this influence first.
That's the knee area more or less complete now; we have adjusted all the weights we need to by just using the L_Thigh joint.
Don't be discouraged about areas that intersect when they deform, like the knee and thigh, upper arm and lower arm, and so forth. This happens all the time in video gamesunfortunately, it's the only way to allow the limbs to keep their shape and achieve the most realistic and lifelike deformations. Once the character is in game and running around, you probably won't even notice these little flaws.
Now let's look at the base of her leg and the foot.
Although things in this area may initially look all right, the main foot area's weights are distributed between three jointsthe ankle, toe, and tipmaking it flatten as the foot rotates. Let's fix this, weighting the main bulk of the foot to one joint, the ankle joint.
As a final test, rotate the foot into a few different poses to see how the jeans deform. As you can see in Figure 14.29, the folds in the jeans compress nicely and work quite well, so there is no need to do any further work on this area.
Figure 14.29. Test the lower leg's deformation in other poses.
The waist, leg, and foot have now had their weighting reworked and should now deform correctly when Kila is animated. Try putting the leg into some different poses to see how different areas deform, making any changes you need before you proceed.
Head and Neck Weights
Before we move into this section's steps for the head and neck weights, let's make sure we have the face all set. Regardless of which version of the character you are working on, the face area will have already been weighted, either earlier in this chapter (for blend shapes) or in Chapter 13 (for joint-based).
The blend-shapes face is already a separate object, meaning we can't accidentally edit its weighting. Be careful on the joint-based face, though, since the weights can easily be damaged.
If you are working on the blend-shapes model, make sure the vertices around the face are fully weighted to the head joint. The face geometry's weighting is fine, but because it's a separate object we need to guard against tearing around the edges where it joins to the body mesh. To do this, work on the body geometry, fully weighting the vertices around the face to the head joint.
In the joint-based version, make sure all but the face is fully weighted to the head joint. You can do the hair for now, if you want; just make sure not to touch the face's weights.
You can see both versions of the head in Figure 14.30. The joint-based Kila is on the left, and the blend-shapes version is on the right.
Figure 14.30. Fully weight the head and hair to the head joint, but leave the face as is.
This preparation leaves the neck, shoulders, and the outer areas of her head to work on. We will need the head icons visible, so turn the left icons off and the middle icons on. Now we can proceed to look at the neck and shoulders.
First of all, the hair joints will be affecting the neck and the top of the shoulders. Since the hair geometry is at present controlled by the head, we can safely remove its influence from the model and reapply it to just the hair later.
With that done we can now work on the necks weights.
The final neck weights should resemble those seen in Figure 14.32, right.
Figure 14.32. Edit the neck's weighting.
Check the neck's actual rotation, using the control icon to make sure it deforms correctly, and make any needed alterations to the weights.
Main Body Weights
All that is left in painting Kila's weights is adjusting the weighting on her torso area. After that, we can mirror the weights across to the right side.
The torso is quite easily fixed; you just have to keep the deformation smooth so that the body maintains its overall shape as it moves.
Be sure to take care when editing the waist area, because we have already applied some weighting to it earlier in this chapter.
You've got the main torso area complete now. Before we move on to do her chest, it's a good idea to test the shoulders' deformation when the clavicle controls are moved.
Move the left clavicle control up slightly and see how the shoulder looks. As shown in Figure 14.38, left, the main shoulder moves up fine, but the area just at the neck stays where it is, causing an unnatural indentation. With Value set to 1 and Opacity set to a small value, gently paint over the area between the neck and shoulder, bringing it up in line with the shoulder's position (Figure 14.38, middle).
Figure 14.38. Adjust the shoulder so that it deforms correctly when the clavicle control is moved.
Now that the main torso is complete, we will reinstate the controls for her breasts.
The main body area is completethat is, her entire left side is finished. It's time to mirror the weights.
You may have noticed that the hair area is not yet properly weighted. We want to mirror the weights first, before finishing the hair, because her hair is not symmetrical; that means the weights will not mirror properly in that area. We can, however, adjust these weights afterward.
With one side of Kila completely weighted, we can now save ourselves a lot of work by copying the weights across to the right side of the body.
Before you begin, make sure she is back in her default pose so that Maya can tell which joints it is copying from and to. Also, if you are using the joint-based facial rig, move the Time Slider to frame 1, separating the eyelid joints.
Maya's Mirror Weights tool doesn't always do a perfect job; the weighting tends to get confused down the center of the model, and often weights are assigned incorrectly. You may find, for example, that the vertices down the center of her T-shirt move with the right breast but not with the left. These kinds of problems will need fixing before you move on; make sure that each side equally affects the vertices in between.
Other areas to check include the crotch, which needs to stay fixed to the Root joint. The upper spine and even the base of her neck may need to be corrected, too.
Look also at areas such as her belt, which isn't symmetrical. This lies across an area that dramatically deforms, so it will be impossible for the belt not to intersect with the mesh at some point; just try for the best result you can get.
The best overall way to check your weighting is to put your character into some extreme poses. These will reveal any faults in the way the weights are distributed. You can then go in with a lower Opacity setting and tweak the weighting values until they are correct.
With the main body-weighting mirrored we can now move on and work on her hair.