Difference between revisions of "Terrain Generation From Geographical Data"

From AHWiki
Jump to: navigation, search
(→‎Modifying the Sources)
m (Added category)
Line 153: Line 153:
  
 
<references />
 
<references />
 +
 +
 +
[[Category:Terrain_Editor]]

Revision as of 02:33, 9 December 2013

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 (.elv file)
  2. Accurate high resolution shorelines and rivers (waterd.bmp/waterc.bmp)
  3. Appropriated ground cover (tiles) according to the geographical data set, i.e. farm, forest, dessert areas, etc. (gndtype.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:

  • makeahmap.exe - the main program
  • config.ini - configuration file that defines all the terrain settings, by default pointing to the Battle of Britain area.

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: GTOPO30[4], SRTM30 or SRTM3[5].

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.elv and gndtype.elv to the "ahiiterr\mymap" folder where the TE is installed.
  4. Copy mymap.bmp to the "ahiiterr\mymap\texsrc" folder, create one if it does not exit
  5. Copy waterd.bmp and waterc.bmp to the "ahiiterr\mymap\imptexpt" folder, create one if it does not exist
  6. Open the Terrain Editor
  7. Go to File->Import Water Bitmap
  8. Go to File->Save - you would get a message that water boundary was added.
  9. Review the result. If needed adjust the config.ini and go to step 1 again.

Handling Rivers

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.

Thus, it is recommended:

  1. 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
  2. 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:

...
- Pass 1: Collecting required water slope corrections
  ...
  -- Found 10 rivers causing elevation drops above 500 feet.

...
- Fixing river and lake slopes... completeed
  ...
  Total alt. corrections: 550 feet


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

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

The SRTM3 has much higher resolution but it does not cover areas above S60 (for example areas in Canada, Murmansk etc). Also taking in consideration the fact that the AH terrain elevation resolution is 0.5 mile = 800m, the 30 arc-second resolution should fit most of needs especially for maps with scale above 1.0. Another limitation of SRTM3 that is needs more disk space and more files to download.

So it is up to you to decide what do you want.

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.


Water Depth, Color and Underwater Textures

You can create a smooth water depth changes according to the distance from the shores. You can adjust them with depth_range[] options. You also need to change ground_type[] option for such a boundary layers so that the relevant underwater texture would be shown.

Note: using too moderate water depth changes (i.e. showing underwater texture for a long distance from the shore) may significantly increase waterd generation times. Recommended values are not more than 1.0 mile.

You can also change the water color for lakes and rivers. When you change both water color and water depth, make sure that the underwater textures have appropriate colors as well.

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 distributed with its sources.

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

  • Up-to-date C++11 enabled compiler. The distributed executable is built using GCC 4.6.
  • Following libraries: zlib, libtiff and libcurl

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

Notes