Creating the Alphamap

The alphamap referenced by the alphamap key/value pair is an art file created specifically for the map. For non-digital artists, it may be one of the more technically and conceptually challenging things that need to be created to make the terrain map work.

Simply put, the alpha map is the template that the compiler uses to assign textures to the terrain surface.

To make the alphamap, you must have, or have access to, an art program that can save a file as an 8-bit BMP file with indexed color. I’ll discuss other file types later on, but the BMP file is probably the simplest solution, both technically and conceptually.

Terms

First, you need to understand a couple vocabulary words … jargon, if you will:

Indexed Color:

In essence, each color used in a piece of art is remembered by its location on the color table or palette (see below). There are 256 colors available, numbered from 0 to 255. Each position on the palette has its own number. This number has nothing to do with the RGB values of a color in that position. If you change the actual color located at a particular location on the palette (say from red to blue), all the pixels that were formerly that shade of red (if painted using a color with that index number), will change to the new color of blue.

Color Table:

This is what Photoshop calls the indexed color layout of 256 colors. In Paint Shop Pro it’s a palette. This is a pop-up window that shows the colors in the palette and their arrangement. For making an alphamap for a terrain map, the colors you choose are not important, but their position on the palette is.

Palette:

This is what Paint Shop Pro calls a Color Table.

Making the Palette

The best way to start is to make a set of colors to use when painting alphamaps. If you want, you can do this once and save it out. In PSP edit the palette (in Photoshop, open the Color Table). Make sure the colors are sorted by index number (there may be a pull down menu that allows this). In PSP, the colors are indexed from the upper left (color 0 in the upper leftmost position and increasing in value to the right). In Photoshop, the positions are reversed. The color with value 0 is in the lower rightmost position and the index numbers increase to the right.

Because there is a direct one-to-one relationship between colors in the palette and individual shaders that make of the metashader, you should select clearly distinct colors to represent each shader. You should have one color for each layer you intend to include in the map (see keys above), which means one color to represent each root shader. You may find it convenient to create more, so they are available for later use (if you save the palette).

This method worked for me to make a 16-color palette in Paint Shop Pro. First, I reduced my palette size to 16 colors. I clicked on each palette position and created a color for it (don’t use black). Then, I increased my palette size back up to 256 colors, filling the rest with black. In Photoshop, it’s easier to select all the colors you don’t intend to use and make them black. Then, I save the palette out as a file for later use.

Another thing you might try is to make a grayscale palette, then use only the first few positions for your color and leave the rest for grayscale (this allows you to import bmp height maps and use them as guidelines).

Alphamap File Data

File type:

The alphamap is a BMP format file or a TGA file (see other file formats below). With BMP format, each color in your palette corresponds directly to a root shader used to create the smooth texture blends on the terrain.

File size:

The size of the alphamap should be one-to-one with the number of vertexes in the map. If you have 64 divisions x 32 divisions in your terrain mesh (65x33 vertexes), you should use a 65 by 33 alphamap. You can use an alphamap with a size that is not a one-to-one map with the number of map vertexes, but you can then expect a less precise interpretation of your texture assignments.

Colors linked to Shaders:

If an 8-bit texture is used (BMP), q3map links a color’s position on the palette to an identifying number in the name of a shader. The color in position 0 would reference a root shader named <metashadername>_0. The color in position 1 would reference a root shader named <metashadername>_1. <metashadername> refers to the value of the Shader key (see Key: Shader below). In theory, you could probably have 256 different root shaders assigned to the terrain entity. In practice, you’d probably want to bite your arm off at the elbow before doing something as complicated as that.

Other File Formats

It is possible to use a TGA file (a RGB color format) for an alphamap. TGA files are handled differently than indexed color files like BMP. Instead of looking for a position on the palette, q3map interprets the RGB value of actual color. With a 32-bit TGA file, only the color values in the red channel are used. The program assumes that a gray scale of equal values is being used. The program divides the colors by the number of levels into equal-sized ranges. When assigning textures, q3map looks at what range the color falls in and chooses the appropriate shader to place or blend.

Controlling Texture Blends

Each triangle on the mesh can only have two root shaders blending across it. Another way to say this is that there should be only two different colors on the three vertexes that form any given triangle in the mesh. Any more, and a sharp, unblended edge appears on the terrain surface. This can take some trial and error to correct. A bsp -switch command called -showseams can help the mapmaker find these errors. Create a new bsp command in your project file that includes this option. We recommend doing it with a novis only operation.

Figure 3

In figure 3, the blue and white image on the left is a scaled up (4X) version of the alphamap used on Distant Screams. It shows three different root shaders in use. Compare that to the gray scale height map on the right and you can see how the artist chose to assign textures to the various heights and depths of the map. As long as the guidelines for texture placement are followed, a mapmaker should be able to work with more different root shaders than shown here.

Alphamap Creation Tips:

·

The alphamaps for the team arena maps are included with this document, both as reference and as files that you can modify to work with your own maps. You may want to compare the alphamaps against the heightmaps for the same maps, just to see how id resolved mapping issues.

·

You can create a quick (though not necessarily good) alphamap by saving your height map as a new file. Then use the “posterize” filter that can be found in some art tools. Reduce the number of colors in the art to equal the layers (number of unique root shaders) in the terrain.

·

If you are creating a new alphamap from scratch, use colors that are easily distinguished from each other.

·

If you are making an alphamap for a team style map where both sides of the map are identical (mirrored or rotated), you only need to design the map for one side. Copy and position it as described above for the heightmap.

·

The id maps used simple color schemes that were homogenous throughout the maps. That is not the only way of doing things. It would be quite reasonable to use many more terrain textures (particularly if you weren’t going to build complicated, multi-texture architecture on top of them). Consider a map where one part of the terrain used red-themed textures and the other side blue themed textures. Have them blend into a few simple neutral colors near the map center.

·

Try doing terrain style texture mapping on non-terrain geometry. Results will definitely vary, but some could be interesting.

Samples:

The last height map and the alphamap used to create each of the terrain maps in Team Arena is included in the Mapping Support folder. Note that the designers made vertex manipulations to the final terrain meshes that are not reflected in these height maps. Also, the alphamaps are in PCX format, not BMP format.

Back - Table of Contents - The Terrain Texture

-16-