New ways to have fun with CFS1
Chapter 7
TEXTURES
Colors are fine and, with a bit of brain and sweat, you can go a long
way with them. That said, these days, most aircraft are at 95%, if not
more, covered with textures. Scenery designers were a bit more
conservatives, or maybe a bit less lazy, and did wonderfully great
things without, or very little, texturing. It is also a case of
necessity, not laziness, that aircraft designers had to resort to
textures; so many details, so very few polygons! For that reason, the
following chapters will deal with textures.
A bit of not so distant history
As we have seen in chapter 1, FS4 had no textures, only colors were used. So when
FS5 added textures to colors, flight simmers were, I can only imagine, ecstatics! For images, a format called
RAW 8 bits was used, with a 256 x 256 pixels window that could
contain 256 colors associated with a unique palette. Usual suffix was
.R8 but Flight Shop/Aircraft Factory introduced the .?AF system, scenery tiles were often simply numbered
.0, .1, and some panels textures came with a .PAN suffix.
Then came
FS5.1, then FS95 (a.k.a. FS6, a.k.a. FSFW95), then FS98... and the textures stayed the same! They were all based on a single palette
(FS5.PAL) RAW
8 bits format. The palette could apparently be modified, but very few
did. Practically all aircraft ever made for these games are colored
with the same basic palette. Lets see what
FS5.PAL looks like;
Now, does it not remind you of something?
Come on, think of it... no?
OK then. One clue; 69. (And I'm not talking Kama Sutra here...)
That's it! This is an exact repetition of the 69 (or 68
transparent for that matter) direct palette, color for color up to
orangy "panel colors". We first have the grays 32 shades (read from the
top of the first left
column, column by column going right) in the first two columns. Then
the twelve red, green, and blue, then the nine orange, yellow, brown,
orange/red and olive, then the three aqua blue. These are followed by
the
red/ green/ blue/ aqua/ orange/ yellow and six grays that, in the 69 palette, are "constant" colors and glow in the dark. The two following
columns are pure black but do coincide with the black-during-day-orange-at-night colors.
Here stops the likeliness. A few other palettes do exist;
this is FS4.PAL
this is MEIGS.PAL
and this one is
FSLD.PAL
HAZ (for haze, I'm guessing) are also palette files, so we have;
which is FS4.HAZ
for FS5.HAZ
for MEIGS.HAZ and, finally
for FSLD.HAZ.
You will note that;
- only the last four columns' colors are changing from one palette to the next;
- the two columns right of the two black ones (where the black to orange should be) are always the same.
Those two last columns are known to be the sky and ground colors (I hope that you can figure out which is which), followed by the custom colors in the four last columns. You can check these palettes by saving a RAW 8 bits file with TexBMP, a nifty little program created by M. Luis Vieira de Sa' that you can find HERE.
So, pretty much all aircraft built for FS5, FS5.1, FS95 and FS98 were built with this unique palette! A few FS98 aircraft were released with a modified FS5.PAL, but this involved the changing of the colors of all aircraft! As AF99 was the only program compatible with CFS1, many aircraft build for that game continued to live with that palette.
More than meet the eye...
For your benefit (I know; I need a life!), I made the following bitmap;
This bitmap not only reproduces the actual FS5.PAL palette, it has that
palette in it, color for color. So it only needs to be converted into a RAW
8 bits. The program TexBMP mentioned above will do the job. Martin Wright has an arsenal of graphic-oriented utilities that you will find
HERE, and at least three of those utilities, with the proper
DLLs, can make an honest R8 file out of this rogue bitmap.
1- Show:
Open the program and navigate to fs5pal.bmp , open it
,and click on the right little folder to "Save Image As..."
, navigate to where you want the
R8 file to be, choose "FS Texture (256x256)" and type fs5pal.r8
. Voilą!
2- ConvR8:
Open the program, click on "File" and choose "Load new
image" to navigate to fs5pal.bmp , click on
"File" > "Save as R8"
and save where you want as fs5pal.r8
(do not forget to type the whole name with its extension "r8"). Voilą!
3- TView:
Open the program, navigate to fs5pal.bmp and highlight it by clicking on it
, then save as "FS Texture (256x256)"
under the name fs5pal.r8 (don't forget to type the extension) where you want.
Voilą!
They're other methods to do it but, with four programs and three different ways, it is time for you to get cracking and make that fs5pal.r8.
Old texture, old method
Once done, place that file (or copy it) in the TEXTURE
sub-folder of playground. We will now texture the front wall of our
cube with it;
:TheCube ;10x10x10 cube Points( 1 ; 8 points 780 0 780 ; 1 780 1560 780 ; 2 780 1560 -780 ; 3 780 0 -780 ; 4 -780 0 780 ; 5 -780 1560 780 ; 6 -780 1560 -780 ; 7 -780 0 -780 ; 8 ) ; SurfaceColor( 05 F0 ) ; ; Poly( ai 5 8 4 1 ) ;bottom int ; Poly( ai 2 3 7 6 ) ;top int ; Poly( ai 1 2 6 5 ) ;fore int ; Poly( ai 8 7 3 4 ) ;aft int ; Poly( ai 4 3 2 1 ) ;right int ; Poly( ai 5 6 7 8 ) ;left int SurfaceColor( 05 F0 ) ; Bitmap( fs5pal.r8 0 0 0 0 ) TexPoly( a 1 0 0 2 0 255 6 255 255 5 255 0 );fore ext Poly( a 5 8 4 1 ) ;bottom ext Poly( a 2 3 7 6 ) ;top ext Poly( a 8 7 3 4 ) ;aft ext Poly( a 4 3 2 1 ) ;right ext Poly( a 5 6 7 8 ) ;left ext Return
NOTA: From now on, I will use formatted paragraphs for coding. Previous code was not formatted but would still compile, I know; I checked, if copied/pasted in MDLDisAS. This formatting should help keep the place neat and cozy for reading code lines, especially as we are getting into more complicated stuff.
The SurfaceColor() command is an old acquaintance, it will
be the "fall back" color if the texture is missing or, as in this case,
the color for untextured parts. The command
Bitmap() is the old way of applying textures. The attribute "a" is for automatic application. The four digits' groups can be
broken down as point index - image X coordinates - image Y
coordinates. In this case, for example, point 1 (bottom left) is attached to coordinates
X=0 Y=0, point 2 (top left) to coordinates X=0 Y=255, point
6 (top right) to coordinates X=255 Y=255, and point 7 (bottom right) to coordinates
X=255 Y=0. I like to think of it as if I was stretching a fitted sheet on a mattress. This is as simple as it
gets; remember that we're applying a square texture to a square polygon. This is what
we sould see in situ;
First observation; the image is not upside-down, so we must assume that the command
Bitmap() treats images from the lower left (0 0) to the upper right
(255 255).
Incidentally, I did not do it on purpose; this is sheer luck in action!
I simply went clockwise (force of habit...), starting from one. We'll
have to check later to see if
BMP files are treated differently.
In the same manner as we had applied colors, we don't have to go
clockwise (with the exception of planes coinciding with X. Y or Z) ,
and we don't have to start with the lowest number, but we must go along
the perimeter of the polygon we're texturing in one direction only from
point to point on that perimeter. Here is a (bad) example;
TexPoly( a 1 0 0 6 255 255 2 0 255 5 255 0 );fore ext blunder one
It does not follow the polygon perimeter, which will give us this;
This "half bow tie", to use again the fitted sheet analogy, is a bit like trying to get the sheet corners on the wrong mattress
corners. But we can screw things up by not respecting the image coordinates;
TexPoly( a 1 0 0 2 255 255 6 0 255 5 255 0 );fore ext blunder two
which will look like this;
This time, it is the mattress that we twisted!
These errors will not be "caught" by SCASM during assembly, so it is your responsibility to check and find what went wrong.
Now, second observation; all the colors we put in the R8 file are showing. This is in blatant contradiction with
AF5PAINT. This program limits the palette to the following;
Why would M. Stefan "Doe" Doebereiner, the author of AF5PAINT, mislead us? He must have known what he was doing after all. My idea is that "something" happened between
FS5 and CFS1. More on that later.
Now, it is time to go see our front-textured cube at midnight;
Good gully; constant colors do glow at night! This compensate, to
some extent,
the fact that we're not seeing the orangy colors pop-up in the next two
columns. But other things do happen... look closely, this is why I have
enlarged the image; some other colors are still faintly visible!
I was caught by surprise once by a dawn/dusk effect that almost eluded me. Not this time. Here is our cube from day to night;
A screen capture was taken every ten minutes from 17h30 to 22h20.
Note the sky colors column; it turns into pinkish shades as the night
sets in and it keeps a bit of color even at night. The ground colors
also react in a very distinctive way; the green tends to expand in the
lighter shades before turning to black. But that's not all; colors
preceding the constant ones do keep, in their lighter shades, a little
bit of color. It is more evident in the gray, red, and yellow palette,
but it is there. Some custom colors do, as well, show a bit of
"non-black" at night.
New texture, old method
I don't know about you but, personally, I'm curious to see fs5pal.bmp in the same situation as
fs5pal.r8. So go and put the BMP file into playground texture sub-folder and then simply switch names like this;
:TheCube ;10x10x10 cube Points( 1 ; 8 points 780 0 780 ; 1 780 1560 780 ; 2 780 1560 -780 ; 3 780 0 -780 ; 4 -780 0 780 ; 5 -780 1560 780 ; 6 -780 1560 -780 ; 7 -780 0 -780 ; 8 ) ; SurfaceColor( 05 F0 ) ; ; Poly( ai 5 8 4 1 ) ;bottom int ; Poly( ai 2 3 7 6 ) ;top int ; Poly( ai 1 2 6 5 ) ;fore int ; Poly( ai 8 7 3 4 ) ;aft int ; Poly( ai 4 3 2 1 ) ;right int ; Poly( ai 5 6 7 8 ) ;left int SurfaceColor( 05 F0 ) ; Bitmap( fs5pal.bmp 0 0 0 0 ) TexPoly( a 1 0 0 2 0 255 6 255 255 5 255 0 );fore ext Poly( a 5 8 4 1 ) ;bottom ext Poly( a 2 3 7 6 ) ;top ext Poly( a 8 7 3 4 ) ;aft ext Poly( a 4 3 2 1 ) ;right ext Poly( a 5 6 7 8 ) ;left ext Return
After compilation, go have a look;
not much of a difference by day, but by nigh;
!!!
Again, the image is not upside-down, which indicates that both images, RAW 8 bits and
Bitmap 8 bits, are treated the same way relative to their
orientation. At night, we have lost the dark colors and, incidentally,
the ground, sky, and constant colors effects. If we can really consider
this a loss, as now all colors survive the darkest night.
Until the next chapter, I would like you to
practice texturing our cube. Not only the front, but the other sides
too! Try to make all walls upright, remembering what I said about point
order and coordinates. Paint right and left with the R8 and front/back
with BMP. Go see what it looks like in the game under different sun
angles. Check it at dawn, at dusk, during the day and at night. Change
the fall-back color. For example; try constant colors, transparent
colors, new and old "style". Post your best successes (and, if you
dare, your most lamentable failures) in the thread "New ways to have
fun, prise deux".
This will be a good way for me to see if someone is listening, and learning...