Level-safe Palette Conversions
By Matt H
I want to show you a procedure that can end all that a procedure that converts images into a form that is safe to use in all DF palettes and under all lighting conditions.
What you need: An image editing program that loads, saves, and edits palettes. (I usually use Photoshop, but I know this can work in Paint Shop Pro 3 as well.) You can also use these graphics:
Image using the secbase palette.
Image using a default, no-brite palette.
[Edit by japh: Matt H later posted this in the forums:]
The first image shows all the colors in the SECBASE palette - the most common palette used in the game. The second image shows which of those colors are 'default' - "The remaining colors are the colors that are consistent throughout all of the Dark Forces levels (and briefings.) If you make your image use just these colors, it will work in any level."
So, the colors that are the same in both are the 'default' colors. If you count, you will see that they are colors #32-207 and color #255 (with the first color being '0'). If you want their exact RGB values, take the time to look at the palette in an image editor.
(By the way, here's a little article I found that helps explains "anti-aliasing".) [Article]
Take a look at the second image. It shows the entire arrangement of this specialized palette. With the exception of the Color 0, all of the brite-mapped colors, the level-custom colors, and the special colors have been set to yellow. Color 0 has been set to bright purple. The remaining colors are the colors that are consistent throughout all of the Dark Forces levels (and briefings.) If you make your image use just these colors, it will work in any level.
The first bit of prep work you need to do is to go into your image editing program and load up these images. Find the colors/palettes section of the image editing program and save the palettes of each image (in Photoshop: Image, Mode, Color Table -> Save; in Paint Shop Pro 3: Colors, Save Palette.) You should probably save the palettes in the image editor's native format (in PS, it's .ACT; in PSP3, it's .PAL (JASC PAL)- notice this is not the same as DF's .PAL.)
Once that is done, you are ready to convert your images to be level-safe.
- Select what you want to be converted. If possible, include only the parts you want solid, do not include in your selection the parts you want transparent.
- Create a new document the size of what you copied.
- Select the color to be the bright purple of DEF-NOBR's Color 0 (RGB: 255, 0, 255). If that file is open, you can use the eyedropper tool.
- Fill the new document with that color purple.
- Paste your image into the new document.
- You now need to convert the image into an indexed color mode, using the default-nobrite palette.
- PS: Image, Mode, Indexed color -> Custom, Load [DEF-NOBR.ACT]
- PSP3: Colors, Load Palette [DEF-NOBR.PAL]
- Now you load the secbase palette into your image.
- PS: Image, Mode, Color Table -> Load [SEC-SML.ACT]
- PSP3: Colors, Load Palette [SEC-SML.PAL] - Make sure you check "Maintain indexes"
- Save your file as a .BMP/.PCX/.PICT file and it's ready to convert to DF!
Image using a default checking palette.
With this palette, all of the brite-mapped colors turn cyan, all the custom colors turn yellow, while the background turns purple. This way, I can check my images, and see if there are any potential problem areas and fix them.
|The guard on the left will have many problems: he will have gaps in his neck, hands, and helmet; if he's placed in a dark sector, parts of his pants will glow bright red; and if he's put in a palette other than secbase (or equivalent), parts of his helmet, face, and gloves may be discolored. The guard on the right, however, will look good in any environment.|
The colors here can of course be modified if you modify the palettes. You can also modify the technique so that brite-maps are included, but not the custom colors (or vice-verse.) You could even make something to convert to ONLY the brite mapped colors if you wanted.
The downside to all this is that your image could loose some of its depth, since it is using less colors. Therefore, this technique may not be for everyone, especially with custom textures. But for making general custom components, especially waxes and fmes, this can be extremely useful.
If you are fortunate enough to use Photoshop, I suggest you set this procedure to an Action, so you can quickly use it to convert your files.
One last thing: when you are converting your image into a Dark Forces format, if at all possible do a straight conversion - do not specify any palette to use. Your image has already got the correct color indexes, making palette conversion unnecessary. You also don't have control over how the ->DF program will convert the colors. So it could really screw things up.