Realtime Voxel Landscape Engines - Part 5 - Quality Improvement by (21 February 2000) |
Return to The Archives |
Heightmap Mip-mapping
|
The thing people complain the most about when they see voxel landscapes is the wobbling. Indeed the mountains tend to jigger up and down when you move along at moderate speed. This is due to the way we step through the heightmap, and skip a certain number of voxel columns depending on the step size. This is especially awkward when we set our LOD extremely low, thereby using big steps through the map. Apart from the obvious answer of reducing the step size, there is a solution. The trick is to mip-map the heightmap, and use a map size that corresponds best to the size of the step. terraVox uses simple unidirectional mip-mapping, which greatly reduces the wobbling, especially in the distance. You can however notice the area where the next level of mip-map is used. Bidirectional mip-mapping would help a bit more, but using trilinear filtering would produce the best results. This wasn't implemented mainly due to the tremendous speed hit that would entail. |
Texture Filtering
|
When we load a texel from our textures, we have the possibility of simply loading the closest texel, or applying a filter. Bilinear filtering in this case would look amazing, but we would have to load 8 texels to do that, which slows down the rendering pipeline by over 50%. Another technique is to use a form of dithering. We use a small precomputed array of noise with the intensity interpolated from the four corners. We use this value to determine which texel to load. So in the end, we only need to load 2 texels, and the results when the texture is magnified is much nicer. The texels however tend to flicker a bit when moving, especially in the distance. But the overall effect of a static image is surprisingly good, giving the impression of an old oil painting. |
Bidirectional Mip-mapping
|
There is another important problem with the texturing. Texels applied onto voxels far in the distance, or voxels that form a sharp angles with the camera seem to disappear and reappear randomly. This is not a problem with the voxel engine itself, just a general texturing problem. As you probably know, this can be easily solved by introducing multiple layers of mip-maps. terraVox can perform bidirectional mip-mapping, which to be perfectly honest is not that much better than unidirectional mip-mapping, except when the spans have a sharp angle in the texture. |
Antialiasing
|
Antialiasing can be performed in various different ways. You can render multiple frames and blend them together, apply a simple filter or use a clever technique to smooth the edges only. The most effective is of course the last technique, since we can find the mountain crests extremely easily. This is done during the wave surfing. When a voxel column is projected below the previous, then we have a crest. We then alpha blend the lowest pixel of the new span with the highest pixel of the previous span. The alpha coefficient used is simply the fractional part of the Y coordinate projected onto the screen. |
The Sky
|
This section is not really within the context of this tutorial, so I'll just cover it briefly. There are basically three simple ways of rendering skies in software.
|
Water
|
Water can often be the most interesting feature of a landscape. The trick of course is to be able to render it in realtime. I can think of a few ways of doing this, off the top of my head.
Either technique would work fine, but combining them would probably give much better results. |