Realtime Voxel Landscape Engines - Part 4 - Level of Detail and Optimisation by (21 February 2000) | Return to The Archives

Introduction

We may also need to introduce some sort of variable level of detail scheme for our engine, in order to make sure it performs well on most machines. This is also where optimisation of the algorithm comes in.

Wave Surfing Optimisations

The rendering loop performs very badly if the landscape is completely flat, since every single column of voxels is higher than the previous and must be drawn. In most cases however, the loop will not render all the time. The trick therefore is to reduce time spent in the interpolation in between drawing. terraVox uses a technique that's executes in O(n), since it takes nearly constant steps through the height map. Although I've not implemented this yet, I think some sort of hierarchical visibility scheme would be ideal here. A simple quadtree could be stored like mipmaps, but containing the maximum value of all the subpixels. The rendering loop would then be able to discard the following voxels that are invisible in O(logn) in the best cases.

Variable Step Size

A simple way of reducing the computation is by discarding more and more information as we get further from the camera. We can for example take bigger steps through the heightmap as we scan along the rays. The voxels would then become more vague in the distance.
This does however cause a few problems, since some big mountains may be completely skipped if the step size becomes too big. See the next section to find out how to resolve this.

Combining Spans

Another trick to limit computation in the distance is to completely stop the interpolation for some rays, and use the information of neighbouring rays instead. So we end up drawing spans of n pixels wide. You could also alternatively discard every other ray, and draw the frame with interlacing.
The voxels however do become quite blocky in the distance. If you are willing to spend slightly more time drawing, or if you have some nice hardware function at hand, you could interpolate the information across the width of the span (texture coordinates, colour...).

Article Series:

> - Realtime Voxel Landscape Engines - Part 1 - Introduction
> - Realtime Voxel Landscape Engines - Part 2 - Rendering the Landscape's Structure
> - Realtime Voxel Landscape Engines - Part 3 - Texture and Lighting
> - Realtime Voxel Landscape Engines - Part 4 - Level of Detail and Optimisation
> - Realtime Voxel Landscape Engines - Part 5 - Quality Improvement
> - Realtime Voxel Landscape Engines - Part 6 - Hardware Acceleration
> - Realtime Voxel Landscape Engines - Part 7 - The Engine
> - Realtime Voxel Landscape Engines - Part 8 - Final Words

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.