SLIDE 39 Solution Design vertex is constituted by a given (x,y) world position and an associated height value (or elevation), which can be understood as the z component of the vertex. The value for each vertex’s height is different for approaches A and B, as well as the imple- mentation across the generation. However, lets consider that each approach has a generic method GetHeightAt(x,y) to obtain the elevation of a vertex at (x,y) coordinates. Then, terrain surfaces are created as follows:
1
var terrain = new Surface(columns, rows)
2
for x = 0 to columns // inclusive
3
for y = 0 to rows // inclusive
4
terrain[x, y] = GetHeightAt(x, y) // <- varies according to the approach
3.3.1 Approach A
For approach A, GetHeightAt(x,y) is obtained as a single normalized Perlin value2, considering a given set of input parameters for the noise generator 3, following equation 3.1. Since Perlin noise returns a normalized value (between 0 and 1), scale is used to determine the range of final values. So, for example, for a scale value of 10, terrain height values will vary between 0 and 10. GetHeightAt(x,y) = scale×Perlin(x,y) (3.1) One of the main disadvantages of using only one Perlin value is the non-existence of highly con- trasting features (isolated mountain peaks or valleys). Additionally, more Perlin values could add additional layers of roughness to the terrain.
3.3.2 Approach B
For this approach, GetHeightAt(x,y) is obtained by the equation 3.2. GetHeightAt(x,y) = scaleα ×Perlinα(x,y)×scaleβ ×Perlinβ(x,y)2 (3.2) Perlinα and Perlinβ refer to Perlin noise with α and β input parameter values, respectively (with distinct values for each parameter field). The scale value, as mentioned for approach A, is used to determine the range of final values for each Perlin method. This value, multiplied by scaleα × Perlinα ×Perlinβ, guarantees the existence of valleys and mountain peaks which would otherwise not be present, by decreasing or increasing severely the resulting value. By using more than one Perlin value, this approach introduces some "noise" to the resulting terrain, which results in a more rough topology.
2Although a parameter called tiling is used to scale up or down the terrain, it is used internally by the Perlin method.
As such, these values (x,y) are always absolute world coordinates.
3The internal parameters used by Perlin noise function are: frequency, octaves, scale, tiling, lacunarity and per-
sistence.
23