With the
advent of GPUs equipped with vertex shader processors, new ways of doing things
have been made possible. Displacement mapping and depth-adaptive tessellation
are some of the newest developments in hardware accelerated 3D graphics. They
represent the equivalent of bump mapping and higher order surfaces, but taken
one step further. The former technologies are planned for inclusion in DX9
capable hardware.
Game
developers are very excited about these new technologies, but they are faced
with market realities where the mainstream has only just begun to adopt DX8
capable graphics boards. Extensive research on my behalf has led to an engine
that is capable of trilinear displacement mapping with depth-adaptive
tessellation and this on DX8 capable hardware. The results you can experience
with the Xvox demo that shows the case for terrain rendering.
The engine
makes heavily use of the vertex shader processors, taking the load off the CPU.
The displacement mapping is somewhat comparable to trilinear texture filtering.
There are several mip-levels, each at a lower resolution. Instead of texels,
the mipmap values now correspond to quadrangle geometry. For texture maps the
values are the colors of the texel corners, for displacement maps the values
are the height of the quadrangle corners.
There are
several ways of using mipmaps. The goal of all methods is to show distant
objects with less detail. This increases rendering speed and reduces aliasing.
The most crude way is to switch the complete map from one level to a lower or
higher detail level. The effect is rather disturbing as the switching is very
noticeable. A more refined way is per vertex switching. The effect is less
noticeable, you can compare this to bilinear texture filtering where you can
see a line between the different mipmaps.
A high quality method is trilinear filtering where you smoothly
interpolate, per vertex, between the different mipmaps. The Xvox demo uses
trilinear displacement map filtering. This is completely handled by the vertex
shaders and thus there is no load on the CPU.
Some
technical data:
The latter
fact may seem odd. With texture mipmaps the maps are a quarter size the
previous level. The displacement maps here each are 45 degrees rotated relative
to a previous level. Compared to ususal mipmapping this results in a smoother
and cleaner transition between miplevels,
The demo
shows a terrain make up with a 1024x1024 displacement and texture map. These
maps are repeated to make the scene very large. You can view the landscape from
very near or very far. The engine applies the depth adaptive tessellation so
that the framerate always is high and the number of triangles around 300
thousand per frame and this independent of the viewing position. Because of the trilinear displacement
mapping the geometry is smoothly morphed into less detailed geometry as the
viewing distance increases. You can view this geomorphing in action when switching
to wireframe mode (W key). With a lower level of detail you can exactly see
what happens under the hood.
Three
numbers are shown :
The demo
uses triple buffering with waiting for vsync in full screen mode. If in full
screen mode you notice a significant drop in triangles per second because of
waiting for vsync you may be able to increase the level of detail without
losing frames (F3/F4).
You may
also switch of waiting for vsync (V key), this will also result in double
buffering, saving precious video memory at very high resolutions.
The
automatic level of detail feature (A key) will adapt the scene complexity per
frame to achieve 60 frames per seconds animation. This gives fluid animation on
all video cards. Faster video cards will draw many more triangles per frame,
rendering at highest possible geometric detail for a 60 Hz animation rate.
Notice that
the 60 Hz can be different from the display refresh rate. In full screen mode
you may need to switch of waiting for vsync, especially when the display
refresh rate is 60 Hz or lower.
Next image
is drawn with 200 thousand triangles. Without depth adaptive tessellation over
30 million triangles would be required

Depth
adavtive tessellation in action. Three levels of detail are shown. They are
drawn with 86, 107 and 160 thousand triangles.

86.000 triangles

107.000 triangles

160.000 triangles
For more
information: