Difference between revisions of "Terrain Generation From Geographical Data"

From AHWiki
Jump to: navigation, search
(→‎Introduction)
(→‎Common Problems, Issues)
 
(10 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
In the extracted folder you would find:  
 
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.exe - the main program
−
* config.ini - configuration file that defines all the terrain settings, by default pointing to the Battle of Britain area.
+
* 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:
 
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:
Line 27: Line 28:
 
# GlobCover database<ref>http://en.wikipedia.org/wiki/GLOBCOVER</ref> - the mapping of ground types - single tif file of 375MB - the largest file.
 
# GlobCover database<ref>http://en.wikipedia.org/wiki/GLOBCOVER</ref> - the mapping of ground types - single tif file of 375MB - the largest file.
 
# GSHHS<ref>http://en.wikipedia.org/wiki/GSHHG</ref> - shoreline and river database.
 
# GSHHS<ref>http://en.wikipedia.org/wiki/GSHHG</ref> - shoreline and river database.
−
# Digital Elevation Database (DEM) - one of the three: GTOPO30<ref>http://en.wikipedia.org/wiki/GTOPO30</ref>, SRTM30 or SRTM3<ref>http://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Mission</ref>.
+
# Digital Elevation Database (DEM) - one of the three: SRTM30 or SRTM3<ref>http://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Mission</ref>.
  
 
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 <tt>Enter</tt> to close the window.
 
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 <tt>Enter</tt> to close the window.
Line 50: Line 51:
 
* map_size - the size of the map in miles, one of 512, 256, 128 and 64
 
* 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
 
* map_name - the name of the AH map you selected
 +
* tile_set - the tiles you are going to use in the Terrain editor - one of "europe", "pacific" or "mediterranean"
 
* lat, lon - the latitude and longitude of the central point of the terrain you are creating
 
* 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.
 
* 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.
 
Once you configured them run makeahmap.exe, see if the map covers appropriate areas and continue.
Line 63: Line 66:
 
# '''Exit the Terrain Editor'''
 
# '''Exit the Terrain Editor'''
 
# Run the makeahmap.exe, watch it completes the work without errors.
 
# Run the makeahmap.exe, watch it completes the work without errors.
−
# Copy mymap.elv and gndtype.elv to the "ahiiterr\mymap" folder where the TE is installed.
+
# Copy mymap.bmp to the "ah3terr\mymap\texsrc" folder, create one if it does not exit
−
# Copy mymap.bmp to the "ahiiterr\mymap\texsrc" folder, create one if it does not exit
+
# Start TE
−
# Copy waterd.bmp and waterc.bmp to the "ahiiterr\mymap\imptexpt" folder, create one if it does not exist
+
# Import altitude map (mymap.raw)  File->Import Signed Height Map
−
# Open the Terrain Editor
+
# Import splattype.bmp File -> Import Splat map
−
# Go to File->Import Water Bitmap
+
# Save
−
# Go to File->Save - you would get a message that water boundary was added.
 
 
# 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.
 
−
 
 
−
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
 
−
# 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>
+
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. In order to find a new optimal sea -level we stretch a 'rubber membrane' over known water bodies. Now we can gradually modify the elevations keeping all local terrain features.
−
- Pass 1: Collecting required water slope corrections
 
−
  ...
 
−
  -- Found 10 rivers causing elevation drops above 500 feet.
 
  
−
...
+
It works in both ways for positive and negative altitudes like Dead Sea.
−
- Fixing river and lake slopes... completeed
 
−
  ...
 
−
  Total alt. corrections: 550 feet
 
−
</pre>
 
  
 +
[[File:1t1wef.png|Altitude]]
  
−
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.
+
You can limit the maximal water body altitude by stetting water_alt_limit parameter in config.ini.
  
−
And finally, you can find a map of removed river sections that was required to prevent too high corrections: output\removed_rivers.bmp
+
You can find the created water bodies in output/water_bodies.pgm and altitude adjustments in output/sea_level.ppm. In certain cases due to altitude adjustments some terrain would move to below sea level and thus would be flatten - you can observe such an areas in the file output/flatten_terrain.pgm and than adjust parameters if the result does not fit the needs.
−
 
 
−
Using all of the above, you'll be able to define the options that would suit your needs.
 
  
 
==Advanced Usage==
 
==Advanced Usage==
Line 109: Line 94:
 
MakeAHMap supports 3 databases with 2 different resolutions:
 
MakeAHMap supports 3 databases with 2 different resolutions:
  
−
# GTOPO30 and SRTM30 with 30 arc-seconds resolution: 926m/1013yards/0.58mile
+
# GTOPO30 and SRTM30 with 30 arc-seconds resolution: 926m/1013yards/0.58mile  
 
# SRTM3 with 3 arc-seconds resolution: 93m/101yars
 
# 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.
+
Note: currently GTOPO30 sources are offline and can't be downloaded
  
−
So it is up to you to decide what do you want.
+
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===
 
===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.
+
There is a predefined table of mapping of GlobCover database ground types to the AH tiles located in the resources/groundmapping directory. There may be a situation were the mapping may be wrong or better adjusted. You can create your own versions of ground mapping, putting them in this directory under alternative names and using tile_set option accordingly
−
 
 
−
 
 
−
===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===
 
===River Width===
Line 141: Line 117:
 
===Modifying the Program===
 
===Modifying the Program===
  
−
MakeAHMap is Open Source software released under MIT license. It is distributed with its sources.
+
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:
 
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.
+
* Mingw G++ >= 4.9.
−
* Following libraries: zlib, libtiff and libcurl
+
* Following libraries: zlib, libtiff, optionally but recommended OpenCL SDK
  
 
It is now known if MSVC is able to build makeahmap.
 
It is now known if MSVC is able to build makeahmap.
 +
 +
==Common Problems, Issues==
 +
 +
; I run <tt>makeahmap.exe</tt> and I get and the programs fails to start reporting missing OpenCL.dll
 +
: It means that you don't have OpenCL drivers installed for your graphics card. Modern AMD, NVidia and Intel cards come with OpenCL support, so you may either update your drivers or use <tt>makeahmap_cpu.exe</tt> that does not use GPU for computation.
 +
; I run the program but get an error message - "Latitude above N60 is not supported with srtm3, please use srtm30"
 +
: It means that you try to use srtm3 data set (default) for territories that include latitude above N60 - and high resolution SRTM3 does not cover them, switch to srtm30 by setting value: <tt>dem=srtm30</tt>
 +
; I have created a map but I see only water?
 +
: Make sure you use correct sign for longitude, 170°W is -170.0 and 170°E is 170.0
 +
; How do I find the latitude and longitude of the area of interest?
 +
: Go to the google maps locate the area you need. Use measure distance feature of google maps (right click on the map - measure distance) to make sure you have proper map size and scale. Than right click on central point at the map of interest select  "What's there?" and you'll see the coordinates of the point at the bottom of the map
 +
; How to upgrade to newer version?
 +
: makeahmap since 1.9 includes a program called upgrade_makeahmap.exe - run it and you'll get up to date version, if you have older version, download upgrade_makeahmap.exe from the web site, put it into the same directory where makeahmap.exe resides and run it.
 +
:Alternatievly you can download the latest zip and copy all its contents to current installation overwriting existing files.
 +
; I have a problem not listed there, how do I get help?
 +
: Write a message on "Terrain Editor" AH forum describing your problem in as much details as possible, providing version of makeahmap you are using, your settings (lat/lon/scale etc), exact error you are getting (if any).
 +
; I have found a bug how do I report it?
 +
: You can open it at the GitHub issues tracker: https://github.com/artyom-beilis/makeahmap
  
 
==Notes==
 
==Notes==

Latest revision as of 16:03, 8 February 2017

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
  • tile_set - the tiles you are going to use in the Terrain editor - one of "europe", "pacific" or "mediterranean"
  • 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. In order to find a new optimal sea -level we stretch a 'rubber membrane' over known water bodies. Now we can gradually modify the elevations keeping all local terrain features.

It works in both ways for positive and negative altitudes like Dead Sea.

Altitude

You can limit the maximal water body altitude by stetting 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.ppm. In certain cases due to altitude adjustments some terrain would move to below sea level and thus would be flatten - you can observe such an areas in the file output/flatten_terrain.pgm and than adjust parameters if the result does not fit the 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

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 located in the resources/groundmapping directory. There may be a situation were the mapping may be wrong or better adjusted. You can create your own versions of ground mapping, putting them in this directory under alternative names and using tile_set option accordingly

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, optionally but recommended OpenCL SDK

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

Common Problems, Issues

I run makeahmap.exe and I get and the programs fails to start reporting missing OpenCL.dll
It means that you don't have OpenCL drivers installed for your graphics card. Modern AMD, NVidia and Intel cards come with OpenCL support, so you may either update your drivers or use makeahmap_cpu.exe that does not use GPU for computation.
I run the program but get an error message - "Latitude above N60 is not supported with srtm3, please use srtm30"
It means that you try to use srtm3 data set (default) for territories that include latitude above N60 - and high resolution SRTM3 does not cover them, switch to srtm30 by setting value: dem=srtm30
I have created a map but I see only water?
Make sure you use correct sign for longitude, 170°W is -170.0 and 170°E is 170.0
How do I find the latitude and longitude of the area of interest?
Go to the google maps locate the area you need. Use measure distance feature of google maps (right click on the map - measure distance) to make sure you have proper map size and scale. Than right click on central point at the map of interest select "What's there?" and you'll see the coordinates of the point at the bottom of the map
How to upgrade to newer version?
makeahmap since 1.9 includes a program called upgrade_makeahmap.exe - run it and you'll get up to date version, if you have older version, download upgrade_makeahmap.exe from the web site, put it into the same directory where makeahmap.exe resides and run it.
Alternatievly you can download the latest zip and copy all its contents to current installation overwriting existing files.
I have a problem not listed there, how do I get help?
Write a message on "Terrain Editor" AH forum describing your problem in as much details as possible, providing version of makeahmap you are using, your settings (lat/lon/scale etc), exact error you are getting (if any).
I have found a bug how do I report it?
You can open it at the GitHub issues tracker: https://github.com/artyom-beilis/makeahmap

Notes