New ways to have fun with CFS1

Chapter 6

RGB colors

Do you remember having endless discussion with your wife about the color of a piece of clothing or drapes or wall or... pretty much everything that has color in life? Well, I've found worst; WWII jeep owners! You would believe that olive/drab is a clear cut case, especially since the pigments are still available (for a price... of course) in vintage cans and the mixing recipe known to all... naaa! As I was doing research for my jeep, I discovered a debate on that very subject that had been going on for ages and, to my knowledge, is still going on. 

Modelers, plastic or pixel oriented, are made of the same mettle. We're debating colors with passion, and the subject never ends. We are colors crybabies! And I plead guilty; I'm one of them!

This is probably why Microsoft® Flight Simulators' team, tired of us crybabies complaining, decided to include RGB coloring for CFS1.

What is RGB?

"The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue." from Wikipedia 

When it was introduced in CFS1, crybabies like me were emphatic! The color palette is 256³ (256 x 256 x 256) = 165 777 216 colors! With such a choice, everyone should find "his" or "her" color, even your wife!

Each of the three basic color can be "modulated" in 256 scales, from 0 (no color) to 255 (full color). SCASM commands introducing RGB are as follow;

RGBSColor() for surfaces

RGBLColor() for lines (and dots)

LoadBitmap() as a subset of instructions for a "fall back" color

For now, we will concentrate on RGBSColor () command only, but what applies to it applies mutatis mutandis to the other twos.

RGBSColor() command

Returning to our cube, we will make it full red;

: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
RGBSColor( EF 255 0 0 ) ; full red
Poly( a 5 8 4 1 ) ;bottom ext
Poly( a 2 3 7 6 ) ;top ext
Poly( a 1 2 6 5 ) ;fore 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


The interior surfaces are simply omitted using semicolons, note that the "old" SurfaceColor () command for red is there so you can compare it with the "new" RGBSColor () command. This should give something like this;



You will note that the cube is shaded; we can see the angles and corners. Same thing with full green and blue;

With the old F0 attribute, this meant pitch black colors at night. Well, not anymore!



So, during the day, these colors react like F0 shaded colors, 00 F0 to 0E F0 for example, and like F0 constant colors, 0F F0 to 16 F0 for example, at night.

RGBSColor () attributes

You must have observed, just in front of the three RGB colors, the letters "EF". The E stands for opacity and the F for 100% opaque, the most common attribute found. You can modulate opacity from 0 to 100% going from 0 to F, giving you 16 gradations of opacity;



Above, you have the 16 possibilities for full red (255 0 0). You will note that, contrary to transparencies obtained via attribute 68, it is shaded. It is not much of a problem on a flat surface but, if you want to do a curved surface, like the nose of a B-26 for example, you'd better be using attribute 68, unless you want the polygons lines to show. like in some German birdcages.

Another attribute is "B", which you can decline from B0 to BF. Lets see what it does with full red;

It is transparent and it is unshaded, so it gives you another choice for unshaded curved transparencies. But Manfred Moldenhauer missed something here; they are light effects! This is only evident when you compare them to their corresponding color with E attribute;



So, the gradation is not only in transparency, but also in brightness. You can make very stunning lights shows with that property, as the combination brightness/transparency mimic the diffusion of light in a very convincing manner.

One last attribute is F0 and, you may have guessed it, lets you use the F0 palette. Simply type the color at the R place with its hexadecimal number, G and B stay at zero.

RGB palette

With 16 777 216 colors, do not expect me to prepare tableaux like the ones I have done for the old palettes. But some pointers may be helpful.

First, an evident fact that is not so evident after all; how many different colors can one polygon support at the same time?

The answer; two! Each side can have a different color, but no more. So, even if we have more than 16 millions colors at our disposal, the actual number of colors used in a model is limited by the number of polygons in it multiplied by two, assuming that each polygon is colored on both sides, a very rare occurrence, and assuming that we want each color to be unique, which is unheard of. Lines and dots are limited to one color only.

That said, what does the 24 bits palette looks like? Many paint program use rainbow representations, like my old MS Paint;



this picture is, in fact, an illusion; sixteen millions colors simply do not fit in an image measuring 177 x 185 pixels, a little less than 33 thousands pixels. But this is not so important as the limit of the human eye to differentiate colors is left well behind by the computer. Without cheating, tell me how many colors you see in this image;

 

