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:
-
To successfully work with .haz file, you must have a complete understanding of .pal files and the color ranges in Flight Simulator. It's important to remember that colors 0–115 and the top 64 texture colors fade in intensity during night and dusk operation, while the bright colors and the "frozen colors" at the top of the 64 texture colors don't fade.
-
A haze file must haze the lower 116 colors (primary color runs plus water).
-
A haze file must haze the bright colors and the sky and ground color runs.
-
If the haze table is associated with the .pal file of a set of textures, the top 64 colors (the texture-specific colors) must be hazed.
-
Whenever a .pal file's texture palette values (top 64 colors) are loaded using the BGL PALETTE command, the .haz file of the same name is loaded.
-
If no .pal file is included in any of the currently running scenery, fs98.pal is loaded, as well as fs98.haz. The fs98.pal file is designed with the assumption that no texture (or anything else) is going to use the top 64 colors, so these colors are set to optimum values.
-
Don't mix night time dim colors (bottom 116 plus the nonfrozen colors in the top 64 texture colors). That is, colors used in the haze table for a dim color (a color that darkens at night) should also be dim colors so that as night falls, the entire section of the haze table associated with the dim colors darkens. If bright colors are mixed into the haze table area designated for dim colors, bright areas will show up at a distance (at night while in haze). Conversely, don't mix dim colors in the haze table area designated for bright colors.
Note: Frozen colors are bright colors that you've specified as "frozen" using the FIXED_COLORS command.
-
Haze tables should be designed keeping the following in mind: what shade of gray should colors fade to, how fast should colors fade to this gray level, and how fast should color saturation be reduced to gray shade? In most cases, reducing color saturation quickly, and then going to a fine-gray gradient gives the best results.
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:
-
Photoshop (Macintosh version)—Use Photoshop to view, modify, and manipulate palettes. The examples included in this topic assume use of the Macintosh version of Photoshop.
-
TGLPLUS (personal computer version)—Use this utility to translate file formats from .pcx to .gif.
-
PAL2HAZE (personal computer version)—Use this utility to create 24-bit RGB haze files from .pal files.
-
GIF2PAL (personal computer version)—Use this to extract a 24-bit RGB .pal file from a .gif file.
-
PAL2GIF (personal computer version)—Use this to create a 2x2 pixel .gif file from a .pal file.
-
COLORIX RIX (personal computer version)—Use this utility to map colors. Given a .gif 256-color palette, RIX maps a .tga 24-bit colors into the 256 available colors.
-
HAZEFIX (personal computer version)—Use this utility on .haz files; it "cleans up" bright colors and sky colors, and creates the first row of the haze table as indexes 1, 2, 3,…,255.
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 |
|
-
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.
|
|
-
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
-
Run PAL2HAZE as follows:
PAL2HAZE fs98.pal fs98.hzz 115
(Where fs98.pal is the input file, fs98.hzz is the output file, and 115 is the gray level (range can be 0 [black] to 255 [white]).
PAL2HAZE creates the specified output file, fs98.hzz.
To look at a .hzz file
-
Copy the .hzz file to the same directory as Photoshop.
-
In Photoshop, open the file.
-
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.
-
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
-
On the File menu, click Save As.
-
In the Save As dialog box, enter fs98haze.tga.
-
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
-
Select Mode, Indexed Color, and then set 8-bits per pixel (for 1-byte color) or set the number of colors to N.
-
Click OK.
The palette image is mapped to the "N" closest-fit colors.
-
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
-
On the File menu, click Save As.
-
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.
-
Move fs98hzz.gif to a personal computer and start the GIF2PAL utility.
-
Using GIF2PAL, convert fs98hzz.gif to fs98hzz.pal.
fs98hzz.pal is created.
To look at a .hzz file
-
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)
-
In Photoshop, open the file.
-
Check that the file has the following settings: Width=256, Height=16, Channels=1, , Header=0, and click OK.
-
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
-
Look at the .haz file and make sure it's a valid .haz file.
-
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.
-
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
-
Convert the .pal file to a .gif file (see procedure earlier in this topic).
-
Convert the .gif file to a .pcx file (see the procedure earlier in this topic).
-
Run RIX.
-
On the Image menu, click Options.
Make sure the following options are set: Xpal=Set, Large=On.
-
Load the palette, with the options set as follows: Load, PCX-PCC, 16 or 256 color.
-
On the Image menu, click Options.
Make sure Xpal=On.
-
On the File menu, click Load.
Load fs98haze. RIX displays the haze table mapped to the 256-color palette.
-
Save the file.
RIX creates the .pcx file.
-
Use TGLPLUS to convert .pcx image and palette to .gif image and palette.
-
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.
-
When you're done modifying the haze table, save the .haz file.
-
On the personal computer, start HAZEFIX.
You can use HAZEFIX to fine tune the haze file.