How To: Generate Superb Heightmaps :)

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Keplergamer
Engineer
Engineer
Posts: 7
Joined: 04 Aug 2015 03:05

Re: How To: Generate Superb Heightmaps :)

Post by Keplergamer »

An HM I made for Train Fever that can also work here. Expect more to come soon. Also. Transport-fever.net is a great source for PNG heightmaps.
Attachments
heightmap.png
(15.7 MiB) Not downloaded yet
Keplergamer
Engineer
Engineer
Posts: 7
Joined: 04 Aug 2015 03:05

Re: How To: Generate Superb Heightmaps :)

Post by Keplergamer »

Another 2, one with erosion applied and the other not. This time I tried to make it using a scale that suits OpenTTD maps, not train fever. OpenTTD 4k maps are like 30x bigger.

Try around 150-100 usable height for a 4K x 4K map.
Attachments
output terraces.png
(17.69 MiB) Not downloaded yet
output harsh.png
(22.73 MiB) Not downloaded yet
Last edited by Keplergamer on 16 Jul 2016 02:30, edited 1 time in total.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: How To: Generate Superb Heightmaps :)

Post by Eddi »

you forgot the attachments.
Keplergamer
Engineer
Engineer
Posts: 7
Joined: 04 Aug 2015 03:05

Re: How To: Generate Superb Heightmaps :)

Post by Keplergamer »

Yeah, started uploading them right after I posted, but minimized the window and only saw it now.
User avatar
Mr Bruco
Engineer
Engineer
Posts: 32
Joined: 21 Jul 2016 11:10

Re: How To: Generate Superb Heightmaps :)

Post by Mr Bruco »

This is a video on how to create heightmap could be useful!
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: How To: Generate Superb Heightmaps :)

Post by NekoMaster »

The instructions on the first post don't seem to be working for me, I installed the SRTM thingy for Google Earth and nothing shows up. I'm using Google Earth Pro 7.1 on Windows 10 64-bit



Honestly though it'd be a hell of a lot easier if I could just find a nice big heightmap of Canada (2048x2048 and bigger) that includes the major rivers and waterbodies like lakes. I want to make a HUGE Canada scenario so that people like me can have fun trying to cover the expanses of Canada with roads and rails. I want a huge map so I can have the space to place most of the major towns and cities as well as space for industries.



If someone could help me get the data for all of Canada to make my own heightmap, or if someone could just generate a map for the entirety of Canada, either would be great (though the latter would be better since I have no idea what I'm doing with DEM and satellite stuff)

EDIT : It'd be nice if I could get this kinda detail for Canada's waterways as seen in this map http://kurld.com/images/canada-map/canada-map-04.jpg

I imagine that kinda detail may require a height map around 4096x4096.
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Andrex
Tycoon
Tycoon
Posts: 1308
Joined: 22 Nov 2002 05:08
Location: AR
Contact:

Re: How To: Generate Superb Heightmaps :)

Post by Andrex »

Mr Bruco wrote:This is a video on how to create heightmap could be useful!
That's a great idea, +1
Bad Hair Day
Tycoon
Tycoon
Posts: 3146
Joined: 22 Oct 2005 21:01
Location: Leicester - Britland

Re: How To: Generate Superb Heightmaps :)

Post by Bad Hair Day »

I've been creating heightmaps in World Machine, steadily learning as I go. I'm going to continue messing about with the program, but I think I'm done with this particular map. I may make a scenario from it in future but if anyone wants to use it, feel free. As the heightmap is a composite of sixteen 512x512 images there will be some minor issues at the seams, and the coastlines need some manual tweaking in some areas. The .tmd file of the world is included if anyone wants to tweak it further.
Attachments
v9.png
The Heightmap
(1.36 MiB) Not downloaded yet
screenshot#5.png
Example of the terrain generated
(800.25 KiB) Not downloaded yet
Heightmap 9.rar
TMD file in WinRAR archive
(71.04 KiB) Downloaded 355 times
My OpenTTD screenshot thread.

Formerly known as Lankku / 2-10-0
Bad Hair Day
Tycoon
Tycoon
Posts: 3146
Joined: 22 Oct 2005 21:01
Location: Leicester - Britland

