3D Game Programming All in One
Authors: Finney K. C.
Published year: 2006
Pages: 58-61/197
Buy this book on amazon.com >>

Moving Right Along

In this chapter we had our first peek at the world of textures. As the book unfolds, we will examine the uses for textures in more detail.

Then we took a detailed look at a powerful imaging tool that we can use to create and edit textures—Paint Shop Pro. As you have seen, Paint Shop Pro has a very complete feature set.

In the following chapter, we will expand our understanding of using textures in game development by learning how to skin objects, such as player models and vehicles.



Chapter 9: Skins

 Download CD Content

Overview

Skins are special textures used in games . The quality that separates skins from regular textures is that they typically wrap around the shape of a 3D model. It is fairly obvious that 3D monsters and player- characters would have texture skins, but the term can also apply to automobiles, wheelbarrows, mailboxes, rowboats, weapons, and other objects that appear in a 3D game.

Typically, skins are created after a model has been unwrapped, so that the skin artist knows how to lay the skins out in the UV template. We're going to do the process a bit backward, simply because we should stay on topic with Paint Shop Pro and textures until we've covered the topic sufficiently.

In our case here, it isn't a big issue anyway, because I'm providing you with UV templates from previously UV unwrapped models to work with.



UV Unwrapping

UV unwrapping is a necessary function prior to skinning a model. Consider it part of the modeling process in the context of this book. However, in this chapter we'll deal with the texture processing part of skinning a model and use models I've provided on the CD. Later you'll create and skin your own models and do the unwrapping and other things. We'll cover how the unwrapping works in more detail then.

When we want to apply textures to 3D objects, we need a system that specifies where each part of a texture will appear on which parts of a model. The system is called U-V Coordinate Mapping . The U-coordinate and the V-coordinate are analogous to the X- and Y-coordinates of a 2D coordinate system, though they're obviously not exactly the same.

Imagine (or you can actually try this at home yourself) taking a closed cardboard box and slicing it open along the edges. Then lay the whole thing out flat on the kitchen table, with no parts overlapping parts. There, you've unwrapped your box. Now get out your crayons and draw some nifty pictures on it. Then glue it all back together again to make a box. I think you get the idea.

With UV unwrapping we apply the technique to some complex and irregular shapes , like monsters and ice cream cones.



The Skin Creation Process

When we begin the skinning process, we will have a bare, unadorned 3D model of some kind. For this little demonstration, we'll use a simple soup can (see Figure 9.1). It's a 12-sided cylinder with a closed top and bottom (end caps). Each side face is made up of two triangles, and the end caps are made of 12 triangles each, for a total of 48 triangles . Nothing too special here.

click to expand
Figure 9.1: The victim—a simple can of soup.

Using the UV Unwrapping tool, we have to basically spread all our faces out over a nominally flat surface (see Figure 9.2).

click to expand
Figure 9.2: Laying it all out—the unwrapped can.

We save the image of the UV template, plus we save the original model file, because the UV Unwrapping tool will have modified the UV coordinates for the objects in the model, and we can save those changes to the file so that the modeling tool can read them back in again.

Then we import the unwrapped image with the lines indicating the face edges into an image processing tool like Paint Shop Pro and apply whatever textures, colors, or symbols we need, such as shown in Figure 9.3.

click to expand
Figure 9.3: After applying textures.

Notice that for textures I simply created markings and re-created a simple label. For the top of the can I made some circular text, and for both end caps I made a circular pattern that represents the ridges you often find in those places on tin cans. The image file has now officially become a skin for the can!

The final step is to import the new skin into the modeling program (or the game) and view the results, as in Figure 9.4.

click to expand
Figure 9.4: Aha! Not such a simple can anymore. Nutritious, too!

The part of the process we will focus on in this chapter is the activity shown in Figure 9.3, the actual creation of the textures on the UV template, so that it can be later used as a skin for models.


3D Game Programming All in One
Authors: Finney K. C.
Published year: 2006
Pages: 58-61/197
Buy this book on amazon.com >>

Similar books on Amazon