BVE's ability to render portions of an object's bitmap as transparent enables easy creation of irregular objects such as people and trees, and complex structures such as fences and trestle work. If the developer follows certain basic rules when creating the objects and accompanying bitmaps, the final results are usually trouble-free. There are exceptions, however. The following presentation describes the method of creating transparent objects and offers some measures that can be taken when objects do not display as intended.
Creating transparent objects. I've covered the creation of objects in my online developer guide. To summarize briefly, an object has two major sections: 1) Meshbuilder, which defines the vertices as points in space and includes a Face statement that determines what vertices define a surface and which face of the surface is visible, and 2) Texture, which defines the application of a color or a picture to the surface.
When a bitmap image is applied to a surface, the Texture section enables us to use of the transparent statement, which includes parameters to define a specific color in the image as transparent. This color can be any solid color. In practice, developers normally use black or blue. Color is defined as quantities of the three video color components red, green and blue (RGB). Amounts of color range from 0 to 255. Thus the statement Transparent (0, 0, 0) indicates black (zero quantity for each of the three colors). The statement Transparent (255, 255, 255) indicates white (maximum quantity for each of the three colors). The statement Transparent (0, 0, 255) indicates blue (zero red, zero green, maximum blue). Any portion of the image that bears the defined color is rendered transparent by BVE.
(You may find the following thread on the Rail Software Forum useful. It would appear that pure white is not a good choice for transparency.)
Making a suitable bitmap. In order to make a bitmap usable by the greatest number of PC systems, it is best to save the image as 16-bit (256-color) bitmap. Some paint programs (e.g., PhotoShop LE) don't offer this selection. Fortunately, MS Paint, which comes free with Windows, does offer the selection.
If you create an image using your paint program, you can generally establish the areas of transparency fairly easily. If you are creating the image from an electronic version of a photograph, you will need to carefully convert areas of the image to the desired transparent color. I inadvertently discovered a potential source of error when developing 256-color bitmaps using this technique. In order to take advantage of the better color fidelity (and range), I edited the bitmap in 24-bit mode. I then copied a selected portion of the image to a new 256-color bitmap, which was to be my final bitmap. Upon testing the associated object, I found the transparent section would not properly display as transparent. I found the only solution was to work in 256-color from the start. In other words, when you convert your original photographic image from TIFF or JPG format, save it as a 256-color BMP. Don't plan on doing it later. Do it now.
Displaying transparent objects. When you first run a simulation created by someone else, you may find that certain objects do not properly display the intended transparency. This often occurs with trees and bushes. If your system runs properly with the monitor set to 24-bit color mode, but is currently set to 16-bit mode, changing the setting will likely solve the problem. When I try this I get an error message having to do with HAL. This is not fatal and can be ignored. You may, however, find that your system does not refresh the display fast enough in 24-bit mode. This may as well be fatal (though it's not) because the simulation is less than satisfactory.
If, like me, you need to run in 16-bit mode, your best option is to find the offending bitmaps and save them as 256-color bitmaps. You can do this using MS Paint. Finding the bitmaps in the first place can be difficult. Usually they are named in such a way that you can tell without too much difficulty. If you have Windows ME or 2000, you can set the View to Thumbnails and have all the file icons displayed as graphical images. You will then have a very clear picture of which files are trees, shrubs, people, etc.
Alfred Barten, 24 October 2001