by P.Mok
Many of you have asked how I created the new aircraft textures in my LIBs, particularly the Blue Angel F-18 and Thunderbirds F-16 in Project: BLUE. Though I gave a brief description of the process in the BLUE documentation, enough of you have asked about more details that I will save myself some time in the future by putting all of my thoughts in one place where everyone can see them. You may want to copy and print this out and follow the tutorial to duplicate my steps and learn the basics. Here goes...
The first thing I should mention is that not everything is possible. People will want the world, and I can't give it to them. That zany idea you have of painting the F-22 Raptor completely purple, may not necessarily be possible. Let me explain why. I'll use the F22 as an example.
Each aircraft in the game consists of three main components. The first is the PT file (F22.PT), which you may be familiar with if you use the DuoSoft Toolkits. The PT file controls the name of the plane, and many of the characteristics of the plane in the game: flight performance, weapon hardpoints, damage points, etc. It also specifies what shape file is to be used in the game to represent the plane. This is the easiest of the 3 components to edit using the Toolkit.
The second component is the shape file. Actually the shape of each plane in the game is defined by several shape files, but the main one (F22.SH) is the one we are most concerned with. The others (F22_A.SH, F22_B.SH, F22_C.SH) are used as shapes to represent the aircraft when it is destroyed, or to represent the plane's shadow on the ground (F22_S.SH). Incidentally, Spike has noted that the destroyed shapes are referenced in the shadow shape, but not in the main shape. That means you can copy just the main shape and not bother with the shadow/destroyed shapes (you would just use the old shadow/destroyed shapes already in the game--see the next tip for more info) if you don't mind the plane reverting to its original form when destroyed. Anyways think of the main shape as a skeleton for the aircraft. The textures are applied on top of the shape/skeleton, which is why I like to think of the textures as "skin" for the plane. Within the shape file is a reference to the texture file which is to be applied to that particular shape. So if you were to view the contents of the F22.SH file with a hex editor, you would find a reference to the file "_F22.PIC". Shape files are most difficult to manipulate with the Toolkit because you cannot directly edit the files. With the ATF TK 1.2 or the ATF Gold TK, you can only view/copy shapes. In the FA TK you can copy shapes, but it will require a little extra work. So most of the manipulations must be done in hex editors. But the important thing to know is that shapes are largely un-editable. You can change the texture references within the file, but you cannot edit the actual shape's appearance -- you are basically stuck with the way the shape looks, and its color. When you view a plane in the F10 view, you can see that if you hold down the "-" key and Zoom Out far enough, the texture of a plane is no longer applied (to conserve CPU usage) and you will see the underlying shape only. The F-22 shape is mostly shades of dark grey. So a desert sand-colored version of the F-22 is not going to work very well, as you will see.
The third component is the texture file. _F22.PIC is the texture file which we would want to edit if we want to change the F-22's exterior appearance. As I said before, the texture is like a skin that covers the shape. However, as a little experimentation with the file will show, the skin does not cover the entire shape. This is a quirk of the game design. Some of the more detailed aircraft have textures which cover almost the entire shape, like the F-4J or the A-4E. But most of the planes, like the F-22, F-18, F-14, etc. are only partially covered, and the game designers decided to use less textures and let the shape provide most of the color. Like a plastic airplane model, most of the surface area you see is the underlying shape, with a few decals (textures) applied here and there. This is much more convenient than painting the whole airplane, but for our purposes it means the F-22 will always be basically grey. You could try painting the textures light brown to make a Desert Raptor, but here's what will happen. Parts of the plane covered by the texture will be brown, but those parts which are not covered will be grey. If you try this, you will see it makes for a very unusual looking plane, not very good looking in my opinion. A large portion of each wing in particular remains grey and cannot be changed by painting the texture. You may have noticed the same problem with my BLUE libs, where the shapes are not covered by the texture the plane is still grey instead of blue/yellow or white as it should have been. This is an unavoidable consequence of the shape/texture system used in the game. To fix it would require the ability to change shape colors, but at this point it is not possible.
All that being said, let's suppose you have found a plane which uses a shape and texture that still looks good when you've modified the texture. For example, for my DELTA LIB I've been working on a new Desert F-16C that will use the same shape as the already existing Desert F-16A (F16E.PT). No problem doing that in the PT files, just rename the F16E.PT to F16CE.PT and beef up the hardpoints, etc. But now I want to modify the texture, because I think the Desert Camo texture on the F-16A is too dark. Now we finally dive into the subject of texture editing itself.
Before I talk about painting and transparency, let me put in a little plug for the graphic/paint program I use, Paint Shop Pro (download it at http://www.jasc.com). It integrates beautifully with the DuoSoft Toolkits, and it's a hell of a lot better than Windows Paint. Install PSP, then just go to Prefs and change the paint program to PSP.EXE instead of PAINT.EXE. Most importantly, it allows for palette editing and saving. I'm sure there are other great paint programs that will work just as well, but all of my steps will be based on using PSP.
Ok, so in the Toolkit create a new project, call it something like TEXTURE or TEST. Go to Graphics, select Textures, and scroll down until you find the file _F16E.PIC and select it. The texture will be displayed in a window along with a dialog box with various little buttons. The one you want is the button with a palette on it, marked Paint. Click on it and the Toolkit will convert the texture to BMP format and then open the texture file with your paint program.
Now, before we start dumping paint everywhere, something needs explanation. Like I mentioned before, many of the textures are merely to provide a little detail to the shape, like the cockpit windows, landing gear, etc. If you look at the texture, you will see that it is a 256 color graphic file, and most of the texture file is white (RGB: 252 252 252), index #255 on the color palette. This color, or more precisely, the index number, is important because it is the transparent color used in the game. Anything in the texture colored with index #255 will be transparent. Here's a little trick I developed so that I don't confuse index #255 with the visible white colors on a texture. First save the color palette, from the Colors Menu in PSP, I just call it something simple like "Palette.PAL". Click on the Colors Menu again and choose Edit palette. Now select the very last color at the bottom right of the palette, which is #255. Change the color of #255 to bright green (RGB: 0 255 0). I use this color because it is one not used in the palette already, and is very distinct from the rest of the colors in the texture. Click OK and you'll see the texture's white areas change to green. This indicates very clearly now all the areas which are transparent on the texture. Note that the areas of the texture which are white as opposed to transparent (particularly note the landing gear and pilot's helmet) will remain white. Now go to the Colors menu again and save the palette, naming it something like "Working Palette.PAL". This way the next time you edit a texture, you can simply load the Working Palette (make sure you select "maintain indexes" instead of "nearest color matching" or it won't work properly) and go to work.
Ok, now that we can see clearly what areas are transparent, we can begin working on the texture. Texture editing has very few hard and fast rules, a lot of it is based on trial and error. You paint something, you save it and build a lib, then you play the game to see if it looks OK, then go back and make changes, and so on. This is because the texture file for each type of plane is often unique. The F-22 texture is laid out differently from the F-16 texture, etc. You need to look for certain things to tell you what's what in each texture, and this may sometimes require going back into the game to look at the shape a few times before you figure out what goes where. Of course there are obvious parts such as landing gear, afterburner flames, cockpit and pilot areas. Most of these areas you want to leave alone. What I do is draw a box around such areas, because it is there that the transparent green must not be disturbed. These areas must remain transparent, because if you paint over them you will see that paint in very strange places, hanging off the plane's edges and such.
Like I said, a lot of trial and error is involved. Generally painting an aircraft requires two steps: first you mark off areas which shouldn't be disturbed, and then you play with the other areas until you get the effect you want. Fortunately for our example, the F-16A Desert Camo texture is very straightforward. The area in the upper left quadrant of the texture file is meant to cover the upper surface of the plane, and that's what we want to change. You'll see that there are 4 odd looking dark brown splotches there, these make up the camo paint scheme on the F-16. Don't try and figure it all out right now, we're just going to make a simple change. I said before that I wanted to change the camo pattern because I thought it was too dark. So go to the palette and select a lighter shade of brown. Palette index #91 looks like a good color to start with. Use the Flood Fill bucket to paint in each of the four splotches with the new color you've selected. Ok, that's all we're going to do for now, you can can paint the flame-job or racing-team emblems later, we're just doing this for familiarization with the process. =)
Hit the save button and then close PSP. You'll go back to the Toolkit, where the texture looks strangely unmodified. This is because you need to refresh the graphics. Simply click on the little button with a magnet on it, and your new texture will be displayed. Looks more familiar? You may notice that the texture is still mostly green, but don't let that worry you, when it is translated back into the game, the palette is automatically fixed for you. So click OK or the check mark to accept the changes and the modified texture file is saved to your project.
Build your LIB and install it, it's time to test our little paint job modification. Run the game and select Quick Mission, and choose the F-16A (Desert). Don't bother putting any enemies, or make 'em easy, because the object is to view the aircraft, not show off your combat skills. =) Once the mission starts, hit F10 and pan around, to admire your work. How's it look? If anything looks odd or you don't like the way the color looks, it's time to exit and go back to the toolkit and change it some more. And that's how the whole process works. You paint something, you save it and build a lib, then you play the game to see if it looks OK, then go back and make changes, and so on.
Ok, once you've got the camo pattern looking perfect on the F-16A (Desert), you might say, but hey, I want this pattern to show up only on the F-16C (Desert) that I'm creating, and I want the old F-16A to retain the old camo pattern. How do I do that? That my friend, is the subject of another completely different discussion.