Torque Game Engine DocumentationVersion 1.3.x |
Starting The Terraformer
Of all the in-game editor tools, the Terraformer is probably the most elaborate and complicated one. The shortest definition one could give this tool is, a tool to algorithmically build terrains. You may ask, Why would I want to use this tool to build my terrains? The number one reason I can think of is: It is a fast way to create interesting terrains.
I must admit, I struggled with this part of the guide. I wanted to provide in-depth coverage of all of the topics I discuss, but at the same time, I wanted to complete the guide in a reasonable amount of time. Considering the fact that you wouldn't get any benefit from this guide if I didn't complete it rapidly, I have decided to describe this tool generally. That said, I'll give the following details about the Terraformer:
If you are reading this guide from front to back, this will be the first time that you have seen this particular window. You'll note that it is similar to the Mission Area Editor Window. In fact, this window displays very similar data. For the purpose of this discussion, we'll focus on the following aspects:
Table 4.27.
![]() |
|
In the lower right corner of the screen, you will find the Terraformer Operations Tree. There is a button labeled Operations clicking on this will bring up a pull-down menu with all the operations. When you select an operation, it is added after the currently highlighted operation (so you can insert new operations into the middle of a list of existing operations).
Each of the Terraformer operations has its own settings. These can be accessed in the upper right window. Before we cover these, lets quickly enumerate and describe the general properties of the operations.
In his Tribes Editing guide, Editing Maps and Missions in Tribes 2, Tim Hammock appropriately categorizes the operations as either Generators or Filters. In addition, I would like to add the category Base. The following tables give a summary of the Base, Generator, and Filter operations:
Table 4.29.
| Base | Summary |
|---|---|
General | This is the default operation. It cannot be removed from your list of operations. The values set in this operation are used by subsequent generators and filters. |
Table 4.30.
| Generators | Summary |
|---|---|
fBm Fractal | The random fractional Brownian motion generator (if you were wondering what the acronym means) is a basic terrain generator. It produces rolling hills with various steepness based on settings. It tends to produce smoothly topped hills, but can produce jagged peaks. |
Rigid MultiFractal | Another fractal based generator, this tends to produce hills with serrated (or sharp) peaks. |
Canyon Fractal | This fractal based generator produces a series of troughs (canyons). It can produce shallow to deep canyons that run straight or twist. |
Sinus | This generator would probably be impossible to get a handle on without the code. However, a quick peek shows that this generator creates terrain by iteratively adding the scaled sum of a sine and cosine pair with some basic noise for flavor. Huh? Forget it. The description isn't entirely correct and even if it were it wouldn't mean much. Just remember that, ignoring the noise element, all terrains produced with this generator have the same base shape. Your choice of settings will determine how this shape is applied to progressively smaller sections of the terrain. I'll give more details below. |
Terrain File | This operation should allow you to import a previously created terrain file, but currently it does not work. below. |
Bitmap | This operation allows you to import an image file as your terrain heightmap. |
Table 4.31.
| Filter | Summary |
|---|---|
Turbulence | This filter erodes and re-deposits terrain features and kind of reminds me of the smudge brush applied algorithmically. It seems to erode more that it re-deposits. Both of these actions are done in a swirly turbulent (therefore the name) fashion. This filter significantly alters the look of your terrain. |
Smoothing | This is a simple nearest-neighbor averaging filter. It will tend to remove jagged areas in your terrain. |
Smooth Water | This is like the smooth filter, but is limited to smoothing terrain that is at or below the level of global water height (set under General filter). No smoothing is done for features above the waterline. |
Smooth Ridges/Valleys | As the name implies, this filter affects specific regions based on their characteristics. Plateaus with jagged edges will be rounded at the edges while retaining their original steepness. Deep dimples in valleys will be filled in. How much depends on settings. |
Filter | This filter allows you to adjust groups of like elevations globally. In other words, terrain heights are divided into discretely modifiable groups, from lowest elevation to highest elevation. |
Thermal Erosion | This is a very aggressive eroding filter. You can rapidly remove materials from sloped areas of your terrain with this. The official docs say this uses a thermal erosion algorithm. |
Hydraulic Erosion | This a very weak eroding filter. The official docs say this uses a hydraulic erosion algorithm. |
Blend | This cool filter allows you to combine two existing operations via a set of mathematical operations. We'll play with this later. |
Operations are applied to the Terrain in the order they appear in the list, top to bottom. This means, if you apply two generators in a row, the second generator's results are the only ones that will be seen. More interestingly, you can apply filters in different orders for different results. The best way to learn about these operations is to experiment. That said, I'll give a quick run-down of the various operations' settings and the set you loose.
Table 4.32.
![]() |
|
Table 4.33.
![]() |
|
Tips:
If, your height range is large (say 350+), you will tend to have jagged hills, regardless of other settings.
With a default height range (300), Very High Detail will tend to create knife edged hills, even for low Hill Frequencies (8).
Table 4.34.
![]() |
|
Table 4.35.
![]() |
|
Table 4.36.
![]() |
|
As mentioned before, this generator builds the terrain using a combination of sinusoidal values and noise. If you want to see the underlying structure, set the seed to 0. Now, poking around with the control points will produce something like this:

