]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - docs/manual/quake3/Terrain_Manual/pages/creating_the_alphamap.html
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / docs / manual / quake3 / Terrain_Manual / pages / creating_the_alphamap.html
1 <html>\r
2 \r
3 <head>\r
4 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">\r
5 <meta name="GENERATOR" content="Microsoft FrontPage 4.0">\r
6 <meta name="ProgId" content="FrontPage.Editor.Document">\r
7 <title>Creating the Alphamap</title>\r
8 </head>\r
9 \r
10 <body background="../pics/background.jpg" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">\r
11 \r
12 <b>\r
13 <p align="center"><font size="5">Creating the Alphamap</font></p>\r
14 <div align="right">\r
15   <table border="1" cellspacing="1" width="100%" bordercolor="#808080" bgcolor="#000000" cellpadding="10">\r
16     <tr>\r
17       <td width="100%"><font FACE="Times New Roman">\r
18 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The alphamap referenced by the alphamap key/value pair is an art file created\r
19 specifically for the map. For non-digital artists, it may be one of the more\r
20 technically and conceptually challenging things that need to be created to make\r
21 the terrain map work.</p>\r
22 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Simply put, the alpha map is the template that the compiler uses to assign\r
23 textures to the terrain surface.</p>\r
24 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To make the alphamap, you must have, or have access to, an art program that\r
25 can save a file as an 8-bit BMP file with indexed color. I\92ll discuss other\r
26 file types later on, but the BMP file is probably the simplest solution, both\r
27 technically and conceptually.</p>\r
28 <p>&nbsp;</p>\r
29 </font><b><font SIZE="4">\r
30 <p>Terms</p>\r
31 </font></b><font FACE="Times New Roman">\r
32 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; First, you need to understand a couple vocabulary words \85 jargon, if you\r
33 will:</p>\r
34 <b>\r
35 <p>Indexed Color:</b> In essence, each color used in a piece of art is\r
36 remembered by its location on the color table or palette (see below). There are\r
37 256 colors available, numbered from 0 to 255. Each position on the palette has\r
38 its own number. This number has nothing to do with the RGB values of a color in\r
39 that position. If you change the actual color located at a particular location\r
40 on the palette (say from red to blue), all the pixels that were formerly that\r
41 shade of red (if painted using a color with that index number), will change to\r
42 the new color of blue.</p>\r
43 <b>\r
44 <p>Color Table:</b> This is what Photoshop calls the indexed color layout of 256\r
45 colors. In Paint Shop Pro it\92s a palette. This is a pop-up window that shows\r
46 the colors in the palette and their arrangement. For making an alphamap for a\r
47 terrain map, the colors you choose are not important, but their position on the\r
48 palette is.</p>\r
49 <b>\r
50 <p>Palette:</b> This is what Paint Shop Pro calls a Color Table.</p>\r
51 <p>&nbsp;</p>\r
52 </font><b><font SIZE="4">\r
53 <p>Making the Palette</p>\r
54 </font></b><font FACE="Times New Roman">\r
55 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The best way to start is to make a set of colors to use when painting\r
56 alphamaps. If you want, you can do this once and save it out. In PSP edit the\r
57 palette (in Photoshop, open the Color Table). Make sure the colors are sorted by\r
58 index number (there may be a pull down menu that allows this). In PSP, the\r
59 colors are indexed from the upper left (color 0 in the upper leftmost position\r
60 and increasing in value to the right). In Photoshop, the positions are reversed.\r
61 The color with value 0 is in the lower rightmost position and the index numbers\r
62 increase to the right.</p>\r
63 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Because there is a direct one-to-one relationship between colors in the\r
64 palette and individual shaders that make of the metashader, you should select\r
65 clearly distinct colors to represent each shader. You should have one color for\r
66 each layer you intend to include in the map (see keys above), which means one\r
67 color to represent each root shader. You may find it convenient to create more,\r
68 so they are available for later use (if you save the palette).</p>\r
69 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This method worked for me to make a 16-color palette in Paint Shop Pro.\r
70 First, I reduced my palette size to 16 colors. I clicked on each palette\r
71 position and created a color for it (don\92t use black). Then, I increased my\r
72 palette size back up to 256 colors, filling the rest with black. In Photoshop,\r
73 it\92s easier to select all the colors you don\92t intend to use and make them\r
74 black. Then, I save the palette out as a file for later use.</p>\r
75 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Another thing you might try is to make a grayscale palette, then use only the\r
76 first few positions for your color and leave the rest for grayscale (this allows\r
77 you to import bmp height maps and use them as guidelines).</p>\r
78 <p>&nbsp;</p>\r
79 </font><b><font SIZE="4">\r
80 <p>Alphamap File Data</p>\r
81 </font></b><font FACE="Times New Roman"><b>\r
82 <p>File type:</b> The alphamap is a BMP format file or a TGA file (see other\r
83 file formats below). With BMP format, each color in your palette corresponds\r
84 directly to a root shader used to create the smooth texture blends on the\r
85 terrain.</p>\r
86 <b>\r
87 <p>File size:</b> The size of the alphamap should be one-to-one with the number\r
88 of vertexes in the map. If you have 64 divisions x 32 divisions in your terrain\r
89 mesh (65x33 vertexes), you should use a 65 by 33 alphamap. You can use an\r
90 alphamap with a size that is not a one-to-one map with the number of map\r
91 vertexes, but you can then expect a less precise interpretation of your texture\r
92 assignments.</p>\r
93 <b>\r
94 <p>Colors linked to Shaders:</b> If an 8-bit texture is used (BMP), q3map links\r
95 a color\92s position on the palette to an identifying number in the name of a\r
96 shader. The color in position 0 would reference a root shader named &lt;metashadername&gt;_0.\r
97 The color in position 1 would reference a root shader named &lt;metashadername&gt;_1.\r
98 &lt;metashadername&gt; refers to the value of the Shader key (see Key: Shader\r
99 below). In theory, you could probably have 256 different root shaders assigned\r
100 to the terrain entity. In practice, you\92d probably want to bite your arm off\r
101 at the elbow before doing something as complicated as that.</p>\r
102 </font><b><font SIZE="4">\r
103 <p>Other File Formats</p>\r
104 </font></b><font FACE="Times New Roman">\r
105 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It is possible to use a TGA file (a RGB color format) for an\r
106 alphamap. TGA\r
107 files are handled differently than indexed color files like BMP. Instead of\r
108 looking for a position on the palette, q3map interprets the RGB value of actual\r
109 color. With a 32-bit TGA file, only the color values in the red channel are\r
110 used. The program assumes that a gray scale of equal values is being used. The\r
111 program divides the colors by the number of levels into equal-sized ranges. When\r
112 assigning textures, q3map looks at what range the color falls in and chooses the\r
113 appropriate shader to place or blend.</p>\r
114 </font><b><font SIZE="4">\r
115 <p>Controlling Texture Blends</p>\r
116 </font></b><font FACE="Times New Roman">\r
117 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Each triangle on the mesh can only have two root shaders blending across it.\r
118 Another way to say this is that there should be only two different colors on the\r
119 three vertexes that form any given triangle in the mesh. Any more, and a sharp,\r
120 unblended edge appears on the terrain surface. This can take some trial and\r
121 error to correct. A bsp -switch command called -showseams can help the mapmaker\r
122 find these errors. Create a new bsp command in your project file that includes\r
123 this option. We recommend doing it with a novis only operation.</p>\r
124 </font><font FACE="Times New Roman" SIZE="2">\r
125 <p align="center"><img SRC="Image5.gif" WIDTH="266" HEIGHT="352">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r
126 <img SRC="Image6.gif" WIDTH="264" HEIGHT="352"></p>\r
127 </font><font FACE="Times New Roman">\r
128 <p>Figure 3</p>\r
129 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In figure 3, the blue and white image on the left is a scaled up (4X) version\r
130 of the alphamap used on Distant Screams. It shows three different root shaders\r
131 in use. Compare that to the gray scale height map on the right and you can see\r
132 how the artist chose to assign textures to the various heights and depths of the\r
133 map. As long as the guidelines for texture placement are followed, a mapmaker\r
134 should be able to work with more different root shaders than shown here.</p>\r
135 </font><b><font SIZE="4">\r
136 <p>Alphamap Creation Tips:</p>\r
137 <blockquote>\r
138   <blockquote>\r
139   </font></b><font FACE="Symbol" SIZE="2">\r
140 <p>· </font><font FACE="Times New Roman">The alphamaps for the team arena maps\r
141 are included with this document, both as reference and as files that you can\r
142 modify to work with your own maps. You may want to compare the alphamaps against\r
143 the heightmaps for the same maps, just to see how id resolved mapping issues.</p>\r
144 </font><font FACE="Symbol" SIZE="2">\r
145 <p>· </font><font FACE="Times New Roman">You can create a quick (though not\r
146 necessarily good) alphamap by saving your height map as a new file. Then use the\r
147 \93posterize\94 filter that can be found in some art tools. Reduce the number of\r
148 colors in the art to equal the layers (number of unique root shaders) in the\r
149 terrain.</p>\r
150 </font><font FACE="Symbol" SIZE="2">\r
151 <p>· </font><font FACE="Times New Roman">If you are creating a new alphamap\r
152 from scratch, use colors that are easily distinguished from each other.</p>\r
153 </font><font FACE="Symbol" SIZE="2">\r
154 <p>· </font><font FACE="Times New Roman">If you are making an alphamap for a\r
155 team style map where both sides of the map are identical (mirrored or rotated),\r
156 you only need to design the map for one side. Copy and position it as described\r
157 above for the heightmap.</p>\r
158 </font><font FACE="Symbol" SIZE="2">\r
159 <p>· </font><font FACE="Times New Roman">The id maps used simple color schemes\r
160 that were homogenous throughout the maps. That is not the only way of doing\r
161 things. It would be quite reasonable to use many more terrain textures\r
162 (particularly if you weren\92t going to build complicated, multi-texture\r
163 architecture on top of them). Consider a map where one part of the terrain used\r
164 red-themed textures and the other side blue themed textures. Have them blend\r
165 into a few simple neutral colors near the map center.</p>\r
166 </font><font FACE="Symbol" SIZE="2">\r
167 <p>· </font><font FACE="Times New Roman">Try doing terrain style texture\r
168 mapping on non-terrain geometry. Results will definitely vary, but some could be\r
169 interesting.</p>\r
170 </blockquote>\r
171 </blockquote>\r
172 <b>\r
173 <p>Samples:</b> The last height map and the alphamap used to create each of the\r
174 terrain maps in Team Arena is included in the Mapping Support folder. Note that\r
175 the designers made vertex manipulations to the final terrain meshes that are not\r
176 reflected in these height maps. Also, the alphamaps are in PCX format, not BMP\r
177 format.</p>\r
178 </font>\r
179 \r
180 <p align="center"><a href="entity_keys_and_values.html">Back</a> - <a href="table_of_contents.html">Table\r
181 of Contents</a> - <a href="terrain_texture.html">The Terrain Texture</a></p>\r
182 \r
183 <p>&nbsp;</td>\r
184 </tr>\r
185 </table>\r
186 </div>\r
187 </b>\r
188 <p align="center">&nbsp;</p>\r
189 <p align="center">&nbsp;</p>\r
190 <p align="center">-16-</p>\r
191 \r
192 </body>\r
193 \r
194 </html>\r