Generating and Modifying Haze Table Files

A .haz file is a 4096-byte (256*16) table of indexed color values ranging from 0–255. Each .haz file has an associated .pal file that defines the color of the index values. In a haze table, the first 256 colors are the fully saturated values of the colors. This "row" of colors are simply the index color values 0–255, matching the values in the .pal file. The second row in the table includes the colors as they would appear through a little bit of haze. The third row in the table includes the colors through even more haze; the "haze" becomes more pronounced as the rows increase in number. The sixteenth and final row of 256 indexed colors are solid gray, representing the colors as seen through a dense gray haze.

Before creating haze tables, you should know a few of the finer points of palette and haze file functionality and design:

For more information, refer to the topic Haze Files and the Haze Table, included in this SDK.

Important: The .haz file is simply a list of 256, 24-bit RGB colors. Any method you use to create this 768-byte file is valid, as long as the file contains the colors you want. When creating a .haz file, it really helps to have tools that enable you to display all 256-colors on the screen as a 16x16 matrix, graphically manipulate the colors, and dump the colors. You can use any one of a number of graphic design programs, such as Photoshop, to work with 24-bit colors. Most graphic design programs can take in a 768-byte RGB palette file as a 16x16 “picture." The example included in this topic shows how .haz files were created and manipulated in Flight Simulator; the procedure presented here is a good starting point for developing a procedure of your own.

To generate and modify .haz files, you'll need the following utilities:

The following example illustrates how to create a .haz file. Specifically, the example creates lasv.haz from lasv.pal. Las Vegas was chosen for the example because it includes night colors. You can use a simpler subset of the procedures outlined in this example if your palette file doesn't include night colors.

Note: Some of the procedures in the example use the Macintosh and some use the personal computer. If you know of equivalent tools on your platform of choice, you can use them.

Procedures on the personal computer Procedures on the Macintosh
  1. Use Photoshop to convert lasv.pal to lasv_dim.pal.
    Creates a new, "dim," palette; the file is in the same, .pal, format, but turns all bright (night) colors to black.
  1. Use Photoshop to convert lasv.pal to lasv_brt.pal.
    Creates a new "bright" palette; the file is in the same, .pal, format, but turns all dim (day) colors to black.
3    Use PAL2GIF to covert lasv.pal to lasv.gif.
4    Use Photoshop to convert lasv.gif to las vegas palette.
Save the color table in Photoshop format, so you can load it later.
5    Use PAL2HAZ to convert lasv.pal to lasv_200.hzz (gray level=200).
Creates a 24-bit true color haze table (.hzz) from lasv.pal. Use 200 as the gray level argument. You can use a higher (to 255) or lower (to 0) argument if you want to experiment with different gray fade levels.
6    Use Photoshop to convert lasv_200.hzz to lasv_200.tga.
Converts the .hzz true color image (load it raw as 256x16x3 channel) to a 24-bit targa (.tga) format image.
7    Use PAL2GIF to convert lasv_dim.pal to lasv_dim.gif.
8    Use TGLPLUS to convert lasv_dim.gif to lasv_dim.pcx.
9    Use PAL2GIF to convert lasv_brt.pal to lasv_brt.gif.
10   Use TGLPLUS to convert lasv_brt.gif to lasv_brt.pcx
11   Use RIX to set the palette of lasv_dim.pcx.
      Use RIX to map lasv_200.tga to pcx's palette, lasv_200.pcx.
12   Use TGLPLUS to convert lasv_200.pcx to lasv_200.gif.
13   Use Photoshop to convert lasv_200.gif to lasv.haz.
Dump the .hax file as raw 256x16x3 channel.
14   Use HAZEFIX to process lasv.haz to lasv.haz.

The following procedures make up the basis for more complex palette and haze table manipulation. The procedures assume the use of the graphics utilities mentioned earlier in this topic. The procedures included here also assume that you've followed the manipulation sequence outlined in the preceding table.

A .hzz file is a 4096-entry haze file represented in 24-bit RGB format. It is, essentially, a haze file represented in .pal (3-channel .raw) file format. You can load the .hzz file in Photoshop and manipulate it as a 24-bit RGB image. This is important for making haze tables and creating optimal palettes of limited indexed colors.

