gtkradiant/docs/manual/quake3/Terrain_Manual/pages/creating_the_alphamap.html

195 lines
11 KiB
HTML
Raw Normal View History

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Creating the Alphamap</title>
</head>
<body background="../pics/background.jpg" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<b>
<p align="center"><font size="5">Creating the Alphamap</font></p>
<div align="right">
<table border="1" cellspacing="1" width="100%" bordercolor="#808080" bgcolor="#000000" cellpadding="10">
<tr>
<td width="100%"><font FACE="Times New Roman">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Simply put, the alpha map is the template that the compiler uses to assign
textures to the terrain surface.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
<p>&nbsp;</p>
</font><b><font SIZE="4">
<p>Terms</p>
</font></b><font FACE="Times New Roman">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; First, you need to understand a couple vocabulary words <20> jargon, if you
will:</p>
<b>
<p>Indexed Color:</b> 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.</p>
<b>
<p>Color Table:</b> This is what Photoshop calls the indexed color layout of 256
colors. In Paint Shop Pro it<69>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.</p>
<b>
<p>Palette:</b> This is what Paint Shop Pro calls a Color Table.</p>
<p>&nbsp;</p>
</font><b><font SIZE="4">
<p>Making the Palette</p>
</font></b><font FACE="Times New Roman">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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).</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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<6F>t use black). Then, I increased my
palette size back up to 256 colors, filling the rest with black. In Photoshop,
it<EFBFBD>s easier to select all the colors you don<6F>t intend to use and make them
black. Then, I save the palette out as a file for later use.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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).</p>
<p>&nbsp;</p>
</font><b><font SIZE="4">
<p>Alphamap File Data</p>
</font></b><font FACE="Times New Roman"><b>
<p>File type:</b> 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.</p>
<b>
<p>File size:</b> 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.</p>
<b>
<p>Colors linked to Shaders:</b> If an 8-bit texture is used (BMP), q3map links
a color<6F>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 &lt;metashadername&gt;_0.
The color in position 1 would reference a root shader named &lt;metashadername&gt;_1.
&lt;metashadername&gt; 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<6F>d probably want to bite your arm off
at the elbow before doing something as complicated as that.</p>
</font><b><font SIZE="4">
<p>Other File Formats</p>
</font></b><font FACE="Times New Roman">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
</font><b><font SIZE="4">
<p>Controlling Texture Blends</p>
</font></b><font FACE="Times New Roman">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
</font><font FACE="Times New Roman" SIZE="2">
<p align="center"><img SRC="Image5.gif" WIDTH="266" HEIGHT="352">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img SRC="Image6.gif" WIDTH="264" HEIGHT="352"></p>
</font><font FACE="Times New Roman">
<p>Figure 3</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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.</p>
</font><b><font SIZE="4">
<p>Alphamap Creation Tips:</p>
<blockquote>
<blockquote>
</font></b><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">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.</p>
</font><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">You can create a quick (though not
necessarily good) alphamap by saving your height map as a new file. Then use the
<EFBFBD>posterize<EFBFBD> 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.</p>
</font><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">If you are creating a new alphamap
from scratch, use colors that are easily distinguished from each other.</p>
</font><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">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.</p>
</font><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">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<65>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.</p>
</font><font FACE="Symbol" SIZE="2">
<p><EFBFBD> </font><font FACE="Times New Roman">Try doing terrain style texture
mapping on non-terrain geometry. Results will definitely vary, but some could be
interesting.</p>
</blockquote>
</blockquote>
<b>
<p>Samples:</b> 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.</p>
</font>
<p align="center"><a href="entity_keys_and_values.html">Back</a> - <a href="table_of_contents.html">Table
of Contents</a> - <a href="terrain_texture.html">The Terrain Texture</a></p>
<p>&nbsp;</td>
</tr>
</table>
</div>
</b>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">-16-</p>
</body>
</html>