Now set the number of control points to 3. Notice that the overall structure is still recognizable:
Table 4.38.
![]() |
|
Table 4.42.
![]() |
|
You can make significant and rapid changes to your terrain with this filter. Understanding how this works can be kind of tricky. At first, you might think that the ranges will be based on the min-height and height-range set in the General settings. This may or may not be true. If your current terrain extends to the lowest and highest points, then, Yes. However lets say your min-height is set to 0, but your lowest elevation is 100. Also, height-range is set to 200, but your highest elevation is only 200 (i.e. half the range). Then, the elevation bands are determined as follows:
Lowest Elevation: 100 meters
Highest Elevation: 200 meters
Control Points: 5
Width of each elevation band: (200-100)/5 == 20 meters
Resultant Elevation Bands (left-to-right in scale):
Table 4.43.
Control Point 1 100..119 meters | Control Point 2 120..139 meters | Control Point 3 140..159 meters | Control Point 4 160..179 meters | Control Point 5 180..200 meters |
Moving a control point is like grabbing all elevation in that band and raising or lowering it by a relative amount. Additionally, I believe that there is a push-pull relationship between bands of elevation. That is, by modifying one band, you also (slightly) modify all other elevation bands. Below are some sample changes so you can judge for yourself. Whatever the case, this tool rapidly changes the face of your terrain, so caution is the word.
Table 4.44.
![]() | Note: By default, the scale comes up looking like this (only it has seven control points). If left like this, NO CHANGES will be made. |
![]() | Here we raise the low elevation band as much as possible. Remembering that lighter values are higher elevation, notice that some previously dark reasons are now very light. Also, notice that overall, the total elevation of the map seems to have been lowered. Interesting. |
![]() | Here we lower the high elevation band as much as possible. Lo and behold, previously high areas are now completely dark, but what else has happened? The reset of the map seems to have raised. Even more curious. |
![]() | In this example, we've lowered all bands except for the middle band. As can be easily seen, we've basically said, make the middle band the highest range. |
Table 4.45.
![]() |
|
Tips:
For multiple iterations, I believe that if a slope falls below the min-erosion-slope, erosion no longer affects that area.
The material loss value is a bit misleading. 100% loss doesn't mean, set this value to lowest height. Instead it means something like, set this value to lowest nearby height.
This is a very vigorous filter, quickly removing large quantities of material.
Table 4.46.
![]() |
|
Tips:
This is one of those cases, where having access to the code shortens research drastically. The scale (filter) is passed in to the erosion method, but not used. So, whatever changes you make to it are going to be ignored. Since control points are part of the same mechanism, you can ignore these too. The only thing you need to modify is iterations.
This sweet little filter seems to fill one duty. Erode the channels, or low points, between steep hills. I'm sure it erodes wide flat basins too, but the effects are not as noticeable. You've got to admire the person who coded this. To write an algorithm that consistently targets a specific terrain feature for erosion? Brilliant!
Table 4.47.
![]() | The parameters to this filter, modify the blending equation above the Apply button. Easy as pie. Just remember, Source A is always the operation prior to this blend. (Yes, it can be a blend of a blend of a.well you get the idea). I've reproduced sweet little experiment originally done by Zear in his guide below to show what this filter is capable of. |
I have purposely deferred a discussion of loading your own bitmaps till the end. Of all the questions I see asked over and over in the forums, one of the most repeated is, How do I load a bitmap as my terrain?. As you would imagine, doing this is relatively simple. Unfortunately, as checked in, the HEAD (and 1_2) versions of Torque are not set up to do this. You need to make the following change:
Locate the directory: example\common\editor
create a new sub-directory named: heightScripts (may be all lowercase for Unix)
From now on, if you want to use a bitmap for your terrain, just copy it to example\common\editor\ heightScripts before starting the SDK and it will be available. I say before because the SDK builds a list of the files in this directory when it loads, so adds that happen subsequently to starting the SDK will not be seen.
Please note, although loading a bitmap seems to imply a BMP you can only use PNG files.