Seventeen! If we include the white background. Each "black" square is of a different color than the next, from 0 0 0 to 16 16 16 (8 8 8 is missing incidentally!). This "waste" of colors can be very useful under some circumstances. For example, it can be used as a "marker" on some polygons to find them later while not spoiling the visual effect of the ensemble.

At last, another property of the new RGB palette needs mentioning; shading does modify the basic color. This is how, in fact, it creates the 3D impression. You just have to look on the full red, green and blue cubes above to remark that none of the three visible faces is the same color as one of the other two.

Once all that is said and taken into account, a few basic colors' families should be known.

Grays scale

From 0 0 0 (pure black) to 255 255 255 (pure white), all RGB with three equal number are on the grays scale.



That is not to say that all grays are having equal RGB numbers, only the "pure" ones do. They're is a lot of "grayish" going around, but you will always find that the three RGB values are relatively close.

Reds scale



Except for the first upper left (255 255 255) and the last lower right (0 0 0), all these colors are part of the reds scale. Pure red (255 0 0) is framed by a white square. All the colors up and to the left have red = 255 but lesser green and blue in equal proportion (255 100 100 for example) all those to the right only have a red component (100 0 0 for example). Again, you may have a "reddish" color that does not follow exactly that scale, but it should be close.

Greens scale

The same principles apply to the greens scale. Pure green (0 255 0) is framed and all the colors up and to the left have green = 255 but the other two colors equal to each other but at a lesser number than green while the right column are only displaying green at lesser degree as you approach pure black. Again, you may have "greenish" colors that do not follow exactly that scale, but they're not very far. You will also note that most of these colors are more appropriate for light effects than anything else, as only the darker shades would be somewhat useful for foliage, lawn, or camouflage.

Blues scale



Pure blue (0 0 255) is spread in the same manner as the two previous colors and the same comments apply. Contrary to greens, though, the lighter part (on the left) is susceptible to be used for sky and clouds, or belly camouflage to mimic these.

These are the three primary colors of the RGB system. The secondaries are a mix of two primary.

Yellows scale

(255 255 0)

Cyans scale

(0 255 255)

Magentas scale 

(255 0 255)

Apart from some yellows and cyans, you may have little use for the rest, and you may ask yourself at the same time "But where are the browns, the oranges?" The answer is simply that these few scales only represent "mathematically pure" colors. Even if high-performance monitors can now render 64 bits image, the 24 bits is still being called "True colors".

Brown and orange, for example, are basically red dominant, green middle, and blue low colors, hence not in the "lists" above. But 24 bits can still render vividly an oak trunk and a basket of oranges. If unsure about how to obtain a precise color, you can always use your favorite paint program to sample it. Most paint program, beginning with MS Paint, have a rainbow bar of some sort where you can fiddle with colors. Use it.

Metallic colors

Rendering of metallic colors is possible, but only to a certain point. The color itself can be done, but not the reflectivity, so polish metal is impossible to render. For the same reason, it is impossible to make a mirror. But, with some trompe l'oeil techniques, we can get pretty close. We will probably tackle the subject more deeply in future chapters.

Color application to polygons

If you were to make a cube with AF99 and wanted each of the six surfaces to be of a different color, you would have to make six parts but, with SCASM, a single "component" will do;

: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
RGBSColor( EF 255 0 0 ) ;
Poly( a 5 8 4 1 ) ;bottom ext
RGBSColor( EF 0 255 0 ) ;
Poly( a 2 3 7 6 ) ;top ext
RGBSColor( EF 0 0 255 ) ;
Poly( a 1 2 6 5 ) ;fore ext
RGBSColor( EF 255 255 0 ) ;
Poly( a 8 7 3 4 ) ;aft ext
RGBSColor( EF 255 0 255 ) ;
Poly( a 4 3 2 1 ) ;right ext
RGBSColor( EF 0 255 255 ) ;
Poly( a 5 6 7 8 ) ;left ext
Return


Which will give you this;

Apart from the fact that it will save some milliseconds to the framerate, it has a certain elegance to it. Note that this would work as well with the "old" colors. It may be a good idea to try it on your own as an exercise.

CONCLUSIONS

The subject is far from being exhausted but, after this brief introduction to the RGB coloring system, you may understand why I was a bit lost with the "old" one. They're isn't much that the former can't do as well, if not better, than the latter. This is certainly one case where learning to make scenery macros before aircraft was an advantage as RGB coloring was introduced by program such as EOD while AF99 kept to the "old ways". Incidentally, these colors are strictly CFS1 and up. In FS98, it would probably crash your game or your PC...