Difference between revisions of "Terrain Generation From Geographical Data"

From AHWiki
Jump to: navigation, search
(→‎Advanced Usage)
(→‎Handling Rivers)
Line 71: Line 71:
 
# Review the result. If needed adjust the config.ini  and go to step 1 again.
 
# Review the result. If needed adjust the config.ini  and go to step 1 again.
  
−
===Handling Rivers===
+
===Handling Water Bodies===
  
−
By default, MakeAHMap would create all known rivers and water channels. Sometimes, you may found too many rivers and channels you don't actually want. More than that, the program would automatically adjust the terrain elevations such the rivers would have legal slopes of at most 120 feet per mile. In real life the slopes may be much higher and such a correction would create deep canyons in the terrain you do not really want.
+
By default, MakeAHMap would create all lakes and major rivers. AH3 requires that all water bodies would be placed at sea level, so the terrain altitudes are adjusted to preserve local gradients rather
 +
than absolute altitudes.
  
−
Thus, it is recommended:
 
  
−
# Define the maximal river level you want to render - option river_level in config.ini. Major rivers have low level index and small channels and rivers have high ones. So you can set the minimal required level. Typical values are 3 to 6. Depending on your needs
+
You can limit the maximal water body altitude by settting water_alt_limit parameter in config.ini.
−
# Provide a maximal allowed correction in feet - the river_correction_limit option. For example, if you set the value to 500 feet, then all rivers that need more than 500 feet of elevation corrections to fit the TE requirements, would be removed from the map. It is your choice - do you prefer to have more water and pay for it with deeper canyons, or eliminate them to keep the altitudes more accurate.  
 
  
−
There are several things that would help you to optimize the parameters selection. One of them is program output:
 
  
−
<pre>
 
−
...
 
−
- Pass 1: Collecting required water slope corrections
 
−
  ...
 
−
  -- Found 10 rivers causing elevation drops above 500 feet.
 
  
−
...
+
You can find the created water bodies in output/water_bodies.pgm and altitude adjustments in output/sea_level.pgm.
−
- Fixing river and lake slopes... completeed
 
−
  ...
 
−
  Total alt. corrections: 550 feet
 
−
</pre>
 
−
 
 
−
 
 
−
Another one is the final maximal altitude adjustment map. In the output\water_altitude_correction.bmp you'll see the areas affected by the altitude correction. Black represents no correction and white (255,255,255) maximal correction. In the case of thee example above, the white would be correction of 550 feet.
 
−
 
 
−
And finally, you can find a map of removed river sections that was required to prevent too high corrections: output\removed_rivers.bmp
 
−
 
 
−
Using all of the above, you'll be able to define the options that would suit your needs.
 
  
 
==Advanced Usage==
 
==Advanced Usage==

Revision as of 15:44, 15 June 2016

Introduction

Special events and historical arenas require geographically accurate terrains. Creating such terrains using TE itself or by using various graphical programs can be hard process. A special tool, created by Artyom Beilis (a.k.a. Artik), called MakeAHMap[1], significantly simplifies the process making many parts of this process automatically

The tool generates following output using geographical data:

  1. Accurate terrain elevations (.raw file)
  2. Accurate high resolution shorelines and rivers
  3. Appropriated ground cover (tiles) according to the geographical data set, i.e. farm, forest, dessert areas, etc. (splattype.bmp)
  4. Nice looking clipboard map.

Installation

Basics Installation

Download the latest zip file from http://cppcms.com/files/makeahmap/, extract it in any suitable location. Note: you need about 1GB of free space on the disk for the geographical data (which would be downloaded automatically on demand) - depending on your interests.

In the extracted folder you would find:

  • config.ini - configuration file that defines all the terrain settings, by default pointing to the Battle of Britain area.
  • makeahmap.exe - the main program
  • makeahmap_cpu.exe - the same program but without use of OpenCL/GPU computations - in case your GPU does not support one.

