In this section we will add transparent areas to the geometry by using an alpha map. An alpha map is basically a grayscale image. This image tells Maya (or your game engine) which parts of the texture page are transparent and which are opaque. In Maya, areas that are pure white (values 255,255,255 in all red, green, and blue channels) will render opaque; black (0,0,0) will render transparent; and any values in between will be translucent to varying degrees. (Some game engines invert these values, so it's important to check with your manager to verify the final opacity values.)
There are five regions in our two characters on which we can use an alpha map. For Kila, we can implement alpha maps into her hair, eyes, and eyelashes. Grae only needs alpha maps on his eyes and wings.
Creating the Hair Alpha Map
Let's look at Kila's hair first. At present, her hair is quite angular (Figure 9.29), and we can fix this by making the strands more transparent toward their ends, losing the sharp edges that the polygons form.
You first need to create the alpha map. Load in the current hair texture file, KilaHair.psd.
Create a new layer called Alpha.
The white areas of the image will be opaque, and black will be completely transparent. Most of the hair will be solid, so fill the layer in white.
In black, draw in all the areas that will be transparent. Thanks to the size of the page, you can afford to draw in a bit more detail in this step, allowing for additional hair strands that will "break up" and more clearly define the hair.
Use the Blur tool to smooth out some of the edges. The alpha map also works in different shades of gray, so the blurring will make the hair gradually fade out.
Be careful not to blur the edges too much. Go in afterward and remove some of the blur with the Eraser tool. Areas that are gray will be semitransparent, so make sure areas that must be completely transparent are solid black.
You can see the finished alpha map in Figure 9.30.
Figure 9.30. The hair alpha map
Figure 9.29. Using an alpha map, we can make Kila's hair less angular.
Before you save the alpha map, quickly invert it by going to Image > Adjustments > Invert. You will be able to see any subtle areas that you may have missed when painting on your image.
You can use Photoshop's Eyedropper tool to sample the black and white colors to ensure that you have 0,0,0 and 255,255,255 values.
Most game engines require the alpha map to be a separate texture page, so at this point you could save the complete file as a .psd, then flatten it and save it as KilaHair_Alpha.tga.
Viewing the Alpha Map in Maya
The main alpha map is complete. Next, we will bring it into Maya so we can see how it looks when applied to the character. To see the image in Maya, we will embed the alpha map into the main hair image.
Make sure KilaHair.tga is the active window in Photoshop. You need to work in the Channel window, so open it up by going to Window > Channels. This shows the different color channels that exist in the image: red, green, and blue.
Create a new channel. Just as in the Layers window, click the Create New Channel button at the bottom of the window, directly to the left of the trashcan. This adds a new channel, conveniently called Alpha 1 (Figure 9.31).
Figure 9.31. Create a new alpha channel.
Switch back to KilaHair_Alpha.tga or the .psd from which it was created. Select the entire alpha layer you drew earlier (Ctrl+A/Cmd+A), and make a copy of it (Ctrl+C/Cmd+C).
Select the Alpha 1 channel of KilaHair.tga and paste the alpha map into it (Ctrl+V/Cmd+V).
Flatten the rest of the image, leaving you with the hair texture. Save it as a Targa file, selecting 32 bits/pixel when prompted. The 32 bits/pixel option ensures that the alpha map is embedded in the image file.
Move into Maya. Reload the textures and open up Hypershade.
Double-click the material called Kila_Hair, opening up its attributes.
Still in the Hypershade window, click the Textures tab to reveal all the texture files associated with the scene.
With the middle mouse button, select and drag the hair texture over the Transparency attribute in the Attribute Editor. A box will appear around the Transparency attribute, showing you that it's all right to drop the texture here.
Go back to the view panel, and you will see that the hair now has transparency (Figure 9.32, left).
Figure 9.32. After applying the alpha channel, fill in any gaps in the hair geometry.
With the alpha map applied to the hair, you may experience some display problems. The lower layers of hair may pop through the outer one, as you can see on the right side of her hair in Figure 9.32. This is mainly due to the hair geometry's being separate from the rest of the image; combining them will reduce the problem. This issue is a display problem within Maya and not indicative of transparency errors in the alpha map.
All that is left to do is adjust the vertices on the separate strands of hair, thickening them and widening them to fill in any large gaps in the hair (Figure 9.32, right).
The hair is now complete and ready. Next we will work on the alpha map for the eyes.
Preparing the Eyes' Alpha Map
At present, the eyes don't look real; they have no depth, mainly due to the lack of highlights. Using the alpha map created for Kila's hair, we can add these highlights as well as a slight shadow to the whites of the eyes. First, you'll prepare the eyes to receive these details.
In Maya, hide everything except for the eye geometry (Figure 9.33a).
Figure 9.33. Create duplicates of the eyes.
Duplicate the eyes, moving the copies slightly forward (Figure 9.33b).
You will apply the alpha map to the duplicates. This means the eyes as a whole can rotate, while the highlights and shadow stay static. You can therefore delete the back row of polygons from the duplicates (Figure 9.33c and 9.33d).
Move the duplicate eyes back so they exist just in front of the original eyes (Figure 9.33e).
Finally, apply the hair material to the duplicate eyes. (We are using the hair page because it already uses an alpha map and has extra UV space in it.) They will be completely black for the time being, until you update the texture.
With the duplicate eyes still selected, open up the UV Texture Editor (Figure 9.34, left).
Figure 9.34. Apply the hair texture to the eyes.
Separate the UVs for each eye so that they no longer lie on top of each other. Then reposition the UVs for both eyes so that they lie over the empty space on the texture page (Figure 9.34, right).
Now we have extra information on our UV Layout. We need to export it as a UV Snapshot so we can use it in Photoshop. Export the eye UVs as a temporary file, making sure it is the same size as the hair texture page (256x256 pixels).
The geometry is prepared; now let's update the alpha map.
Creating the Eyes' Alpha Map
Follow these steps to add the eye details to the alpha map.
Open the KilaHair.psd file.
Load in the UV snapshot you created for the extra eye UVs.
Copy and paste the new eye UVs into the KilaHair.psd file; this will create a new layer.
Using the new UVs as a guide, work on the alpha layer and create two black circles marking where the eye alphas are. This will initially make them completely transparent.
To create the shadow at the top of the white part of the eye, create a new layer and mark in the shadow; use white over the top of one of the black spheres. Make sure to blur the lower edge so the shadow is quite soft.
Duplicate this layer (Ctrl+C/Cmd+C and then Ctrl+V/Cmd+V) and mirror it, creating the shadow for the other eye. Adjust Opacity for both of the layers to about 60%.
With the shadow done, create another layer and mark in the highlights for one of the eyes.
Duplicate this layer and move it into position for the other eye. Your alpha map should now look like the one in Figure 9.35, right.
Figure 9.35. Update the alpha map and texture page to add eye details.
To complete the highlights, you will fill the same area in white on the color texture page (Figure 9.35, left). If you forget to do this last step, the highlight will be displayed in black because the area that is white (solid) on the alpha map is black on the color texture page.
Update the Alpha 1 channel in the Channels window; then flatten and resave your image.
When you reload the texture in Maya, the shadow and highlights will be applied to the eyes (Figure 9.36, top). Furthermore, when the entire eye rotates, these highlights will stay static; this is demonstrated in Figure 9.36 (middle and bottom).
Figure 9.36. The eyes with highlights and shadows applied (See page C16 for color version.)
You may need to alter slightly the geometry that holds the highlights, to prevent the main eye geometry from popping through when the eyes move.
Kila's eyes now look much better and have more life. Next, we will address one last area that needs the alpha map: the eyelashes.
Creating the Eyelash Alpha Map
At present, Kila's eyelashes are a little boring; at the same time, they're exaggeratedly thick. We will tone them down and make them more realistic by adding more detail.
Select the faces that make up the eyelashes and extract them, separating them from the main model.
Apply planar mapping to them along the Z axis. The UVs should now be laid out as seen in Figure 9.37, left.
Figure 9.37. Edit the UVs for the eyelashes so that they all occupy the same area on the texture page.
Snap the UVs for the left eyelashes to the ones on the right, so that they all occupy the same space (Figure 9.37, middle).
Adjust both sets of UVs so that the top and bottom lashes overlap. This means the same texture will be applied not only to both the left and right sides but also to the upper and lower eyelashes.
Position the edited UVs over a blank area of the page (Figure 9.37, right).
As you did with the eye highlights, create a new UV snapshot to work from, importing it into the .psd file in Photoshop.
As seen in Figure 9.38, draw the texture for the eyelashes on the alpha page, leaving the same section on the main color page black.
Figure 9.38. Update the alpha map to include the eyelashes.
Edit the alpha channel, updating the image. Flatten and save.
What you should have now are better-looking eyelashes on your model, as shown in Figure 9.39.
Figure 9.39. The eyelashes before and after updating
We are finished with Kila's alpha map, so let's work on Grae's wings.
Creating the Alpha Map for the Wings
Grae's wings are not just a single object; they consist of numerous tendrils that come out of his back. To keep the polygon count down, we created the wings from a number of larger polygons, intending to add the tendrils with the help of an alpha map. Because the tendrils are solid black, the main color page for the wings can be solid black, too. The alpha map will be the one that holds all the detail.
Load the file GraeWing.psd.
Create a new layer called Alpha, filling it in black (meaning it will initially be completely transparent).
Go in with solid white and draw the individual tendrils, as seen in Figure 9.40.
Figure 9.40. Draw the tendrils into Grae's wing alpha map.
Now copy the alpha layer into an alpha channel, hide the alpha layer so that the color channels will be solid black, flatten the image, and save it. Then view it in Maya (Figure 9.41).
Figure 9.41. Grae with wings textured
Your next task is to go in and add highlights to Grae's eyes, as you did for Kila. That will finish him upall of your alpha maps are done.
The main textures for both Kila and Grae are now complete, and you can see them in Figures 9.42 and 9.43.
Figure 9.42. Kila's texture pages (See page C7 for color version.)
Figure 9.43. Grae's texture pages (See page C8 for color version.)