L3DT users' wiki
Large 3D terrain generator

 

Making terrain for Torque 3D

Author Aaron
Date 15th of November 2009
Updated 17th of January 2014
PDF t3d_terrain_tutorial.pdf [903kB]

This tutorial will walk you through all the steps required to make terrain for Torque 3D.

1. Before we start

Required L3DT version

To make T3D terrain you should be using L3DT version 11.11 or later. To check that you have the correct version of L3DT, select the 'Help→About' menu item. This will show the about box, which includes the version number.

If you do not have the required version (or a later version thereof), please see this forum thread for instructions on how to download the update.

2. Generating the map

This section will briefly describe the terrain generation process, but won't explain all of the settings or the map editing tools and options. If you'd like to know how to get the terrain to look exactly how you’d like it, please refer to the other tutorials. I recommend in particular the fjord tutorial, as this explains how to use the design map to 'design' your terrain map. The roads tutorial may also be of interest to users who want to customise their terrain. Finally, if you want to know more about any of the windows or settings encountered during this section, I recommend you consult L3DT's user guide.

Generating the heightmap

Anyway, to create your terrain, open L3DT and select 'File→New project' in the menu. This will open the select project type wizard, shown below:

The 'select project type' wizard.

Select 'Designable map' and click 'next »'. This will open the heightfield size wizard, shown below:

The 'heightfield size' wizard.

Here you may choose the size of your heightfield. For starters I recommend you make a 1024×1024 pixel heightmap.

Heightmaps larger than 2048×2048 are discouraged for Torque 3D, as larger maps require very large texture images, which may not be supported by all graphics cards.

For FPS-resolution terrain, you must also set the horizontal scale to a small value, such as 1 (the units are metres). This is the horizontal spacing between terrain vertices, and basically sets the terrain geometry detail. Small horizontal scale values will give more detailed terrain, but will also mean that your map will cover a smaller area. Large horizontal scale values will cover larger areas without more polygons, but will be less detailed.

Your settings should now look as below:

The' heightfield size' wizard, with recommended settings.

Click 'next »' to proceed to the design map size wizard, shown below:

The 'design map size' wizard.

Here you may choose the resolution of the 'design map ' that L3DT will use to generate the heightfield. For the purposes of this demonstration, I recommend you keep the default value of 64 and click 'next »' to proceed to the design map parameters wizard, shown below:

The 'design map parameters' wizard.

To make a good map for first person games, I'm going to make the terrain mostly land (average altitude = 90% land), make the terrain fairly flat (altitude range = 30%), and not too noisy (feature scale = 60% vast, and noise strength = 35%). If you'd like to play with these settings, please feel free. The meanings of all the design map parameters are explained on the Design map parameters and their effects page in the official documentation.

After you've set the design map parameters, Click 'next »' to proceed to the calculation queue wizard, shown below:

The calculation queue wizard.

Enable both the 'design map' and 'heightfield' options, and press 'OK'. L3DT will then generate the heightfield for you, and render it in the 2D display:

The heightfield shown in the 2D display.

Viewing and editing the heightfield in 3D

If you wish to view or edit the terrain in 3D, you may do so by pressing the '3-D' button on the toolbar. This will open the 'Sapphire' 3D renderer for L3DT, which should look something like this:

The heightfield shown in the 3D display.

The instructions for using Sapphire are given here, including instructions for using the 3D heightfield editor tools. Once you have finished your viewing or editing your heightmap, close the Sapphire window.

Generating other map layers

The next step is to generate the other maps in the project, such as the normals, light and texture maps. To do this, select the 'calc »' toolbar button in L3DT. This will re-open the calculation queue wizard. In this wizard, enable the 'Water map' option and every option below it, like so:

The calculation queue wizard, again.

Click 'next »' to proceed to the water map wizard pane. Whilst T3D does support multiple water bodies at different levels using 'water blocks', it is rather difficult to set up and get right. Thus, it is recommended that you disable the 'auto flood seas' and 'auto flood lakes' options, and instead enable the 'flood water plane' options (as shown below). This will create one water level for your map.

The water map flood wizard.

Click 'next »' to proceed to the water table wizard, shown below:

The water table wizard.

You don't need to change these settings, so click 'next »' to proceed to the attributes map wizard (see below).

The attributes map wizard.

The 'attributes map' is the mask that L3DT uses to generate textures and alpha maps. Thus, to create highly-detailed textures it is recommended that you create a high-resolution attributes map. To do this, enable the 'make high-res attributes map' option, and set the 'AM/HF' ratio to 4. Your settings should look as shown above.

Click 'next »' to proceed to the terrain normals wizard (see below).

The terrain normals wizard.

