There are some references on the web and in the industry where the term voxels is misused to indicate heightfields. Although voxels can be enumerated to represent heightfields, voxels are 3D elements, and can handle concavities that heightfields cannot. A heightfield is a 2D uniform grid, where each grid element is associated with a single height value (relative to a flat surface) to generate common geome- tries such as terrains or mountains. SeeFigure 3.16for raw data after texture map- ping to a polygon and the rendering result. The source of the raw data can come from point clouds, LiDAR (although multireturn LiDAR data cannot be handled
Figure 3.16.The heightfield data when texture-mapped to a polygon and its rendering re- sult. Image courtesy of Ratko Jagodic.
by heightfields, but can by voxels), topographical maps, USGS data, etc. Height- fields are also sometimes referred to as height maps.
Note that heightfields are quite similar to bump or displacement maps (Sec- tion 5.2). The differences are that heightfields assume a planar base (while dis- placement maps can be applied on a curved surface), and heightfield shadowing needs to be a lot more precise than for a displacement map since the camera will often lie very close to the heightfield. This similarity leads to a discussion about sharing similar shadow algorithms (see Section 3.8.2).
Earlier research involves keeping the shadow information provided by project- ing the scene in the light source direction [409, 485]. Since then, several direct and indirect rendering approaches have become feasible options.
In terms of indirect rendering approaches, heightfields can be converted into polygons [350] (including handling LODs) so that the GPU can easily be used for rendering needs, including shadows, of which there are many algorithms to choose from within this book (e.g., Kaneda et al. [289] apply shadow volumes). As alluded to in the previous paragraph, there is also opportunity for mapping heightfields to voxels [105], and the voxel rendering options made available (Section 3.7).
In terms of direct rendering options, variations of ray tracing (Section 3.8.1) and horizon mapping (Section 3.8.2) have become the preferred approaches, the former due to their simplicity, the latter due to their ability to utilize the GPU for real-time performance. However, care must be taken with horizon-mapping approaches due to special casing when heightfields need to integrate with other geometry types. More are discussed in terms of the direct rendering options below.
3.8.1
Ray Tracing
Using ray tracing, the 2D uniform grid is traversed, using any DDA algorithm, from the point to be shaded to the light source. If the visited pixels from the 2D grid indicate that the pixel height is higher than the ray height, then that point is in shadow [111]. A GPU-assisted version of the above is also available [381]. However, this basic approach results in the rendering of flat tops, which means the highest points are always horizontally flat. To achieve pointy tops, Musgrave [420] bilin- early interpolates the height of the four corner points. To achieve proper ray hits, he uses the above traversal approach, but if the minimum height of the ray extent (crossing the pixel) is higher than the maximum height of the four corners, then traversal continues assuming no hit; otherwise, the ray is intersected against two triangles formed with the four corners to determine ray-hit success.
Performance gains in ray tracing heightfields can be seen in a couple of di- rections, including the work of Henning and Sephenson [239], that optimizes the traversal algorithm to achieve faster rendering speeds, and the work of Qu et al. [471] that uses the GPU to render the triangles.
Figure 3.17.Heightfields used for visualizing terrain using a hierarchical approach. ©1998 IEEE. Reprinted, with permission, from [562].
3.8.2
Horizon Mapping
As for horizon mapping, as stated in Section 5.2, the shadows are approximate. While appropriate for bump maps, this is not appropriate for heightfields due to the high frequency changes that can be abundant in heightfields. As a result, sam- pling in more directions is necessary, and thus the research has focused on faster computation of the horizon angles.
Stewart [562] extends the horizon-mapping technique by using a hierarchical approach to consider all points in the heightfield as occluders. See a rendering re- sult inFigure 3.17. Snyder et al. [547] apply a multiresolution pyramid of height
Figure 3.18.Heightfields used for visualizing mountains, using a multiresolution pyramid of height values. Image courtesy of Snyder et al. [547]. Computer Graphics Forum ©2008 The Eurographics Association and Blackwell Publishing Ltd. Published by Blackwell Publishing, 9600 Garsington Road, Oxford OX4 2DQ, UK and 350 Main Street, Malden, MA 02148, USA. Reproduced by permission of the Eurographics Association and Blackwell Publishing Ltd.
values—at a given point, the check for maximum height values uses high resolu- tions for close-by grid pixels and lower resolutions for far-away grid pixels. Thus, the details close by are not lost, and the far-away details are blurred to generate soft shadows, so extreme accuracy is not as crucial. See a rendering result inFig- ure 3.18. Timonen and Westerholm [586] also accelerate the computation of the horizon angles, by being able to reuse neighboring grid pixels’ height and horizon angles as guide for the current pixel’s horizon angle.
3.8.3
Trends and Analysis
Most of the industry software do not apply direct rendering of heightfields when heightfields are not the only primitive to render and using direct rendering tech- niques would incur nontrivial amounts of processing in order to integrate the dif- ferent primitives. Example integration issues include heightfield shadows on other objects and other objects’ shadows on the heightfield. As a result, when render- ing heightfields, industry software such as ArcGIS, Terragen, Picogen, POV Ray, Blueberry3D, etc., convert to polygons for rendering needs, or the native format is already in TIN (triangulated irregular network) format. There are also some growing trends to convert heightfields to voxels as well, such as the engines from Vulcan 3D and Atomontage. Both polygons and voxels offer good integration and rendering capabilities.