|XNA 4.0 Billboarding Demo.
This Windows XNA application demonstrates how to draw an alpha blended textured quad that is always facing the camera. This technique is referred to as billboarding. XNA provides built-in support for billboarding via the CreateBillboard() and CreateConstrainedBillboard() methods of the Matrix structure. The difference between the CreateBillboard() and CreateConstrainedBillboard() methods is that the former creates a spherical billboard that rotates around a specified object position and the latter creates a cylindrical billboard that rotates around a specified axis.
In this demo we use billboarding to draw a clump of grass on a dirt floor. We use the the CreateConstrainedBillboard() method to orient the billboard to ensure that the clump of grass appears as though it is planted in the ground. One limitation of the CreateConstrainedBillboard() method is that when viewing the billboard from an almost straight down viewpoint the edges of the textured quad become visible thus ruining the effect.
1. This demo requires shader model 2.0 or higher support.
2. This demo is provided in source form only. No pre built binaries are supplied.
Download source, assets, and XNA Game Studio 4.0 solution files.