The settings from the previous wizard are carried forwards, so you won't have to set the map resolutions or tile sizes. Your settings should now look as shown above.

Click 'next »' to proceed to the light mapping wizard (see below).

The light map wizard.

You don't need to change these settings, so click 'next »' to proceed to the second page of the light mapping wizard (see below).

The light map wizard (page 2).

Again, the settings are carried forwards. Your settings should now look as shown above.

Click 'next »' to proceed to the Light/water effects wizard (see below).

The light map water effects wizard.

You don't need to change these settings, so click 'next »' to proceed to the texture settings wizard (see below).

The 'texture settings' wizard.

Yet again, the settings are carried forwards, so you don't need to change them. Your settings should look as shown above.

Click 'OK', and L3DT will calculate several maps, and when done show the texture map in the 2D view:

The texture map, in the 2D display.

3D view

To view the complete terrain in 3D, press the '3-D' button on the toolbar. This will again open the Sapphire 3D renderer, which should look something like this:

The textured terrain, in the 3D display. The textured terrain, in the 3D display .

Alpha maps

The final step in map generation is to calculate the alpha map masks for T3D. To do this, select the 'Operations→Alpha maps→Generate maps' menu option, shown below:

The alpha map menu option.

This will open the combine alpha layers wizard, shown below.

The 'combine alpha layers' wizard.

T3D supports up to 254 alpha layers, but you may wish to use fewer layers due to hardware limitations. This wizard allows you to reduce the number of alpha layers to a more manageable number (say, 8) by combining some of them. For a guide to combining alpha layers, please refer to the alpha map user guide.

Once you are done playing with alpha layers, click 'Next »' to proceed to the alpha map options wizard, shown below.

The 'alpha map options' wizard.

This wizard pane wizard pane allows you to set various parameters that affect the size and format of the alpha maps. In T3D, the alpha map must be the same size as the heightmap. This means that you must leave the make high-res alpha maps option unchecked, with the res. ratio value set to 1, as shown above.

When you click 'OK', L3DT will generate the alpha maps, and show you something like this:

The alpha maps, as displayed in L3DT.

The map is now complete. Please press the 'save' button to save your project.

Seriously, save your map now.

3. Exporting to T3D terrain file

To export your map to T3D, select the menu option at 'File→Export→Torque T3D→Export Torque TER (v7)', as shown below:

The T3D export menu option.

This will open the Export Torque TER window, shown below:

The 'Export Torque TER' window.

Game folder

If this is the first time you have used the T3D exporter, you should first tell L3DT where your T3D game is located. To do this, press the browse ('…') button after the game folder text field, then browse to the 'game' folder within your T3D project directory, and press OK, like so:

Browsing for the game folder.

TER file name

To set the name of the actual terrain file to be exported, press the browse ('…') button after the TER file name text field, then browse to the 'game\art\terrains' folder in your T3D project directory, and enter a filename (e.g. 'test.ter').

The output TER file must be inside the T3D project game folder, or a subdirectory thereof. Otherwise, T3D won't be able to 'see' the files.

Other settings in export window

The other options in the Export Torque TER window, such as texture path, are not important for the purposes of this tutorial, but are explained in the plugin user guide.

Material manager

After you click 'OK' in the exporter window, L3DT will open the T3D Material Manager window, shown below:

The 'T3D Material Manager' window.

In this window you may set some of the parameters for how the materials will appear in T3D, such as the filenames of the diffuse and detail maps, and their various scale settings. Please note that you don't have to get all the settings right in this window; you can tweak them all later from within T3D. The default settings are safe to use, so you can just click 'OK'.

To avoid name collisions in your materials.cs file, you may rename materials by double-clicking on their name in the material list in the left-hand side of the window.

After you click 'OK'

After you click OK in the Export Torque TER and T3D Material Manager windows, the L3DTio_TorqueTER plugin will do the following:

  • Export the TER file.
  • Export the texture map as a DDS image alongside the TER file.
  • Export a stub mission file into the 'game\art\levels' folder, which includes the terrain and water blocks, sky, and a player spawn point.
  • Merge the new materials into the 'game\art\terrain\materials.cs' file. You will be prompted to confirm the overwriting of any conflicting materials.
  • Export all texture images to the 'game\art\terrain\[TER name] textures\' folder, or whichever directory you set in the 'texture path' field in the Export Torque TER window.

4. The terrain in T3D

When loaded in T3D, the terrain should look something like this:

The terrain rendered in T3D.

The terrain rendered in T3D.

5. The end

That's it! If you find any problems when following this tutorial, or would like to ask questions or make suggestions, please post your comment/question in this forum thread.

 
tutorials/torque/t3d/aaron.txt · Last modified: 2017/08/31 04:55 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki