Game Character Development with Maya - page 80


Kila and Grae are now truly complete. They have been fully textured, giving them color to bring them to life in the game world. Throughout this chapter we have discussed how to create textures as well as how to reduce the file size of texture pages. With the models now finished, you're ready for Chapter 10, where you will explore levels of detail.

    Chapter 10. Levels of Detail (LODs)

    CD Files



















    NOW THAT OUR characters are complete, including textures, and have been signed off by our managers, we can proceed to generate the level of detail (LOD) models needed to preserve processing power.

    As we have already discussed (mainly in Chapter 5, "Model Optimization"), saving processor power and memory is very important when creating computer games. Here in Chapter 10 we will demonstrate how to gradually reduce a character to its lowest resolution, efficiently optimizing the model to get the various levels of detail needed in the game.

      Why Do We Need LODs?

      When a character is far off in the distance, essentially taking up few pixels on the screen, there is no need for the character to have 4000 polygons when 100 or less will do.

      This is where LODs come into play. What you do is take your main model and create four versions, or five, or however many are needed, each one stepping down in its polygon count. As the character moves away from the camera, a different version of the model is loaded in its place. The farther away from the camera, the lower the version, until the character can no longer be seen.

      If we use Kila as an example, her main model of 4094 polygons would more than likely be used for close-up shots, or maybe just in cut scenes. The next LOD for Kila, then, would be the main one used in game, since we could remove around 1000 polygons and still retain all the detail needed. The LOD after that would comprise 1000 polygons; then we'd drop down to around 500; and the last one would be about 100 or 200. As you can see, we step down gradually at first, before dropping dramatically as distance from the character increases. We can do this because there will be decreasing need for detail as the character moves farther away.


      The graphics programmer usually sets the number of LODs and the number of polygons in each LOD. The trick is to have as few LODs as possible. One rule of thumb in the industry is "The sum polycount of all LODs shouldn't exceed the main game model."

      You can see Kila with her levels of detail in Figure 10.1. Although there are fewer polygons in the versions that are farther away, you cannot tell.

      Figure 10.1. Kila with levels of detail

      Check out the games you play. Look carefully, and you will see characters or objects "pop" as they move away from the camera. This is the game engine swapping the current model for a lower LOD.

        Setting the Binding Pose

        Before we proceed to create LODs for both our characters, we need to alter their pose. We began with both Kila and Grae in the basic T pose, which made it easier to work with them, but we will need to alter the pose in preparation for the characters to be bound to a skeleton (which we'll do in the next chapter).

        It's advisable to alter the pose now (you could even start off designing your models with the arms posed like this, to save time). Otherwise, once the level of detail models have been created, you would need to edit five models instead of just one.

        The main areas that will need altering on Kila are the arm and finger positions.

        Arm Adjustment

        The arm should be at the average position between the most-used extreme positions. If a character only ever walks with its arms down by its sides, it doesn't make any sense to raise the arms up to shoulder level when you bind it. This would just increase distortion to the shoulder area when the skeleton deforms the mesh.

        Kila will be performing generally ordinary actions, so the arms should be set at about a 45 degree angle.

        Before we adjust them, we need to make the arms separate objects so that they're easier to manipulate.

        Detach the Arms

        Not only do we need for the arms to be detached from the torso, but also to be separated along their UV borders so that we keep the UV's intact.

        Open up the file called Kila_Texture.mb.


        Select the main body geometry and open the UV Texture Editor (Figure 10.2, left). Because we combined the body geometry, all the UVs are being displayed on top of each other. We need to separate the UVs in order to see the ones belonging to the arms.

        Figure 10.2. Select the arms using the UV Texture Editor.


        You can tell Maya to show only the faces belonging to the background image, by going to View > View Faces Of Selected Images. As seen in Figure 10.2 (middle), this will hide the other UVs not associated with this texture page.


        It may be that the incorrect image is displayed in the background, giving you the wrong UVs (Figure 10.2, left). To switch to the image you need, select it from the Image > Selected Images menu.


        Select the faces belonging to the arms, and return to the main view panel.


        Using the Extract tool, separate the arms from the body as seen in Figure 10.3.

        Figure 10.3. Detach the arms.

        The arms are now free for you to work on. (Notice your bonus: The hands are now separated, too, ready for LOD work later.) Next we will look into the best approach for rotating the arms.

        Rotate the Arms

        We want to rotate both the arms the same amount and from the same pivot on either side. We could adjust the pivot as shown earlier in the book, snapping it to a vertex close to where our shoulder pivot would be. This wouldn't be very accurate, though, because the arm would rotate around the wrong axis. What we want is for the axis to follow the orientation of the arm.

        For this purpose we will use a locator, which is a very simple dummy object that takes the shape of a cross. Locators have many uses: They can pinpoint positions in space; they can be used as a main controller; or, as in this case, they can be used to drive the rotation of a series of objects.

        We will position a locator where the shoulder pivot is, and parent the arm and hand to it. When the locator is rotated, the arm will rotate correctly.


        Create a locator by going to Create > Locator. Then move it up to the correct position over the shoulder's pivot point (Figure 10.4a).

        Figure 10.4. Create a locator and position it at the shoulder pivot.


        To make the rotation more precise, switch to the top view (Figure 10.4b) and rotate the locator to match the orientation of the arm (Figure 10.4c). This rotation should only be around the Y axis.


        Duplicate the locator, and make the Translate X and Rotate Y attributes negative values. This mirrors the locator for the other arm (Figure 10.4d).


        Now select the arm geometry for the first arm, then the hand, and then the locator last. To parent them, press P.

        Do the same for the opposite arm, parenting the arm and hand to the other locator.


        By selecting the locator last, you are telling Maya that you want the objects you selected first to be parented to the locator.


        The rotations must be exactly the same on either side, so we will activate snapping on the Rotate tool. Double-click the Rotate tool icon, opening up the tool's options (Figure 10.5).

        Figure 10.5. Enable Snap Rotate in the Rotate tool's options.

        Enable Snap Rotate and set the Step Size to 5.0. This will make the tool rotate in units of 5 instead of flowing freely.


        Rotate the locator around the Z axis (blue), using the manipulator and not the Channel Box. (If you used the Channel Box, the locator would not rotate around its local axis; instead, the Z axis might default back to the global axis.)

        Rotate the locator by seven steps, and then do the same to the opposite arm (Figure 10.6).

        Figure 10.6. Rotate both locators seven steps.

        The arms are now orientated correctly, meaning we can now reattach them to the torso. Make sure you deactivate Snap Rotate on the Rotate tool before you proceed.

        Reattach the Arms

        Now the two arms are in position, and we can stitch them back onto the torso. First, we need to combine the three pieces of geometry into a single model.


        Select both arms and the torso and combine them (Polygons > Combine).


        Work your way around the shoulders, merging the vertices so that they lie in between the arm and torso geometry (Figure 10.7, right).

        Figure 10.7. Weld the vertices around the shoulders.


        As you can see in Figure 10.8, left, the shoulders are no longer shaped correctly, so work the vertices and smooth out both shoulders (Figure 10.8, right).

        Figure 10.8. Smooth out the shoulders.


        Remember to keep the shoulders symmetrical, select the opposing vertices and move them at the same time. If the vertices need to be moved away from or toward each other, simply use the Scale tool instead of translation.

        Now that the shoulders are repositioned and smoothed out, let's reposition the fingers.

        Finger Adjustment

        Like the arms, the fingers should be between their most extreme positions. Currently they are flat, which is close to one extreme. We need to go in and bend them slightly so that they look more relaxed.


        Adjusting the hands is a good idea, but it's not strictly necessary, so feel free to skip this section if you like.

        To save time, we can delete the right hand and work only on the left. We can do this because both hands have more or less the same UV mapping. Then we can duplicate the edited hand to replace the right hand.


        Delete the right hand.


        The left hand will still be parented to the locator, so unparent it by selecting it and going to Edit > Unparent.

        The hand's orientation is currently correct, but to make editing the fingers easier, you'll need to rotate the hand in order to flatten it. Before you do, though, you need to store (freeze) its current position and rotation.


        Freeze the transforms (Modify > Freeze Transforms). This will reset the translation, rotation, and scale values to zero, meaning that after you're done editing the fingers, you can just set the Rotate values back to zero again, resetting the hand to its correct position.


        When you detached the arm at the very beginning of this pose-adjustment process, the pivot point for the hand defaulted back to the center of the world, and this will now make it difficult to manipulate. So center the pivot for the hand by going to Modify > Center Pivot.


        With the translation, rotation, and scale values at zero and the pivot centered, you can now rotate the hand so it is flat, as shown in Figure 10.9, middle.

        Figure 10.9. Adjust the orientation of the hand before bending the fingers.


        Adjust the fingers so they are like the ones in Figure 10.9, right, bending them into a more relaxed pose. Look at your own hand for reference.


        When you are happy with the shape of the fingers, reset the hand rotations back to zero in the Channel Box or by using the Modify > Reset Transforms tool, returning the hand back to its correct orientation.


        Duplicate the left hand to create the right hand.


        Make sure you snap the pivot point back to the world's center before you mirror it. Press Insert to activate the pivot point and then hold down X, which will snap the point to the grid as you move it.


        With the right hand selected, open the UV Texture Editor and adjust the UV's so the back of the hand is over the section that does not have the tattoo on it. You can see this in Figure 10.10.

        Figure 10.10. Adjust the new right hand's UVs.


        To finish your work on the pose, clean up all the geometry in the scene. Go to Edit > Delete All By Type > History. You have to delete the history first because (even though none of the geometry is still parented to the locators) the locators are still attached to the geometry via history. Once the history is cleared, you can safely delete the locators.


        Finally, save the scene as Kila_Pose.mb.


        Now that you have a hand that is modeled, optimized, textured, and posed, I recommend saving it to your Morgue. It's a nice addition to your collection for use on future characters.

        Figure 10.11 shows Kila in her new pose.

        Figure 10.11. Kila in her new pose

        Grae, too, needs to be posed, so load Grae_Texture.mb. Adjust his arms and fingers just as you have done Kila's. Save him as Grae_Pose.mb when he's finished.

        When your models are posed and ready, you can begin generating the levels of detail.