Transparency 2 - Complex Texture Maps

Bryson R. Payne, M.Ed.

Partially transparent texture maps on perpendicular quadrilateralsDiscussion:

One very effective use of transparency is in making partially transparent texture maps for surfaces. For example, to make a 3-dimensional tree as detailed as the one in the picture to the right, we would have to draw quite a large number of surfaces. The procedure called LoadRGBA in this sample program takes a bitmap texture file and "alphas out" any black areas - making the image very detailed and realistic without the work of making all the polygons. As you spin the tree in 3D, it looks like a paper cutout - two perpendicular quadrilaterals were used for the surfaces, but the effect is very realistic from all angles. Once again, you can change the BMP file with any image and see the black disappear by downloading the executable into a directory and saving a bitmap as treetran.bmp in the same directory. One additional note: we can see the effect of order on transparency blending in this example - the surface facing the viewer appears opaque because it was drawn first, but the other quadrilateral always shows the first through its transparent areas because it is drawn second. One way to reduce this effect is drawing four "half" trees, with the farthest one in back, but this can take processor speed away from other important rendering activities. 

Sample code:

Click here to see the sample code: trans2.c

Executable example:

Click here for a running demo: trans2.exe, treetran.bmp


Back to Main Tutorial Page

Last modified December 11, 2000, Bryson R. Payne, bpayne@ngcsu.edu