This was my 4th (final) year project for my MEng at Bristol University. The basic idea is to provide a real-time algorithm for rendering arbitrary topology terrains i.e. the landscape can include caves, overhangs and steep cliffs. All of these are currently either problematic or simply not possible with existing algorithms.
Below is a very brief summary of my thesis highlighting the important points and topics I covered. My thesis is available as a PDF.
Adaptive Distance Fields (ADFs)
To borrow a description from one of the research papers they are a general purpose representation of shape. A distance field is a field defined in some 3D space. The value at each point in the field is the Euclidian distance to the closest point on the surface being represented. The adaptive part arises from selectively sampling the distance field based on the complexity of the surface in a particular area of the field.
The adaptive sampling’s biggest advantage is the reduction in storage required. Consider for example a 256x256x256 distance field. This distance stored at each point using a 32-bit float, would require 64MB of storage.
The only way to allow completely arbitrary topology terrain is to make use a volume based technique instead of the deformed grid approach traditionally used.
Texturing volumetric terrain is harder than texturing standard terrain. With normal terrain generated from a heightmap, the texture can be draped over the top using an orthogonal projection. This does have problems with the texture distorting over steep vertical sections of the mesh, but are not too problematic.
With volumetric terrain this texture distortion becomes much more apparent:
One solution to this problem is to use an algorithm to unwrap the mesh onto a flat surface. Several techniques are available for this e.g. lapped textures.
The downside to this technique is the amount of processing time required to produce the unwrapped surface map. Secondly any time the mesh is altered the unwrap needs to be recomputed.
Volumetric textures provide a very good means of texturing arbitrary surfaces.
The downside of volumetric textures is the large amount of texture memory they require and that they have to be procedurally generated as 3D texture maps aren’t generally that available!
In order to convert data from a voxel format to a distance field distance transforms (DTs) are needed. These are a class of functions that perform multiple passes over the data to convert from a binary field (inside/outside of surface boolean markers) into a distance field.
Overall ADFs provide an excellent framework for volumetric terrain rendering and realtime editing, but memory requirements and optimisations are needed to make a workable solution for large terrains.
Here are several video clips I used during the presentation of my thesis (needs XVid codec):
- Clip #1 – short editing operation (1 MB)
- Clip #2 – more extensive editing (3.2 MB)
- Clip #3 – short clip showing problems with mesh generation (0.6 MB)
These clips were recorded using Fraps and show the real-time editing of the terrain. There are still bugs left in the mesh generation code which result in the holes that appear occasionally (especially in clip #3).
Before and after carving (from the same viewpoint):
/image [[image:adf_before.jpg|medium|link=source]] [[image:adf_after.jpg|medium|link=source]]
Some other general shots: