Torque Game EngineTorque Game Engine Documentation
Version 1.3.x

Terrain Terraform Editor (Terraformer)

Starting The Terraformer

  1. Start the Mission Editor by pressing F11.
  2. Start the Terraformer by pressing F7.

The Terraformer (An Overview)

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:

  1. Description of Terraformer windows.
  2. Summary of all operations.
  3. Run-down on how operations are applied.
  4. Brief descriptions of the individual operation interfaces.
  5. A list of important Terraformer factoids.

The Terraformer Preview Window

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. 

  1. Center Marker - There is a faint white + in the preview window. This marks the center of the map. Every time you apply Terraformer operations, this is where the camera will be moved to.
  2. FOV Marker - There is a red V which is always in the center of the window. This shows your current Field Of View. i.e. area in your view relative to the map.
  3. Boundary Marks - In addition to the center marker, there are faint horizontal and vertical lines, representing the boundaries of the current heightmap.
  4. Heightmap Image - Although it may not be obvious at first, the image in the preview window is a translation of the heightmap. The funky coloring can be interpreted very easily. The darker an area is, the lower it is. Likewise, the lighter an area is, the higher it is.

Terraformer Operations Tree

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).

Table 4.28. 

Terraformer Operations Tree

Terraformer Operations Pull-down

Terraformer 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. 

BaseSummary

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. 

GeneratorsSummary

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. 

FilterSummary

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.

How Operations Are Applied

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.

Operations Settings

General

Table 4.32. 

  • Min Terrain Height (0..500) - Defines the lowest possible point in the map. Tools and generators will not be allowed to create terrain elevations lower than this.

  • Height Range (5..500) - Defines the maximum difference between min-height and max-height. Therefore, max elevation == min height + range.

  • Water Level - Is a global value used as input to subsequent filters. It does not place water.

  • Center on Camera - Sets the map origin to the current location of the camera.

fBm Fractal

Table 4.33. 

  • Hill Frequency (1..24) - Indirectly determines number of hills. Higher values create more hills.

  • Roughness (0.0..1.0) - Determines roundness of hills. Lower values tend to create more rounded hills, while higher values create taller and more pointy hills. i.e. steeper slopes

  • Detail (Very Low..Very High) - In terms of visual results, higher values produce more jagged peaks (knife edges).

  • Random Seed - Seed that feeds into random portion of generator. Using the same value for subsequent generations produces same sequence of numbers.

  • New Seed - Creates a new seed.

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).

Rigid MultiFractal

Table 4.34. 

  • Hill Frequency (1..24) - Indirectly determines number of hills. Higher values create more hills.

  • Roughness (0.0..1.0) - Determines roundness of hills. Lower values tend to create more rounded hills, while higher values create taller and more pointy hills. i.e. steeper slopes

  • Detail (Very Low..Very High) - In terms of visual results, higher values produce more jagged peaks (knife edges).

  • Random Seed - Seed that feeds into random portion of generator. Using the same value for subsequent generations produces same sequence of numbers.

  • New Seed - Creates a new seed.

Canyon Fractal

Table 4.35. 

  • Canyon Frequency (4..10) - Number of canyons to produce.

  • Chaos (0.0..1.0) - A value of zero will produce very artificial looking and straight canyons. A value of one will produce squirrelly features, almost unrecognizable as canyons.

  • Random Seed - Seed that feeds into random portion of generator. Using the same value for subsequent generations produces same sequence of numbers.

  • New Seed - Creates a new seed.

Sinus

Table 4.36. 

  • Scale (on..off)- In this instance, the scale doesn't provide quite appropriate feedback. Although it implies there are ranges of values for each control point, values are either on or off. Dragging a control point to the bottom turns it off. Any other vertical position is on.

  • Random Seed - Seed that feeds into random portion of generator. Using the same value for subsequent generations produces same sequence of numbers.

  • Control Points - Controls number of points on scale. (Remember, this has a bug. Type the values in instead of using the up-down buttons). More control points mean more detail. i.e. Higher levels of sub-division and iteration.

  • New Seed - Creates a new seed.

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.37. 

 

Turbulence

Table 4.38. 

  • Turbulence Factor (0..1.0) - Determines strength of action. Lower values mean less displacement and less variation in height. Higher values mean vigorous swirling and modifications to height.

  • Radius of Effect (1..40) - Determines filter size. I believe 1 equals a 3x3 filter, 2 equals a 4x4 filter, etc. up to a 42x42 filter.

Smoothing

Table 4.39. 

  • Iterations (0..40) - Determines number of smoothing passes to run.

  • Aggressiveness (0.0..1.0)- A relative factor, determining how much material to remove.

Smooth Water

Table 4.40. 

  • Iterations (0..40) - Determines number of smoothing passes to run.

  • Aggressiveness (0.0..1.0)- A relative factor, determining how much material to remove.

Smooth Ridges/Valleys

Table 4.41. 

  • Iterations (0..40) - Determines number of smoothing passes to run.

  • Aggressiveness (0.0..1.0)- A relative factor, determining how much material to remove.

Filter

Table 4.42. 

  • Scale - Each control point corresponds to a specific height (see below for calculation). Subsequent applications change these values.

  • Control Points - Determines now many elevation bands there are.

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.

Thermal Erosion

Table 4.45. 

  • Iterations (0..50) - Determines number of smoothing passes to run.

  • Min Erosion Slope (0.0..89.0 degrees) - Defines a cut-off slope value. What this is saying is, do not apply this erosion to slopes with a current value lower than that set here. i.e. if a slope has a 15 degree inclination and this value is set to 45, no changes will be made to that part of the map.

  • Material Loss (0..100) - What relative percentage of material should be removed per pass.

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.

Hydraulic Erosion

Table 4.46. 

  • Scale - No effect.

  • Iterations (0..50) - Determines number of erosion passes to run.

  • Control Points - No effect.

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!

Blend

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.

Table 4.48. 

Step 1

Min Height: 20

Height Range: 200

Water Level: 0

Step 2

Hill Frequency: 1

Roughness: 0.000

Detail: Very Low

Seed: 2080079341

Step 3

Hill Frequency: 24

Roughness: 0.000

Detail: Very High

Seed: 1588197333

Step 4

Factor: 0.358

Source B: 1

Operation: Max

Loading A Bitmap

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.