Terragen

From Sirikata Wiki
Revision as of 04:37, 31 August 2011 by Ben.christel (Talk | contribs)

Jump to: navigation, search

Terragen is a web-based terrain generation utility created by Ben Christel. It can be found here. It is designed to produce very-large-scale terrain (large islands and small continents) suitable for virtual worlds. It uses a pseudo-random noise algorithm based on series of sine functions.

Using Terragen

Terragen has several parameters that can be set by the user to produce different types of terrain. After setting the parameters, the user clicks a button to generate a 2D map of the terrain which doubles as the texture if the user wishes to create a mesh of the terrain. Terragen can output Collada (.dae) meshes, albeit hackishly. The Terragen page contains instructions for exporting Collada.

Parameters

The key function of Terragen is to produce a heightmap, which is essentially a 2D grid, each vertex of which has a numeric value which represents the height of the terrain at that point. Once the heightmap has been produced, it is relatively simple to draw the terrain map and create the 3D model of the terrain. The algorithm that produces the heightmap can take several parameters as input. Following is a description of each of them.

The example images are relative to the image below, which has the following parameters:

Terragen base.png
  • Scale = 1
  • Continental Shelf Height = 2.5
  • Noise = 2
  • Altitude Compression = 5
  • Detail = 6
  • Biome Size = 8
  • Position = (0, 0)
  • Map Size = 300x300 px

The example images are scaled down; click on the thumbnails for the full-res versions.

Scale

The Scale parameter must be greater than 0. A large Scale results in a zoomed-in, detailed map of a small area, while a small Scale produces a zoomed-out view of a large region.

Scale = 0.5
Scale = 0.5
Scale = 2
Scale = 2

Continental Shelf Height

The Continental Shelf Height must be between 0 and 10, inclusive. It specifies how high the continents are above the sea floor. More accurately, it controls the maximum amplitude of the function that determines the continental shelf height at every point on the plane. See the section on Algorithms for a description of this function.

Shelf height = 1
Shelf height = 1
Shelf height = 1.5
Shelf height = 1.5
Shelf height = 2
Shelf height = 2
Shelf height = 3
Shelf height = 3
Shelf height = 3.5
Shelf height = 3.5

Noise

The Noise parameter controls the amount of random noise that is added to the heightmap. Its value must be between 0 and 10, inclusive.

Noise = 0
Noise = 0
Noise = 1
Noise = 1
Noise = 3
Noise = 3


Altitude Compression

The Altitude Compression parameter controls the degree to which the height of the terrain tends toward the extremes. A value of 0 (the lowest) does not modify the terrain in any way; a value of 5 (the highest) raises high values and lowers low values for each term of the noise function. Higher Altitude Compression values tend to result in more dramatic mountains and rougher coastlines. Altitude Compression must be an integer between 0 and 5, inclusive.

Compression = 0
Compression = 0
Compression = 1
Compression = 1
Compression = 2
Compression = 2
Compression = 3
Compression = 3
Compression = 4
Compression = 4

Detail

The terrain heightmap is generated by summing several 2D functions at various scales and rotations. The Detail parameter controls how many of these functions are used. A high value results in rough terrain; low values produce smooth "blobby" terrain. If the detail level is set below 3, the underlying regularity of the noise algorithm begins to be apparent. Detail must be an integer between 0 and 10, inclusive.

Detail = 0
Detail = 0
Detail = 0
Detail = 1
Detail = 0
Detail = 3
Detail = 0
Detail = 5
Detail = 0
Detail = 10

Biome Size

Biomes are continuous regions with a single prevailing climate. In Terragen, there are really only two characteristics that determine the general type of a region: whether the region is a continent or an ocean, and whether it is flat or mountainous. These are not really binary variables; there are degrees of both mountainousness and continentality. In Terragen, these characteristics are independent of each other and the value of each at any given point is determined by a large-scale noise function. The Biome Size parameter thus determines the approximate size of continents and mountainous regions.

Position (X, Z)

The X and Z position parameters denote the location of the upper-left corner of the map on the infinite 2D plane that is the domain of the Terragen noise function. This is useful if you want to create several chunks of terrain that tile together nicely. The units for the XZ coordinates are pixels on the map when drawn at a scale of 1. The X and Z coordinates can be any real numbers.

Map Dimensions (Width and Height)

The Map Width and Height parameters control the size of the map that is drawn on the screen. They do not change the scale (zoom level) at which the map is drawn; instead they show more or less of the terrain. Map Width and Height are specified in pixels; they can be any positive integer up to 700, although it is not recommended to draw maps larger than 400x400 pixels (the rendering time is linear in the number of pixels drawn, as is the size of the terrain mesh).

Polygon Count Reduction

Polygon Count Reduction does not change the actual terrain heightmap in any way. It merely specifies an error tolerance to use when simplifying the terrain mesh. Setting Polygon Count Reduction to 0 results in no polygon reduction relative to the original mesh.