Re: How To: Generate Superb Heightmaps :)

Post by Bad Hair Day »

So I tried a different approach with World Machine, only to find what I was doing originally worked better, so I went back to working on the heightmap I posted before. With version 13 I have a heightmap I am satisfied with enough to turn into a scenario. I have figured out how to reduce differences between the tiled heightmaps by not using the erosion tool too much as at leads to significant differences at the borders of tiles. I may create a basic tutorial at some point because even the free version World Machine has a lot of potential for creating scenarios, despite its limitations.
Attachments
v13.png
(907.54 KiB) Not downloaded yet
Heightmap 13.rar
(73.46 KiB) Downloaded 315 times
screenshot#6.png
(825.14 KiB) Not downloaded yet
My OpenTTD screenshot thread.

Formerly known as Lankku / 2-10-0
User avatar
MAGNUM_PI
Engineer
Engineer
Posts: 9
Joined: 01 Jun 2009 11:07
Location: Barcelona (Catalunya)

Re: How To: Generate Superb Heightmaps :)

Post by MAGNUM_PI »

I am not able to make a height map. I followed the tutorial but SRTM 4.1 does not show me any option, drop down or button to download any DEM in Google Earth 7.3.2 (x64). In the drop-down, only "elevation", "logo" and "logo2" are shown, but nothing. It's strange, years ago I created a map of heights for Openttd and apart from simple, I do not remember having done all this, but the tutorial is from 2010, it had to be the same method. What am I doing wrong? Thank you.
User avatar
vesgo
Engineer
Engineer
Posts: 51
Joined: 10 Sep 2004 17:06
Location: Switzerland

Re: How To: Generate Superb Heightmaps :)

Post by vesgo »

Sorry for digging the post, but i figured it out how to generate the maps, using everything in the first post with the exception of google earth. (I Can explain it if anyone needs it)
Been playing with the tools, read all the topics related, i can get nice detailed maps but its missing something...
Just wondering if there is any tool like the The city import patch by Zydeco to import citys in an automated way or any update to this patch to do this.
Trying to refresh some maps and it would be cool to have this.

Thx in advance
skummel
Engineer
Engineer
Posts: 73
Joined: 18 May 2002 19:03
Location: Randers - Denmark

Re: How To: Generate Superb Heightmaps :)

Post by skummel »

I can give a little update
The DEM data from google Earth dont works, but i manage to get those i needed from http://srtm.csi.cgiar.org/srtmdata/
Choose the cell you want, make sure to move the dot from Geo TIFF to Esri ASCII
I choosed Tile 5x5 degree

Download , take a cup of coffe

Microdem , i downloaded one named Build 2019.1.11.1 and follow the guide in the first post how to raister and merge , worked fine
How can the same S*** happens to the same guy ----- twice

John McClane
MetallicGene
Engineer
Engineer
Posts: 1
Joined: 06 Mar 2020 06:47

Re: How To: Generate Superb Heightmaps :)

Post by MetallicGene »

thank you
speeder
Engineer
Engineer
Posts: 28
Joined: 16 Jul 2014 05:57

Re: How To: Generate Superb Heightmaps :)

Post by speeder »

There are now some websites that offer SRTM versions that were fixed, for example for non-commercial use only there is this site: http://srtm.csi.cgiar.org/ (just saw is same site as last post...), so no need to use MicroDEM

I downloaded straight from that site, and opened it using QGIS, and exported from there, alongside with rivers (that I got from my own country government downloads section) and whatever else I needed. Also QGIS supports OpenStreetMap by default, handy for knowing where RL stuff is on the heightmap.
User avatar
Chrill
Moderator
Moderator
Posts: 15972
Joined: 18 Dec 2004 17:35
Location: Stockholm, Sweden
Contact:

Re: How To: Generate Superb Heightmaps :)

Post by Chrill »

Beridow wrote: 30 Jul 2020 10:52 This is my first heighmap and i wanted to share it with you.
Hey friend, welcome to the TT-Forums! :)

You forgot to upload the heightmap, so if you want to share it go ahead and make a new reply!
Image
My Scenarios:
Archipiélago Hermoso (Latest Release: Version 3.2)
Turnpike Falls (Latest Release: Version 0.91)
bba
Engineer
Engineer
Posts: 8
Joined: 25 Aug 2020 19:16

