The landscape modeler, written in Matlab, is designed to create realistic looking three dimensional landscapes, based on various randomized algorithms. The program consists of two windows and an additional pull-down menu. When run, the program only displays one of the two windows, that being the main window in which the landscape is displayed.

A rough idea of how the landscapes are created is as follows. First, a square grid is set up, and this grid will serve as the basis for the landscape. Then, a randomized algorithm is applied to the grid which assigns each of the vertices a nonnegative value, corresponding to the height of that point. This grid can now be thought of as a height field. The grid is then passed as an argument to the Matlab surf() function, which creates a surface out of the height field.

This simplified process will produce a landscape-like surface, but some additional specifications must be made for the surface to look realistic. First of all, the vertices of the grid cannot be assigned completely random heights. If this is done, the resulting landscape will be much too jagged, full of ups and downs. Furthermore, although nature seems random at first glance, in actuality it tends to follow patterns, and a completely random method would therefore not be a good representation of reality. Thus the methods used must have an element of randomness, but at the same time be based upon an underlying pattern. This program uses two such methods: a subdivision method and a cellular automaton method.

The landscape builder has a menu which allows the user to select which method will be used to create the landscape. One of these methods is called "Fractal," and uses the subdivision method just mentioned. Another method, called "Simple," uses the cellular automaton method. The other six methods are variants of the "Simple" method, and produce different effects, as follows.

The "Subdivided" method first runs the simple algorithm. It then makes a miniature copy of the landscape, creates a new grid by placing a duplicate of this miniature in each grid cell, and superimposes this new grid on top of the original landscape grid. This has the effect of providing added detail to the landscape.

The "Spline" method runs the simple algorithm, and then smooths it out by fitting splines to the grid first horizontally and then vertically. The "Spline with Superimposition" method does this first, and then superimposes miniature versions of this smoothed landscape, similar to what is done in the "Subdivided" method. The "Spline with Randomized Superimposition" method runs the "Spline" method, and then at each point randomly chooses whether to superimpose the corresponding point from a miniature smoothed out version of the landscape, or from a miniature version of the original landscape. This has the effect of adding very small but steep edges, which give the appearance of trees. The "Randomized with Randomized Superimposition" method randomly chooses at each point whether to use the spline method or the regular method, and then randomly chooses at each point which method to use for superimposition. This adds further noise. Below are examples of landscapes created using the "Subdivided" method, the "Spline" method, and the "Randomized with Randomized Superimposition" method, for comparison.

Subdivided

Spline

Randomized with Randomized Superimposition

The final item under the method menu is "CUSTOM." Choosing this option brings up a second window, shown below. This window lets the user select whether or not to add trees to the landscape, and whether or not to make the landscape smooth. If the user does not choose to smooth the landscape, then a slider allows the user to indicate how jagged to make the landscape. Two other sliders let the user specify the detail with which to create the landscape, and how much water to have in the landscape. When the user is done specifying these options, the program looks at them, decides which method to use, and changes several parameters in order to create a landscape with the desired attributes.

Now, if a spline method is used to create the height field, then there will be resulting points with negative height. These points are simply set to zero, so they're at "sea level." Then the calculated height field is ploted as a surface using surf(). The final step is to color the landscape appropriately. This is done by creating a customized color map, and applying the color map to the landscape. The color map sets all points at height zero to blue, portraying water. As height increases, the color map goes through shades of light brown for sand, green for trees, yellow for high-altitude vegetation, and then white for snow-capped peaks. This completes the creation of the landscape.

Once a landscape is created, the user can adjust five attributes of the landscape using sliders located in the main window. One of the sliders adjusts the size of the grid upon which the landscaped is designed. Changing this doesn't actually change the size of the displayed landscape. Rather, increasing the size slider increases the resolution or detail of the landscape. A second slider can be used to adjust the number of iterations for which the height field generating algorithm runs. This can give differing results, depending on the other attributes of the landscape. Another slider adjusts the decay by which each successive iteration of the CA algorithm has less weight toward the final height field. A fourth slider adds some random mutations to the celular automata height generation algorithm. And the last slider increases the jaggedness of the landscape as height increases.

Finally, the program calculates the statistical roughness, or estimated fractal dimension, of the landscape created. But the exact statistical roughness can only be computed when the subdivision method is used to create the landscape. In this case, the landscape is fractal, and the dimension is calculated as follows. Imagine the original plane before it is perturbed repeatedly to form the landscape. This plane is a square with sides of some given length, let's say one unit. When the center point is perturbed, the original square is broken into four squares whose sides are slightly more than half a unit in length. If the center point were not perturbed at all, each of the four new squares would have sides of length half a unit, but the perturbation stretches the squares. Let's let the sides of the four new squares have length 1/s that of the original square. That is, the new squares are scaled down by a factor of s from the original one, where s will be slightly less than two. If the size of the original square and the perturbation are both known, s can easily be calculated. So as the fractal landscape algorithm runs, a scaling factor s is calculated for each perturbation, and upon completion of the algorithm all of these scaling factors are averaged to give a final mean value of s. Then the fractal dimension is computed using the accepted equation dimension = log(4)/log(s), where the 4 comes from the fact that the original square is divided into four smaller squares. This tends to give a dimension somewhere between two and three.

When the landscape is created using the cellular automaton algorithm, the landscape is not necessarily self-similar, and thus not fractal. Furthermore, the statistical roughness can't be computed in the way described above since the landscape is not created by recursive subdivision, so it must be estimated. This is done using a method very similar to the one described above. Once completed, the landscape is divided into smaller and smaller squares, and the height at the center of each square is measured. This is taken to be the "perturbation" of that square, and thus an approximate statistical roughness can be computed using the same equation as above.

The landscape builder program consists of six Matlab M-files. Included is source code and explanations of these files.