To create a .hzz File from a .pal file

To look at a .hzz file

  1. Copy the .hzz file to the same directory as Photoshop.

  2. In Photoshop, open the file.

  3. Check that the file has the following settings: Width=256, Height=16, Channels=3, Interleaved=X(Yes), Header=0, Ok.
    A 256x16 pixel rectangle is displayed; this is the haze table in RGB color mode.

  4. To see the haze table clearly, use the zoom feature.

To create the final indexed color haze table, you'll need to map the 24-bit RGB haze table to the final .pal file. To do this, you'll need a .tga file.

To save the RGB haze table as a .tga file

  1. On the File menu, click Save As.

  2. In the Save As dialog box, enter fs98haze.tga.

  3. Select TGA format, 24-bits/pixel, and then click OK.
    fs98haze.tga is created.

Once the RGB haze table is the way you want it, extract the closest-fit colors.

To extract the "N" closest-fit colors from an RGB haze table

  1. Select Mode, Indexed Color, and then set 8-bits per pixel (for 1-byte color) or set the number of colors to N.

  2. Click OK.
    The palette image is mapped to the "N" closest-fit colors.

  3. To see the map colors, select Mode, Color Table, and then click Edit Table.

Now that the color palette for the haze table exists, you can turn the color palette into a .pal file. Later, you can combine the N colors from the .pal file can with other colors to form a master .pal file that has the closest N colors that you have selected.

To create a .pal file from the N closest-fit colors

  1. On the File menu, click Save As.

  2. In the Save As dialog box, select Compuserve GIF Format (GIF) and 8-bits/pixel, and then click OK.
    Photoshop creates the file fs98hzz.gif.

  3. Move fs98hzz.gif to a personal computer and start the GIF2PAL utility.

  4. Using GIF2PAL, convert fs98hzz.gif to fs98hzz.pal.
    fs98hzz.pal is created.

To look at a .hzz file

  1. Copy the .haz file to same directory as Photoshop.
    Refer to the following procedures in the topic Generating and Modifying Palette Files:
    To extract a palette in .pcx format while running Flight Simulator
    To view the .pcx palette in the correct order
    To save a palette (in Photoshop format)


  2. In Photoshop, open the file.

  3. Check that the file has the following settings: Width=256, Height=16, Channels=1, , Header=0, and click OK.

  4. Apply the palette (that you saved) to the .hzz file.
    The haze table is displayed in indexed color mode on a 256x16 rectangular image and is ready to view and manipulate.

To modify a .haz file manually

  1. Look at the .haz file and make sure it's a valid .haz file.

  2. Use the Toolbox tools to manipulate the indexed color image and change colors (you can use any color in the palette, but never change the palette definition).
    You can make all 256 pixels any color you want; the colors are assigned as the 256 3-byte (24-bit) entries in the Flight Simulator palette. However, remember the bright color, night time fadeout, and program modified color rules.

  3. Save .haz file.
    fs98new.haz is created.

Once the final palette has been pieced together, you can map it to the fs98haze.tga file (the haze table in 24-bit RGB format) to create the final 4096-byte indexed color .haz file.

Creating the final .haz file using RIX

  1. Convert the .pal file to a .gif file (see procedure earlier in this topic).

  2. Convert the .gif file to a .pcx file (see the procedure earlier in this topic).

  3. Run RIX.

  4. On the Image menu, click Options.
    Make sure the following options are set: Xpal=Set, Large=On.

  5. Load the palette, with the options set as follows: Load, PCX-PCC, 16 or 256 color.

  6. On the Image menu, click Options.
    Make sure Xpal=On.

  7. On the File menu, click Load.
    Load fs98haze. RIX displays the haze table mapped to the 256-color palette.

  8. Save the file.
    RIX creates the .pcx file.

  9. Use TGLPLUS to convert .pcx image and palette to .gif image and palette.

  10. Load fs98haze1.gif into Photoshop.
    You now are looking at a 256x16 rectangular image in indexed color mode, a .haz file format image. You can manipulate the image if you want to modify the colors of some haze table entries. Never modify the palette.

  11. When you're done modifying the haze table, save the .haz file.

  12. On the personal computer, start HAZEFIX.
    You can use HAZEFIX to fine tune the haze file.