Re: How To: Generate Superb Heightmaps :)

Post by bba »

Hi everyone,

I have been working on a heightmap for Ireland, which I will share separately. I followed the Word document on the wiki to the extent possible. I would say it took me about an hour to get a heightmap that was maybe 90% of the way there, and then an entire weekend (and then some) to get it in a state I'm happy with. I thought it would be helpful to share what I found in case anyone else encounters the same problems I did.

- As others have noted, Topoview no longer seems to work with Google Earth, so I went directly to the CGIAR website at http://srtm.csi.cgiar.org/srtmdata/ and downloaded the relevant DEM files myself.

- Microdem works fine on Linux through Wine, but there are a couple of references in the Word doc to features that don't appear to be in the more recent versions of Microdem. Specifically:

-- There is no top-level "Merge" option in the "Data Manipulation" window. Instead, in the main window, just select "File -> Open -> Open and merge DEMS/grids".

-- I couldn't find any "Automatic choropleth palette" option in Microdem, as referred to in the Word doc. (It might have just moved / been renamed but I couldn't find it.) So I had to do the "original" method of selecting "Grey scale (monochrome)" and playing around with the z Range.

- In fact, I couldn't ultimately get Microdem (or QGIS, by itself) to output a greyscale image I was happy with. The problem seems to be that some very low land (eg, 1-5m above sea level in my case) gets rounded down to the same value as sea level when the raster is converted to a greyscale image. That means that some low land gets treated as sea in the resulting heightmap. I couldn't satisfactorily fix this issue without creating other problems, such as water being treated as land. Normally this might not be an issue, but for me it was resulting in peninsulas being rendered as islands and / or inlets being rendered as lakes. I eventually wrote a Python script to help solve this issue, by (1) setting all pixels with sub-zero elevation to zero elevation, (2) calculating the lowest elevation that is likely to be visible (non-zero) in the greyscale image, (3) finding pixels with an elevation above 0 but below that value, and (4) setting the elevation of those pixels to that value. I ran that script on the merged .ASC file before importing it into QGIS to convert to greyscale (Microdem continued to have issues distinguishing low land from sea even after running the script).

- To use QGIS to convert to PNG, I used the following steps:

-- In QGIS, from the top menu select "Layer -> Add Layer -> Add Raster Layer..." and choose your .ASC (or .TIF) file. It immediately appears as a greyscale image.

-- You may find that the image is a bit squished vertically, because by default it is displayed in the WGS 84 / Mercator (EPSG:4326) projection rather than the "pseudo-Mercator" (EPSG:3857) projection you may be used to. QGIS can be a bit finicky about how you change the projection. What worked for me was selecting "Raster -> Projections Warp (Reproject)..." from the top menu, choosing EPSG:4326 as the source CRS and EPSG:3857 as the target CRS and clicking Run. A new layer named "Projected" should appear. With the new layer selected, click on the projection button in the bottom left corner (it should say EPSG:4326, or at least it did for me), choose EPSG:3857 and click OK.

