Generating and Modifying Palette Files

This topic includes the tools that you'll need and the procedures you'll need to follow to generate and modify palette files.

Important: The palette file, as described in the Palette Files and Palette Control topics, 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 palette 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 palette files were created and manipulated in earlier versions of Flight Simulator; the procedure presented here is a good starting point for developing a procedure of your own.

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

The procedures outlined in this topic use the preceding utility programs to examine and modify palettes. These procedures make up the basis for more complex palette and haze table manipulation.

To look at a .pal file

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

  2. Open the file.

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

  4. To see the palette clearly, use the zoom feature.

After taking a look at the file in RGB mode, you can save it in .pal file format.

To save the RGB image as a .pal file

  1. When you've created the palette you want in RGB, 24-bit color mode on a 16x16 pixel image, on the File menu, click Save As.

  2. In the Save As dialog box, select the following settings: Raw, yourfilename.pal, Type=filetype, Creator=yourname, Header=0, Interleaved Order=Ok, and then click Save.
    yourfilename.pal is created.

You can extract the current 256-color palette while running Flight Simulator. By doing this, you can see all the colors that are in effect, including the low 116 colors, the 64 texture colors, the panel colors, and so on.

To extract a palette in .pcx format while running Flight Simulator

  1. Start Flight Simulator, and then get into the situation from which you want to extract the palette.

  2. In succession, press ALT+V (Views), F (Flight Photograph), and F (Edit Filename).

  3. In the "photo_1" box, enter yourfilename.pcx, and then click OK.

  4. Wait until the photo process is finished (it takes approximately 10 seconds), and then exit Flight Simulator.
    In the Flight Simulator directory, there is now a file called photo_1.pcx. This file is an image of the screen, as well as a copy of the palette in .pcx format.

If you just want to take a quick look at the Flight Simulator palette layout, you can view the .pcx palette (in reverse).

To view the .pcx palette (in reverse)

If you just want to take a quick look at the FS5 palette layout, do the following:

  1. Copy photo_1.pcx to your Photoshop directory.

  2. Start Photoshop.

  3. On the File menu, click Acquire.

  4. In the dialog box, select PCX read, select photo_1.pcx, and then click Open.
    The file photo_1.pcx is displayed.

  5. Select Mode, Color Table, and then click Edit Table.
    Now you can view and edit the color palette. However, the color palette is in reverse order; that is, the lower-right color is color 0 and the upper-left color is color 255.

To view the .pcx palette in the correct order

  1. Convert a .pcx image and palette to a .gif image and palette. (For example, convert  photo_1.pcx to photo_1.gif.)

  2. Copy the file photo_1.gif to your Photoshop directory.

  3. Start Photoshop.

  4. On the File menu, click Open As.

  5. In the Open As dialog box under File Format, select GIF. Then, select photo_1.gif, and click Open.
    The file photo_1.pcx is displayed.

  6. Select Mode, Color Table, and then click Edit Table.
    Now you can view and edit the color palette. The upper-left color is color 0, and the lower-right color is color 255.

To view a .gif palette

  1. Start Photoshop.

  2. On the File menu, click Open As.

  3. In the Open As dialog box under File Format, select GIF, and then load the file.

  4. Select Mode, Color Table, and then click Edit Table.
    Now you can view and edit the color palette. The upper-left color is color 0, and the lower-right color is color 255.

Sometimes, you need to work with a file in .gif (as opposed to .pcx) format; the following procedure converts the file photo_1.pcx to photo_1.gif.

To convert a .pcx image and palette to a .gif image and palette

  1. Start TGLPLUS.exe

  2. Select Alter Source/Target Directories and set the source directory and target directory to the location of photo_1.pcx, and then press F10.

  3. Select Convert Between File Formats.

  4. In the Source File Type box, select Zsoft File Format (PCC or PCX), and then press ENTER.

  5. In the Target File Type box, select Compuserve GIF Format (GIF), and then press ENTER.
    The dialog box Choose Files To Convert displays a list of one or more .pcx files.

  6. In the list, choose photo_1.pcx, and then press T to tag the file. Press F10 to convert the file to .gif format.

  7. Press F10, and then E to quit TGLPLUS.exe.
    The file PHOTO_1.GIF is now available in your Flight Simulator directory.

To convert a .gif image and palette to a .pcx image and palette

Some utilities that you might want to use to manipulate palette and haze files only work with files in .gif format. A .pal file can be converted to a .gif file that consists of a "dummy" 2x2 pixel image and the 256-color palette, in .gif file format.

To convert a .PAL file to a .GIF file

The following procedure takes the palette from a .gif file and creates a .pal file. The .gif image itself is not used; only the palette (from the image) is used to create the .pal file.

To convert a .gif File to a .pal file

To save a palette (in Photoshop format)

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

  2. View the .pcx palette (forward), as shown in a procedure earlier in this topic.

  3. Select Mode, Color Table, and then click Edit Table.

  4. In the Edit Table dialog box, click Save. Name the palette file PH_1_PAL.
    You can apply the PH_1_PAL palette file to raw binary images (such as .r8 texture files).

An image consisting of indexed color pixels (for example, an .r8 texture file) can have palette color corresponding to the index values applied to it, simply by applying the palette to the image. The following procedure assumes that you have an image loaded in Photoshop and that Photoshop is in indexed color mode.

To apply a palette to an image

  1. On the Mode menu, click Indexed Color.

  2. Click Edit Table, and then click Load to load the ph_1_pal file (or any other palette file). Open ph_1_pal.

You can create a new .pal file by modifying an old one. Use Photoshop to manipulate .pal files as described in the following procedure.

To create or modify a .pal file manually

  1. Look at the .pal file (see palette manipulation procedure earlier in this topic).
    Note: Photoshop interprets this as a 16x16 image in 3-byte (24-bit) RGB mode, not as a palette.

  2. Use the Toolbox tools to manipulate the image. 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.

  3. Save RGB .pal file (see palette manipulation procedure earlier in this topic).

To extract the best-fit 64-colors from a texture using Photoshop

  1. Display the texture in RGB true color mode.

  2. Select Indexed Color, and then choose 64 for the number of colors to map to.

  3. Select Mode, Color Table, and then click Edit Table.

  4. Click Save. In the Save dialog box, create a file called "temp color."

  5. Load any .haz file as raw, 16 x 256 (the first 256 values are 1,2,3,4,5...255).

  6. Select Indexed Color.

  7. Select Mode, Color Table, and then click Edit Table.

  8. Click Load, and open the "temp color" file you created.

  9. Zoom in on the first 256 entries (the first 16 rows).

  10. Switch to RGB true color mode

  11. The first 64 items are the palette colors that you can now cut and paste into other palettes.

You can use Photoshop to open many design files at once. Use Photoshop to create a composite palette from pieces of other palettes.

Combining palette components into one palette

  1. Look at the .pal files you want to work with visually (see palette manipulation procedure earlier in this topic).

  2. Using one of the .pal files as the design for your final palette, erase (turn to black) all unused entries.

  3. Cut and paste sections of the other palettes into the final design palette.

  4. When the design palette is the combination of colors that you want, save it as an RGB .pal file (see palette manipulation procedure earlier in this topic).