Microsoft DirectX 8.1 (C++)

VolumeFog Sample

Description

The Volume Fog sample shows the per-pixel density volumetric rendering technique. The fog volume is modeled as a polygonal mesh, and the density of the fog at every pixel is computed by subtracting the front side of the fog volume from the back side. The fog is mixed with the scene by accumulating an in/out test at every pixel—that is, back-facing fog polygons will add, while front-facing ones will subtract. If the value is nonzero, the scene intersects the fog and the scene's depth value is used. To get better results, this sample uses 12 bits of precision by encoding high and low bits in different color channels.

Path

Source: (SDK root)\Samples\Multimedia\Direct3D\VolumeFog

Executable: (SDK root)\Samples\Multimedia\Direct3D\Bin

User's Guide

The following table lists the keys that are implemented. You can use menu commands for the same controls.

Key controls Action
H Move object forward on the X axis.
K Move object backward on the X axis.
N Move object forward on the Y axis.
Y Move object backward on the Y axis.
M Move object forward on the Z axis.
J Move object backward on the Z axis.


Camera controls Action
LEFT Slide left.
RIGHT Slide right.
UP Slide up.
DOWN Slide down.
W Move forward.
S Move backward.
NUMPAD2 Pitch up.
NUMPAD4 Turn right.
NUMPAD6 Turn left.
NUMPAD7 Roll CCW.
NUMPAD8 Pitch down.
NUMPAD9 Roll CW.


Mouse controls Rotates fog volume
Mouse Rotates fog volume.


Programming Notes

For a description of the program, see the Readme.txt file in (SDK root)\Samples\Multimedia\Direct3D\VolumeFog.

This sample uses common Microsoft® DirectX® code that consists of programming elements such as helper functions. This code is shared with other samples in the DirectX software development kit (SDK). You can find the common headers and source code in (SDK root)\Samples\Multimedia\Common.