-- To export properly to PNG I had to follow the following steps (I don't know why I had to follow this rather round-about process, but it was the only way the greyscale image would turn out properly for me):

--- Right-click on the layer you want to export and select "Export -> Save As...". In the dialog that pops up, set the "Output mode" to "Rendered image", and choose where you want to save your layer as a .tif file. As well as saving to a file, a this will add a new layer in QGIS.
--- With this new layer selected, from the top menu select "Raster -> Conversion -> Translate (Convert Format)...". Click the "..." beside the "Converted" field to choose the file and format (ie, PNG) to export to.

- However, one feature from Microdem that I wasn't able to replicate in QGIS is the "Check Lakes" option. Basically, when you are converting to greyscale (or any other colour scale) in Microdem, you can tell it to check for lakes and give them a distinct colour. It does this by looking for contiguous sets of at least 9 "points" with the exact same elevation. This is helpful if you want to set the elevation of these lakes to sea level, so that OpenTTD renders them as water (only a good idea if the lakes are reasonably close to sea level in real life). I ended up writing a Python script to do this as well. It doesn't work exactly the same as the Microdem algorithm as it checks per-pixel rather than per-"point", so I had to use a higher threshold than 9 to get a reasonable number of lakes (I used 80 to get a reasonably good looking map).

- I used GIMP for the final image editing, rather than Paintshop Pro or Photoplus6 as suggested in the Word doc. I found the simplest way to do it in GIMP is as follows:

-- From the top menu select "Image -> Canvas Size..." which will allow you to choose the width and height of the image. Choose a width and height that gives you an image you are satisfied with while adhering to one of the aspect ratios supported by OpenTTD (1:1, 1:2, 1:4, 1:8, 1:16, 1:32 or the inverse of any of those). This will crop the image and / or expand it, filling in the new area with the colour of your choice (which should be #000000 if you want any new area to be sea). Click Resize.
-- Then from the top menu select "Image -> Scale Image..." and scale the image to the nearest resolution supported by OpenTTD.
-- Finally, select "File -> Export As..." to save the resulting image as a PNG.

So in summary, my process was as follows:

- Download the relevant SRTM data (as .ASC files) from the CGIAR website.
- Thin and merge the data files in Microdem, per the Word doc (I presume you could do this in QGIS and avoid having to use Microdem altogether; you can definitely merge in QGIS, though I don't know how to thin the data).
- Run fill_lake_elev on the merged .ASC file to detect any lakes and set them to zero elevation.
- Run fix_elev on the resulting .ASC file to bump any low land up to the minimum visible elevation.
- Convert the resulting .ASC file to a greyscale PNG using QGIS.
- Crop and scale the resulting PNG image to the desired resolution in GIMP.
gravelpit
Traffic Manager
Traffic Manager
Posts: 200
Joined: 26 Feb 2015 14:49
Location: Poland

Re: How To: Generate Superb Heightmaps :)

Post by gravelpit »

Keplergamer wrote: 15 Jul 2016 20:59 Another 2, one with erosion applied and the other not. This time I tried to make it using a scale that suits OpenTTD maps, not train fever. OpenTTD 4k maps are like 30x bigger.

Try around 150-100 usable height for a 4K x 4K map.
look's like COVID 19 in microscope :lol:
gravelpit
Traffic Manager
Traffic Manager
Posts: 200
Joined: 26 Feb 2015 14:49
Location: Poland

Re: How To: Generate Superb Heightmaps :)

Post by gravelpit »

bba wrote: 25 Aug 2020 19:45 Hi everyone,

I have been working on a heightmap for Ireland, which I will share separately. I followed the Word document on the wiki to the extent possible. I would say it took me about an hour to get a heightmap that was maybe 90% of the way there, and then an entire weekend (and then some) to get it in a state I'm happy with. I thought it would be helpful to share what I found in case anyone else encounters the same problems I did.

- As others have noted, Topoview no longer seems to work with Google Earth, so I went directly to the CGIAR website at http://srtm.csi.cgiar.org/srtmdata/ and downloaded the relevant DEM files myself.

- Microdem works fine on Linux through Wine, but there are a couple of references in the Word doc to features that don't appear to be in the more recent versions of Microdem. Specifically:

-- There is no top-level "Merge" option in the "Data Manipulation" window. Instead, in the main window, just select "File -> Open -> Open and merge DEMS/grids".

-- I couldn't find any "Automatic choropleth palette" option in Microdem, as referred to in the Word doc. (It might have just moved / been renamed but I couldn't find it.) So I had to do the "original" method of selecting "Grey scale (monochrome)" and playing around with the z Range.

- In fact, I couldn't ultimately get Microdem (or QGIS, by itself) to output a greyscale image I was happy with. The problem seems to be that some very low land (eg, 1-5m above sea level in my case) gets rounded down to the same value as sea level when the raster is converted to a greyscale image. That means that some low land gets treated as sea in the resulting heightmap. I couldn't satisfactorily fix this issue without creating other problems, such as water being treated as land. Normally this might not be an issue, but for me it was resulting in peninsulas being rendered as islands and / or inlets being rendered as lakes. I eventually wrote a Python script to help solve this issue, by (1) setting all pixels with sub-zero elevation to zero elevation, (2) calculating the lowest elevation that is likely to be visible (non-zero) in the greyscale image, (3) finding pixels with an elevation above 0 but below that value, and (4) setting the elevation of those pixels to that value. I ran that script on the merged .ASC file before importing it into QGIS to convert to greyscale (Microdem continued to have issues distinguishing low land from sea even after running the script).

