Creating and converting textures for Quake 2




This document explains three things which are closely related: how to convert textures to the Quake 2 palette (with pcx or wal output format), how to create new Quake 2 textures using GIMP (and Wally) and the special case of making partly transparent Quake 2 textures.



1) How to convert a RGB texture to the Quake 2 palette in GIMP


Let's assume you have a skybox in tga format and want Quake 2 to use this skybox in both OpenGL and software mode. For the latter the tga images won't work but they most likely look better in OpenGL mode so I'd suggest to ship both the tga and the pcx files with your map. Yes, this means that you will ship 12 image files that are to be placed in baseq2/env/<yourmap>/. Let's now have a look at how to create the pcx files from the tga files.



Note: While this examples explains the process for a skybox texture (where the output file is a pcx file), the same technique can be used to convert normal tga or jpg texture sets for Quake 2. The only difference is that you will have to save them as an indexed tga file in GIMP first (instead of pcx) and batch convert them to the wal format using Wally then because GIMP does not support the wal format.



Quake 2 uses textures that have a fixed palette of 256 colors. This is known as Indexed Mode in most image manipulation programs. To properly convert a skybox texture you have as a jpg or tga file to Quake2 pcx format you will have to convert the file to Indexed Mode using the Quake 2 palette. Let's now have a look at how to do that in the great and free image manipulation software GIMP.

Two important thing first though:

1) All credits for this tutorial go to thehappyfriar who told me how to do it via PM at the Quake 2 Cafe. I just wrote this up, took some screenshots and put it here so people can find it.

2) If you are looking for information on how to convert regular (non-skybox) jpg or tga textures to Quake 2 format, this is not the right place because Quake 2 wants these textures in wal format (not in pcx format) and GIMP cannot write wal files. You can convert these textures using Wally though. The option File > Batch conversion of that tool is your friend. ;)



Step 1: Importing the Quake 2 palette into GIMP

You only need to do this once for your installation of GIMP.

The Quake 2 palette is saved in the file baseq2/pics/colormap.pcx of your Quake 2 installation. If you do not have this file in that location you will have to extract if from baseq2/pak0.pak with a tool like PakExplorer. If this is too annoying you can also grab the file here but PakScape is a great tool every mapper should have imo.

Now that you have the file it's time to import this palette into GIMP. Open GIMP and load the file colormap.pcx. Let's first make sure that you have the Palettes tab in your GIMP toolbox. If you do, your toolbox should look similar to this one:



If you don't have the tab, add it now by pressing the small arrow marked with a red circle in the image above and clicking Add Tab > Palettes. Now that you have that tab, switch to it and press the small arrow again but this time click Palettes Menu > Import Palette...:



In the new window under Select source click Image. You can give tha palette a better name, I named it Quake2 here:



Click Import and you're done.



Step 2: Converting an image to a pcx with the Quake 2 palette

Open your first RGB skybox image, e.g. baseq2/env/<yourmap>/greatsky_bk.tga, in GIMP. Now click Image > Mode > Indexed.... In the new window under Colormap select Use custom palette. Then click on the tiny palette preview image and chose the Quake2 palette your imported in step 1. Uncheck the option Remove unused colors from colormap and click Convert:



Save the image in pcx format and you're done.



One final note: you may get better results if your merge the 6 skybox files into a single large image first and convert that. Then split the new pcx image into 6 files again. I'm too lazy to do this tbh. Maybe I'd do it if I used software mode. :p





2) How to make Quake 2 wal textures with GIMP


Note: You cannot do the whole process of creating Quake 2 textures in GIMP because it doesn't support writing wal files. This in no problem though, you can still make the textures in GIMP, save them as tga files and later batch convert all of them to wal with a few clicks in Wally.



Since Quake 2 uses a fixed palette you'll have to import that palette into GIMP first. This is explained above. To create a new texture just click File > New... and set the width and height to power of 2 values, e.g. 128x128 or 32x64. Click Ok and convert the Image to Indexed Mode with the proper palette as explained above.

You will notice that some of the usual tools are not available or work differently. This is not a limitation of GIMP in most cases, it's a limitation of Indexed Mode. Some things like pressure sensitive color (if you're using a wacom) or gradients just don't make sense or look ugly in 256 color indexed mode. :(



Once you're done save the texture as an uncompressed Indexed Mode tga file with the Quake 2 palette. The default origin setting Bottom left is fine.



You can create as many texture as you want now. Once you're done convert them to wal format using Wally (see above for a download link). Install and start the tool, then open a single tga and select File > Export... or convert all files in a directory at once using File > Batch Conversion. Place the resulting wal files into Quake2/baseq2/textures/<yourmap>/ and you're done.





3) How to make partly transparent Quake 2 wal textures


Usually transparency is Quake 2 is controlled via Surface flags in the level editor. These flags (TRANS33 and TRANS66) can be applied to a face face of a brush (e.g. a window or water surface) and make the whole texture transparent to a certain degree. You cannot control which parts of a texture become transparent though with these flags (think of a plant leaf or a chain linked fence).



This tutorial explains how to get partial transparency done in Quake 2. If you already read the part on creating new Quake 2 textures this is extremely easy (if you don't know how to do that go read it now). Usually transparency is achieved by using an alpha channel that hold a transparency value for each pixel of the image but the resulting 32bit tga files are not supported by Wally and Quake 2. Instead there is a certain color of the Quake 2 palette that is not drawn by Quake 2 in-game, making it tranparent. This color is the last color of the Quake 2 palette (index 255 if you're programs starts counting at 0 like GIMP does, 256 if it starts at 1). The color code of this color is 159,91,83 RGB and 9f5b53 HTML. Simply paint all the parts you want to be transparent with this color. An example texture I made is available in both tga and wal format.



The surface you apply the texture to still has to carry the TRANS33 and/or TRANS66 flags in the editor though it seems. :|



To make a plant you may also want to save a small texture that is totally transparent for faces that should not be visible in-game. You can use this one. I made the plants in spirit2dm7 by using two very thin brushes (1 quake unit) with the TRANS66 and MIST flags set. Each brush has 2 faces with the partly transparent plant texture and 4 faces with the trans.wal texture. It looks like this in Radiant:





And like this in Quake 2:





That's it. Enjoy.