Author Topic: Automatic terrain generation from geographical data (a tool I created)  (Read 30555 times)

Offline artik

  • Silver Member
  • ****
  • Posts: 1909
      • Blog
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #15 on: October 19, 2013, 11:15:53 AM »
UPDATE

Version 0.1 released:

- Added support of shoreline database for accurate map generation
- Simplified coordinates specifications: put center latitude and longitude and the scale - that's it.

Download: http://cppcms.com/files/makeahmap_v0.1.zip

Note the link: http://cppcms.com/files/makeahmap.zip is valid as well and points to the latest version.

Examples of a map I created:

Suez Channel



Compare for example with this:



Delta Nile example:




Artik, 101 "Red" Squadron, Israel

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10899
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #16 on: October 19, 2013, 11:30:15 AM »
Looking good.
Easy in-game again.
Since Tour 19 - 2001

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #17 on: October 19, 2013, 11:40:19 AM »
Color really plays a big part on how we interpret things. On your screen shot looks like buildings off to the side but on your build there is water there. I check google maps and it shows water but when I go to satellite view looks like grassy to me until I zoom in and see it is very, very, very green water.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #18 on: October 19, 2013, 11:56:03 AM »
What set of SRTM did you use? SRTM3 or SRTM30?
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline artik

  • Silver Member
  • ****
  • Posts: 1909
      • Blog
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #19 on: October 19, 2013, 12:01:06 PM »
Quote
What set of SRTM did you use? SRTM3 or SRTM30?

SRTM3 - it should be in README, config.ini and in the directory itself.

Color really plays a big part on how we interpret things. On your screen shot looks like buildings off to the side but on your build there is water there. I check google maps and it shows water but when I go to satellite view looks like grassy to me until I zoom in and see it is very, very, very green water.

I wonder... According to globcover database, this area is

    
Quote
Artificial surfaces and associated areas

But according to the water lines database it is a water... Maybe it is possible to combine such an information and make a waterc.bmp with higher values
at these areas to make them look greenish?

Interesting...  :x
Artik, 101 "Red" Squadron, Israel

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #20 on: October 19, 2013, 12:09:58 PM »
It does say SRTM3 in your readme file ... I just need to slow down and read things thoroughly instead of skipping to where to get the files to download.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline 715

  • Silver Member
  • ****
  • Posts: 1835
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #21 on: October 19, 2013, 03:18:49 PM »
Wow!  I'm impressed... again!

You coded, in a single day, a way to not only read the vector water data but also rasterize it as well?

If you really include all real world water features in AH terrains you're gonna have to build a lot of bridges or GVers are going to get stuck.  ;) 

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #22 on: October 19, 2013, 06:31:32 PM »
Been playing around with your program. very cool but couple of things.

1) For the waterc.bmp file your are writing the land area to the file (white pixels). This is unnecessary the only thing that should be in this file is the different colors for water. So if you do not change any of the water colors the whole file should be black. If you change just say one lake to a different color then everything should be black but that lake.

2) On the scaling of the maps. Not sure if I am doing something wrong (or missed reading something) but I picked a central point, set map size to 512, and set the scale to 0.75, 1.0, and 2.0 but the output was the same each scale setting (changing the scale from 1.0 to something else didn't seem to do anything). At least for my test of centering a map on Tokyo.

lat 35.6895
lon 139.6917
scale 1.0


I can get it to scale if instead of using a central point I set lat1, lat2, long1, long2 ... basically know before hand what a 1.5 scale would be and pick the correct points for them. Just the central point method doesn't seem to only do a scale of 1.0.
« Last Edit: October 19, 2013, 06:50:28 PM by ghostdancer »
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline artik

  • Silver Member
  • ****
  • Posts: 1909
      • Blog
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #23 on: October 20, 2013, 04:47:06 AM »
1) For the waterc.bmp file your are writing the land area to the file (white pixels). This is unnecessary the only thing that should be in this file is the different colors for water. So if you do not change any of the water colors the whole file should be black. If you change just say one lake to a different color then everything should be black but that lake.

Ok. But if I would paint the ground with white and water black - it should not interfere? Right? So this way if a user would want to adjust the color on his own he would be able to see the lake that is black and change its color.

Am I right?

