hog :: trainz terrain generator

user's manual

requirements.

In order to make the best use out of the terrain generator, you'll need following additional software and data files:

setup.

The terrain generator can be put in any directory. Make sure there's enough free space for output files -- at least a hundred MBs is a safe margin.

If you're planning to use generator's texturing ability, unpack the content of archive textures.zip located in "presets" sub-folder of the terrain generator, to "... \ World \ Custom \ ground" sub-folder in the root directory of Trainz.

workflow.

Note: the steps marked bluish-grey are optional. You should follow them only if you intend to use DLG/TIGER data for your route. If that's not the case, just skip them.
  1. Launch MICRODEM.

  2. Load the DEM data you want to use as source for Trainz layout.[if necessary, for detailed informations how to manipulate DEM data consult MICRODEM help file]

  3. For most accurate results:

  4. Use Analyze > Elevation histograms command. In the "Histogram statistics" window find line describing DEM data "Range". Write down both "Range" numbers.

    Range can be defined in many different units, depending on the source DEM. The unit used [metres, feet, decimeters etc] can be found from other histogram windows. In order to get accurate results from the terrain generator, you'll have to convert Range values to metres.

    feet -> metres: multiply feet by 0.3048
    decims -> metres: divide decims by 10

  5. Click right mouse button on generated image and select Copy to clipboard.

  6. Launch your graphics program and paste data from the clipboard into a new image.

  7. Go back to MICRODEM. Use Overlay > Vector Outlines to add DLG/TIGER data to your terrain image.

    Clicking right mouse button on generated image and selecting TIGER options will invoke window with options you can use to adjust what vector data is displayed, and how. Also, you can remove information about elevation of terrain by selecting Modify > Display Parameter > Blank.

  8. Click right mouse button on generated image and select Copy to clipboard.

  9. Paste data from the clipboard as new layer.

  10. In the graphics program, crop the image to right size -- this is 72×72 pixels per board, plus 2 pixels wide edge around the whole rectangular area you want to generate.

    E.g.: for 10×8 boards area, the image should be (10*72)+4 × (8*72)+4 pixels, i.e. 724×580 pixels big.

  11. Cut the vector data layer from the image, and paste it into a separate image.

  12. Save your cropped terrain elevation picture to the folder where you have the terrain generator installed, as uncompressed 24-bit .tga image.

  13. Save the vector data image to the same folder.

  14. Launch Trainz. Create a blank layout and save it under any name you find suitable.

    If possible, try to not use spaces in the layout name.

  15. Open the shell [MS-DOS Prompt] window. Navigate to the folder where you have installed the terrain generator. Enter following command:

    HOG source.tga min_range max_range layout

    To utilize your vector data image, use the following command instead:

    HOG -Mmap.tga source.tga min_range max_range layout

  16. Copy created .gnd file to the folder with your blank route, overwriting the .gnd file which is already there.

    Typically, it's the "... \ World \ Custom \ Maps \ name_of_your_blank_layout" sub-folder in the root directory of Trainz.

Your new layout is now ready to be loaded in Surveyor and edited further.

advanced functions.

Aside from simple generation of blank .gnd files, the terrain generator is also capable of painting its creations with predefined textures. This ability can be used in a number of ways:

While painting, the textures can be randomized -- automatically scaled and rotated to remove the 'tiling' appearance which commonly occurs on hand-painted layouts.

The painting function is invoked with following switch:

-Pguide.tga for painting with randomized textures or:

-pguide.tga for painting without trying to mix the textures.[this option is slightly faster, and can be used when 'painting' vector data, e.g.]

The image used as painting guide should have the same dimensions as the primary terrain elevation picture. While creating terrain, the generator will scan each pixel of the image, and look up the closest matching colour in supplied file textures.txt located in terrain generator directory. It'll then paint corresponding part of terrain with texture linked to that particular colour.

The format of textures.txt is as follows:

userid:kuid red,green,blue
userid:kuid red,green,blue
userid:kuid red,green,blue
...
userid:kuid red,green,blue

For example, entry -12:356 0,255,0 means the parts of terrain corresponding with areas painted pure green [0,255,0] in the painting guide picture, should be textured with default Trainz texture Gravel_1. [the KUID for this particular texture is -12:356 and can be found in Trainz Content Creation Procedures]

A special case is entry beginning with -1:-1 It tells the terrain generator to leave parts of layout painted with this colour untextured.

The default file textures.txt supplied with the terrain generator uses special set of textures prepared to match closely satellite images of Earth. For best results when using those, try the following:

When trying to overlay vector data on the layout, it's better to replace default textures.txt file with hog_tiger.txt located in "presets" sub-folder.[remember to rename it to textures.txt] This particular file is configured to match default colours MICRODEM uses to draw TIGER data, and to leave white areas untextured. [if you use Modify > Display Parameter > Blank command in MICRODEM, it'll display only vector data on white background]

additional notes.

  1. TIGER roads: the roads in TIGER data files are broken up into 7 levels of importance.