You can just double click the makeahmap.exe. At the first time your run the program, the required data would be downloaded. There are 3 types of data needed:

  1. GlobCover database[2] - the mapping of ground types - single tif file of 375MB - the largest file.
  2. GSHHS[3] - shoreline and river database.
  3. Digital Elevation Database (DEM) - one of the three: SRTM30 or SRTM3[4].

While the entire data-set for the first two would be downloaded, only the relevant DEM files are downloaded on demand. The generated files would be placed into output directory. Once the program completes you'll need to press an Enter to close the window.

Working Cycle

The basic working cycle with MakeAHMap program consists of 3 basic steps:

  1. Ajdusting settings in config.ini file
  2. Running the makeahmap.exe, watching the output for interesting details
  3. Using the generated files in TE


Using the MakeAHMap

Most of the information about various configuration options can be found in config.ini itself. So refer to this file for detailed instructions.

Basic Configuration

You need to specify, the TE map name, the size of the map, the geographical coordinates of the center of the area you are interested and and the map scale:

  • map_size - the size of the map in miles, one of 512, 256, 128 and 64
  • map_name - the name of the AH map you selected
  • lat, lon - the latitude and longitude of the central point of the terrain you are creating
  • scale - the map scale, 1.0 for 1:1 maps 2.0 for AH map being twice smaller than real one, etc.

Once you configured them run makeahmap.exe, see if the map covers appropriate areas and continue.

Importing the files into Terrain Editor

Once the output is generated (files in output directory), you can import the data into TE. For this tutorial we would call the terrain "mymap". Replace it with the name you are actually going to use,

If the terrain does not exist yet, create an empty one using appropriate size and save it.

  1. Exit the Terrain Editor
  2. Run the makeahmap.exe, watch it completes the work without errors.
  3. Copy mymap.bmp to the "ah3terr\mymap\texsrc" folder, create one if it does not exit
  4. Start TE
  5. Import altitude map (mymap.raw) File->Import Signed Height Map
  6. Import splattype.bmp File -> Import Splat map
  7. Save
  8. Review the result. If needed adjust the config.ini and go to step 1 again.

Handling Water Bodies

By default, MakeAHMap would create all lakes and major rivers. AH3 requires that all water bodies would be placed at sea level, so the terrain altitudes are adjusted to preserve local gradients rather than absolute altitudes.


You can limit the maximal water body altitude by settting water_alt_limit parameter in config.ini.


You can find the created water bodies in output/water_bodies.pgm and altitude adjustments in output/sea_level.pgm.

Advanced Usage

Most of the information can be found in config.ini. In this section we would mostly review general useful options.

Selecting Digital Elevation Model Database

MakeAHMap supports 3 databases with 2 different resolutions:

  1. GTOPO30 and SRTM30 with 30 arc-seconds resolution: 926m/1013yards/0.58mile
  2. SRTM3 with 3 arc-seconds resolution: 93m/101yars

Note: currently GTOPO30 sources are offline and can't be downloaded

The SRTM3 has much higher resolution but it does not cover areas above N60 (for example areas in Canada, Murmansk etc). Another limitation of SRTM3 that is needs more disk space and more files to download.

Adjusting Ground Types

There is a predefined table of mapping of GlobCover database ground types to the AH tiles. There may be a situation were the mapping may be wrong or better adjusted. You can use type_mapping option to specify a csv file that contains such mapping. The default groundmapping.csv contains default table. You can alter it for your needs.


River Width

Unfortunately the river database does not contain an information about river width. There is some predefined mapping of river level to river width. You can adjust it using river_width family of options. It may be useful if you want wider or narrower rivers for your map.

Clipboard Map

You can specify the colors for various parts of clipboard maps, change the way the altitude is displayed on the map - via shading or via color changes. The strength of the visual effect can be adjusted as well.

The default map grid is stored in the images directory. You can change them as well to customize the map grids.

Modifying the Program

MakeAHMap is Open Source software released under MIT license. It is hosted on github: https://github.com/artyom-beilis/makeahmap

If you want to make modification in the program you will need:

  • Mingw G++ >= 4.9.
  • Following libraries: zlib, libtiff and libcurl, optionally but recommended OpenCL SDK

It is now known if MSVC is able to build makeahmap.

Notes