DirectX SDK

Billboard Sample

[Visual Basic]

This topic pertains only to application development in C++. See Direct3D Immediate Mode Visual Basic Samples.

[C++]

Description

The Billboard sample demonstrates the billboarding technique. Billboarding is a way of making two-dimensional (2-D) sprites appear to be 3-D. It can also be used for smoke, clouds, vapor trails, energy blasts, and so on. For more information, see Common Techniques and Special Effects.

Path

Source: (SDK root)\Samples\Multimedia\D3dim\Src\Billboard

Executable: (SDK root)\Samples\Multimedia\D3dim\Bin\Billboard.exe

User's Guide

Press F1 to see available commands, or choose from the menu.

Programming Notes

The sample displays a grassy field with trees in it. The trees look like 3-D objects. However, they are actually 2-D texture bitmaps that are blended onto invisible rectangular polygons.

As the sample runs, the viewpoint changes. Each time it does, all the billboard polygons that the trees are painted onto are rotated so that they face the viewer. The sample then blends the images of the trees onto the billboard polygons. The trees appear to be 3-D because they can be viewed from all angles. However, close inspection reveals that the trees have exactly the same appearance from all angles. For many applications, this minor drawback is not noticeable.

The shadows are also 2-D textures.

This sample was built using the Direct3D sample framework.