L3DT users' wiki
Large 3D terrain generator

 

Importing maps into TGEA

Written by: Trollfiddler.

Exporting from L3DT

Exporting the heightfield

The TGEA import interface loads terrain from 16-bit unsigned RAW files. To get such a file from L3DT, do the following:

  1. Select 'View→Show map→Heightfield'.
  2. Select 'File→Export→Active map' (opens the export wizard).
  3. Select 'RAW' from the 'File format' drop-down list.
  4. Enable the 'resize for export' check-box, and set the size to a power-of-two-plus-one (e.g. 1025×1025).
  5. Click on the 'browse' button to set the filename, and click 'OK'.

Exporting the texture

  1. Select 'View→Show map→Texture Map'.
  2. Select 'File→Export→Active map' (opens the export wizard).
  3. Select 'JPEG' from the 'File format' drop-down list.
  4. Click on the 'browse' button to set the filename and directory
  5. Make sure the texture size is a power of 2 (1024, 2048, 4096 etc.)
  6. Click 'OK'.

Importing into TGEA

There is documentation on the Torque Developers Network at Garage Games which explains the Atlas terrain and texture import commands (generateChunkFileFromRaw16 and generateTQT respectively). These are also discussed on the GG web site in many forum threads. As an alternative to these commands you can use the slightly less confusing Atlas import GUI (which is available from the resources section at GG). There are some details required for either or both methods of import. These can be gathered from L3DT and are explained below.

HeightRange

This is required for the terrain mesh import if you use the GUI. You can check the height range in L3DT by selecting the Operations->Heightfield->change vert scale option. The “altitude range” is shown in the middle of the pop-up box, and that's the value you should enter for the “height range” in the GUI. Just cancel out from change_vert_scale when you've noted the altitude range.

Square size

This is required for the terrain mesh import in both the GUI and console command. When you create a new map in L3DT you specify the “heightfield resolution”. This is the value that you should enter as the “square size” in the import GUI or in the console command. You can find it by going to the menu option settings/current_project. When the pop-up box appears, expand “HF” in the tree. The value you require is shown as the “HorizScale” in the expanded tree.

Vertical scale

This is required for the terrain mesh import in the console command only. This can be found by starting the L3DT viewer (L3DTVi2) and opening your terrain. Select the menu option view/Map_group_tree_view. When the pop-up box appears, select the heightfield in the tree at the top. The vertical scale will be displayed in the list of details in the lower pane.

A quicker rough rule of thumb that has been recommended on the GG web site, is to divide the HORIZONTAL scale by 65536 to get the vertical scale.

Leaf Size

This is required for the texture import using the console command or GUI. You only need to worry about leaf-size calculation if you are using the built-in console command in TGEA (generateTQT). If you are using the GUI then you do not need to know how to calculate the leafsize. The GUI has a button that will calculate it for you.

However, if you are using the console command and not the GUI then the formula for calculating LeafSize is:

LeafSize = ImageSize / 2^(TreeDepth - 1)

Where ImageSize is the size of your texture, and TreeDepth is the treedepth that you specified for your terrain mesh when you imported it into TGEA.

So, for example, if we have an image size of 2048 and a treedepth of 6:

LeafSize = 2048 / 2^(6-1)
       = 2048 / (2^5)
       = 2048 / 32
       = 64

Please note: Tree depth and error metrics are beyond the scope of this tutorial as they are related to the rendering engine and not L3DT. Besides which, they are largely a matter of guesswork and experimentation to see which values work best for your particular scenario. See the Garage Games web site for more information on these subjects.

 
tutorials/torque/import.txt · Last modified: 2017/08/31 05:28 (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