- To use QGIS to convert to PNG, I used the following steps:

-- In QGIS, from the top menu select "Layer -> Add Layer -> Add Raster Layer..." and choose your .ASC (or .TIF) file. It immediately appears as a greyscale image.

-- You may find that the image is a bit squished vertically, because by default it is displayed in the WGS 84 / Mercator (EPSG:4326) projection rather than the "pseudo-Mercator" (EPSG:3857) projection you may be used to. QGIS can be a bit finicky about how you change the projection. What worked for me was selecting "Raster -> Projections Warp (Reproject)..." from the top menu, choosing EPSG:4326 as the source CRS and EPSG:3857 as the target CRS and clicking Run. A new layer named "Projected" should appear. With the new layer selected, click on the projection button in the bottom left corner (it should say EPSG:4326, or at least it did for me), choose EPSG:3857 and click OK.

-- To export properly to PNG I had to follow the following steps (I don't know why I had to follow this rather round-about process, but it was the only way the greyscale image would turn out properly for me):

--- Right-click on the layer you want to export and select "Export -> Save As...". In the dialog that pops up, set the "Output mode" to "Rendered image", and choose where you want to save your layer as a .tif file. As well as saving to a file, a this will add a new layer in QGIS.
--- With this new layer selected, from the top menu select "Raster -> Conversion -> Translate (Convert Format)...". Click the "..." beside the "Converted" field to choose the file and format (ie, PNG) to export to.

- However, one feature from Microdem that I wasn't able to replicate in QGIS is the "Check Lakes" option. Basically, when you are converting to greyscale (or any other colour scale) in Microdem, you can tell it to check for lakes and give them a distinct colour. It does this by looking for contiguous sets of at least 9 "points" with the exact same elevation. This is helpful if you want to set the elevation of these lakes to sea level, so that OpenTTD renders them as water (only a good idea if the lakes are reasonably close to sea level in real life). I ended up writing a Python script to do this as well. It doesn't work exactly the same as the Microdem algorithm as it checks per-pixel rather than per-"point", so I had to use a higher threshold than 9 to get a reasonable number of lakes (I used 80 to get a reasonably good looking map).

- I used GIMP for the final image editing, rather than Paintshop Pro or Photoplus6 as suggested in the Word doc. I found the simplest way to do it in GIMP is as follows:

-- From the top menu select "Image -> Canvas Size..." which will allow you to choose the width and height of the image. Choose a width and height that gives you an image you are satisfied with while adhering to one of the aspect ratios supported by OpenTTD (1:1, 1:2, 1:4, 1:8, 1:16, 1:32 or the inverse of any of those). This will crop the image and / or expand it, filling in the new area with the colour of your choice (which should be #000000 if you want any new area to be sea). Click Resize.
-- Then from the top menu select "Image -> Scale Image..." and scale the image to the nearest resolution supported by OpenTTD.
-- Finally, select "File -> Export As..." to save the resulting image as a PNG.

So in summary, my process was as follows:

- Download the relevant SRTM data (as .ASC files) from the CGIAR website.
- Thin and merge the data files in Microdem, per the Word doc (I presume you could do this in QGIS and avoid having to use Microdem altogether; you can definitely merge in QGIS, though I don't know how to thin the data).
- Run fill_lake_elev on the merged .ASC file to detect any lakes and set them to zero elevation.
- Run fix_elev on the resulting .ASC file to bump any low land up to the minimum visible elevation.
- Convert the resulting .ASC file to a greyscale PNG using QGIS.
- Crop and scale the resulting PNG image to the desired resolution in GIMP.
https://tangrams.github.io/heightmapper/
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: How To: Generate Superb Heightmaps :)

Post by MagicBuzz »

Hello,

I just discovered this link : https://cs.heightmap.skydark.pl/

It's very helpfull for creating nice heightmaps based on real life.

The only matter is that I didn't found how to zoom and change the heightmap size. You need to combine some pictures together if you want a wider area.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 6 guests