Heightfield and Procedural Terrain

From Planetside Software Wiki
Jump to: navigation, search

Terragen allows the use of two different types of terrain: heightfield and procedural. Both terrain types can be used in the same scene. You can use procedural operators on heightfields, or convert procedurals into heightfields in order to perform heightfield-specific operations (or to export to other applications).

Heightfields are the more traditional format for storing and representing terrain data. Heightfields in their simplest form are an ordered grid of height or grayscale values. Height information is ultimately represented numerically, but it can be interpreted as values along a spectrum from black to white for the purposes of editing in a graphics application. This means that heightfields are 2 dimensional and often very similar to any other image format, though they are generally only a single “channel” and are represented as greyscale. Additional information such as the distance between each value (or “point”), or the position of the terrain on the globe can be included (“georeferencing”), but the basic heightfield concept consists of elevation values in a grid.

Heightfields are useful for the following reasons:

  • They store absolute values and can be loaded and edited much like any other image format.
  • Certain terrain-related editing functions, such as erosion simulation, are significantly easier to perform on heightfields.

Limitations of heightfields are as follows:

  • Only a single height value is allowed at each point, so shapes such as overhangs and caves are not possible
  • They have a finite resolution and detail. So the larger or higher resolution the terrain, the larger the file. At a certain point, the heighfield becomes too large to load and render easily. This point is well before the planetary scale.

Procedural terrain resolves many of the issues of heightfields, but it comes with some limitations of its own. Procedurals are essentially mathematical functions which define the shape of the terrain. They can be computed accurately at virtually any scale. Aspects of the functions are randomized, but boundaries are set on the randomization. This allows for infinite variety within a desired range — the norms for Earth terrain, for example. As a result, you can achieve theoretically infinite detail, and produce as much terrain with a similar “style” as you want; enough to cover a whole planet.

Specifically, the advantages of procedurals are as follows:

  • Infinite variety that easily scales to any terrain size, including planetary.
  • They are computed in 3 dimensions, so can create shapes such as overhangs.

The disadvantages of procedurals are as follows:

  • They need to be computed during rendering for full detail, which increases the render time.
  • They are harder to edit, and it’s difficult to apply terrain-related editing functions such as erosion simulation to them.

Fortunately in Terragen you can easily mix heightfields and procedurals in a single scene. You can balance both approaches to take advantage of the strengths of each while minimizing their weaknesses. For scenes that need explicit terrain shapes but also have perspectives relatively close to your terrain, you can create your base with a carefully edited heightfield, then selectively blend in procedural displacements to add realistic smaller-scale detail. For larger-scale scenes, with important specific features in the foreground and a need for realistic terrain all the way to the horizon, you could blend in a heightfield in the foreground, with infinite procedural terrain in the background. You can even use multiple heightfields and procedurals in different areas and at different scales, making even the most challenging projects possible.

These concepts and their practical ramification are covered in more detail in Terrain and Water.

A heightmap or heightfield is an array of height values, usually in a grid which describe the height at specific points in a defined area. Heightfields are used to represent real-world and virtual terrain in a specific, easily converted format. Most heightfields can be represented as simple image data in grayscale, with black being minimum height and white being maximum height.

In general a “procedure” is a series of steps that should result in a specific and reproducible outcome. In Terragen 2 a “procedural” is a mathematical function describing output which may be visualized and sampled to create anything from terrain to clouds.