2) On the scaling of the maps. Not sure if I am doing something wrong (or missed reading something) but I picked a central point, set map size to 512, and set the scale to 0.75, 1.0, and 2.0 but the output was the same each scale setting (changing the scale from 1.0 to something else didn't seem to do anything). At least for my test of centering a map on Tokyo.

lat 35.6895
lon 139.6917
scale 1.0


I can get it to scale if instead of using a central point I set lat1, lat2, long1, long2 ... basically know before hand what a 1.5 scale would be and pick the correct points for them. Just the central point method doesn't seem to only do a scale of 1.0.

Yes... you are right, it is a bug.

I missed scale parameter in the calculations of latitude and longitude range, I'll fix it in the next release.
« Last Edit: October 20, 2013, 05:47:51 AM by artik »
Artik, 101 "Red" Squadron, Israel

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #24 on: October 20, 2013, 07:05:43 AM »
I don't know if what affect it will have. Will have to test it out. Normally the waterc.bmp is pure black when you start a fresh terrain. Your right it shouldn't make a difference since the area is land but I have never see what effect if any have the land in the waterc.bmp (white) does or doesn't do.
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline jedi25

  • Copper Member
  • **
  • Posts: 321
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #25 on: October 20, 2013, 12:15:06 PM »
Artik,

This is a awesome and great development you have going here..

I have never try the map making, but this has sparked my interest..

The game is in dire need of new maps - real world map that is..

Great work man.. :rock  :aok  :salute
« Last Edit: October 20, 2013, 12:53:29 PM by jedi25 »

Offline 715

  • Silver Member
  • ****
  • Posts: 1835
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #26 on: October 20, 2013, 01:29:55 PM »
I don't know if what affect it will have. Will have to test it out. Normally the waterc.bmp is pure black when you start a fresh terrain. Your right it shouldn't make a difference since the area is land but I have never see what effect if any have the land in the waterc.bmp (white) does or doesn't do.

If he leaves waterc.bmp all black then how would a user find lakes, rivers, lagoons, etc. to manually paint them a different color (in PhotoShop for example, not the Terrain Editor)?

Offline ghostdancer

  • Aces High CM Staff
  • Platinum Member
  • ******
  • Posts: 7562
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #27 on: October 20, 2013, 02:05:03 PM »
In photoshop you create a duplicate layer above your base layer (black) and cut in paste your waterd.bmp into that layer to use as a stencil. Then select and delete the black areas of that layer. Then create a layer under it and start coloring there.

As for if the white does anything in waterc.bmp I don't know because by default when you create a terrain in AH terrain editor everything is black until you start painting things. Generally most designers don't really change the water color very often. So right now I don't know if having a the white in the waterc.bmp will have any impact or not. It might (such as increase the file size of the terrain) or it might not, have to test to see if there is any result.

For example we found out that if under say the sea on the map if you use the grass texture instead of deep ocean texture it dramatically increased the file size of the terrain even though players see no difference (they see water since the grass texture can't be seen at deep water depths). Just have to test to see if there is any impact or not is all.
« Last Edit: October 20, 2013, 02:12:54 PM by ghostdancer »
X.O. 29th TFT, "We Move Mountains"
CM Terrain Team

Offline artik

  • Silver Member
  • ****
  • Posts: 1909
      • Blog
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #28 on: October 20, 2013, 02:42:05 PM »
Actually terrain size is very good point. Fully black waterc.bmp is easily compressed.
Artik, 101 "Red" Squadron, Israel

Offline artik

  • Silver Member
  • ****
  • Posts: 1909
      • Blog
Re: Automatic terrain generation from geographical data (a tool I created)
« Reply #29 on: October 22, 2013, 10:55:31 AM »
New version v0.2 Released: http://cppcms.com/files/makeahmap_v0.2.zip

Major changes:

- Fixed map generation in Western Hemisphere
- Added support of smaller and easier to download/use elevation datasets with 30 arc-second accuracy (900m): GTOPO30 and SRTM30, additionally to existing SRMT3 support (the elevation resolution of AH map is around 800m - so it should be more than fine for any practical purpose)
- You can alter how many rivers are added (i.e. how major river should be to be present)

Full Changelog

Bug fixes:

- Fixed bug of not generating shores in Western Hemisphere
- Fixed bug of the scale parameter not being used.
- Fixed elevations near sea-shores - set to 0 to reduce water slope problems
- Removed rivers near edges of terrain - reduce water slope issues
- All rivers now pass over beach ground type

New features:

- Added support of SRTM30/GTOPO30 elevaion database (that is much smaller but yet accurate enough for most purposes)
- Added selection of river levels to draw
- Added suppport of gz compression of GSHHS and DEM files such that DEM/hgt and gshhs files can be gz-compressed
- Added custom globcover to AH tiles mapping (groundmapping.csv)
- Initial clipboardmap generation (not really useful)



Known Issues

1. There is known problem of slight misalignment of the rivers and shores, so it is good idea to check and manually fix them before you continue. It seems that the problem in the rivers database itself. I had e-mailed the person responsible for the database, hopefully he would help.
2. Not all elevations are automatically corrected - so if you have many rivers you may have to do many manual corrections, but you can reduce amount of rivers by setting river_level option to small values or even do not generate them at all with river_level 0
3. The map that has area that includes the E180 - W180 meridian are not supported.
4. The areas below latitude S60 are not supported. (Not much WW2 action thou) due to lack of the relevant data from GlobCover database



Consultation Needed

How to fix river slopes?

1. Set all water to 0 - bad would create huge unnatural canyons over high altitude rivers
2. Remove rivers segments/rivers that have big slopes (bad idea as well)
3. Live it to user to do it manually?
4. Do not fix it, i.e. build a terrain with high slopes...  What kind of problems can it cause?
5. Any other idea?


P.S.: Any comments and suggestions are welcome
« Last Edit: October 22, 2013, 11:04:55 AM by artik »
Artik, 101 "Red" Squadron, Israel