Author Topic: Heightmap setup  (Read 1941 times)

0 Members and 1 Guest are viewing this topic.

Offline killwater

Heightmap setup
« on: December 10, 2016, 08:53:53 PM »
Hello
I am trying to make a realistic map. I created a heightmap with one of the tutorials (http://forum.simutrans.com/index.php?topic=13921.msg138296#msg138296) floating in the forum and loaded the file into Simutrans. Unfortunately I have some problems:
- Should I do something with the scale? The map is 1200/1200px. I do not exactly know how big the area is though.
- How do you guys find where should for example a particular road go?
- There is plenty of local unevenness. Do you smooth the ppm somehow or do you correct it by hand?
- How to make sure the height is correct? Max height should be 145m.

The map looks like it is 2.5x too big (I measured an island and it is about 800m wide on the map and 20 tiles wide in game, I play Experimental devel version). The bigger the map the better.

Also as I compare it with a true map it looks like it is stretched widthways. I guess it is a question of different projection used. How do you deal with this?
« Last Edit: December 10, 2016, 10:49:03 PM by killwater »

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2548
  • Total likes: 279
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Heightmap setup
« Reply #1 on: December 11, 2016, 07:57:05 AM »
1) 1200x1200 px means it's a 1200x1200 tiles map. Each pixel is a tile.
2) You guess knowing that 1px is 1 tile.
4) You have the grey colour spectre, each lighter grey is half tile above from the previous shade. You have to calculate where the water level is and then choose how many tiles you think 145m is.

Offline Vladki

Re: Heightmap setup
« Reply #2 on: December 11, 2016, 04:01:47 PM »
4) is not correct. There are 256 shades of grey, but much less height levels in game. Also some higher levels are flattened when you load heightmap but can be trraformed higher in game. I think it was discussed some time ago but no fix was done. As a goid test is to load a file with smooth gradient from black to white and see what happens.

Offline AP

Re: Heightmap setup
« Reply #3 on: December 11, 2016, 04:19:24 PM »
As per my query in the other thread, how do you make the heightmaps load half-height slopes?

In a pakset with half-heights available, it still seems to create the default doubleheight ones from the ppm files.

Offline killwater

Re: Heightmap setup
« Reply #4 on: December 11, 2016, 04:41:00 PM »
Thank you An_dz for the reply.
So 1 pixel is 90m IRL (info from the data source website). This gives me area of 108kmx108km. However the tile size is set to 125m/tile which will ruin everything. 
About the height. I have a sea on the map so this will be level 0. If I understand correctly (and I assume that I manage to make it 90m/tile) this will let me have only 3 half-height levels?

Or would it be possible to scale the map in GIMP 2x and then I will get 45m/tile and 7 levels of half heights which should be awesome if possible. Map would be 2400x2400 so my computer should be able to deal with it. Two problems arise though:
-Will the balance be broken (especially physics model)?
-If I scale the image in GIMP will the ppm still work as intended? Has anyone tried it before? I am afraid that it will create something like this:
        \                         \_                          \
from         I will get        \      instead of     \
     

P.S. I would like to thank ZéQuimTó. His tutorial lets you create realistic heightmap with 90m resolution from any part of the world in 15min.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8698
  • Total likes: 300
  • Helpful: 228
  • Languages: De,EN,JP
Re: Heightmap setup
« Reply #5 on: December 11, 2016, 09:26:23 PM »
First, you can use BMP files, so you do not have to bother with ppm files for quite a while.

If double of half tiles are created would depends on the settings in simuconf.tab, whether height_conversion_factor=1 or =2 is set. (You can set this in the settings dialoge, landscape tab, first entry. You must set it before loading a height map!

Offline AP

Re: Heightmap setup
« Reply #6 on: December 11, 2016, 11:05:21 PM »
Which setting is meant to create half heights,  1 or 2?

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2548
  • Total likes: 279
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Heightmap setup
« Reply #7 on: December 12, 2016, 03:51:33 AM »
4) is not correct. There are 256 shades of grey, but much less height levels in game. Also some higher levels are flattened when you load heightmap but can be trraformed higher in game. I think it was discussed some time ago but no fix was done. As a goid test is to load a file with smooth gradient from black to white and see what happens.
I did not express correctly, I wanted to say the "Simutrans grey spectre/palette" that you should probably find on the forums or the maps website. I'll take a look in the code to try to find the correct numbers.

Which setting is meant to create half heights,  1 or 2?
(1) One, after all the other is a "double" height ;) I could be wrong, but you could test too.

So 1 pixel is 90m IRL (info from the data source website). This gives me area of 108kmx108km. However the tile size is set to 125m/tile which will ruin everything.
-Will the balance be broken (especially physics model)?
Well, the tile sizes in Simutrans are not realistic, as not all houses have a 125 m² terrain, nor buses are 125 m long.

About the height. I have a sea on the map so this will be level 0. If I understand correctly (and I assume that I manage to make it 90m/tile) this will let me have only 3 half-height levels?
The height is done by the shade of the grey used, you'll probably need to test to see if it looks like 145m or not.

Or would it be possible to scale the map in GIMP 2x and then I will get 45m/tile and 7 levels of half heights which should be awesome if possible.
If you are going to double the size of the file you can use nearest-neighbour interpolation. This will only make one pixel become a 2x2 pixel square without smoothing.

Offline killwater

Re: Heightmap setup
« Reply #8 on: December 13, 2016, 08:13:42 PM »
True, but I play experimental, so if I make the height wrong then for example the vehicles can be underpowered, etc. So there can be some consequences that if I do not know about beforehand mat cause huge troubles afterwards.

Edit: I tried to make it work but I stumbled upon a following problem - I get this 2 x single height slope:

\
  \ _________
                       \
                        \_________

I want a single height slope:
\___________
                       \__________
                   
So basically I get two single slopes in one place. Is it possible to get just a single slope on a heightmap colour change? This would give much better height distribution on flat terrains. The magic setting is set to 1.
« Last Edit: December 14, 2016, 08:48:33 PM by killwater »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8698
  • Total likes: 300
  • Helpful: 228
  • Languages: De,EN,JP
Re: Heightmap setup
« Reply #9 on: December 14, 2016, 09:49:04 PM »
Maybe experimental still uses the old code in this case.

Offline Vladki

Re: Heightmap setup
« Reply #10 on: December 14, 2016, 10:13:55 PM »
Killwater - it seems that your bitmap has too high difference between gray shades. Try loading the attached heightmap - it is a smooth gradient of grey from 0 to 255. When you load it in simutrans-ex and set the water level to minimum, you should get a landscape with seashore at -20 and mountain top at +30. Each level would be a few (4) tiles  wide with half slopes between them. So it makes one height level every 4 levels of grey.

Offline killwater

Re: Heightmap setup
« Reply #11 on: December 15, 2016, 10:33:30 PM »
Hmm yes that looks to be the issue. Your file works perfectly fine. But how can I make it in GIMP to have just 5 1 tile levels? I have 255 greyscale image. I used indexed mode to get it down to 5 but it worked as described above.

Offline Vladki

Re: Heightmap setup
« Reply #12 on: December 16, 2016, 07:50:47 AM »
If you want only 5 heights then the the highest point must be only 20 gray levels lighter than lowest point. Probably recoloring the map using flood fill would be the easiest way. Every height level is 4 levels of gray and I would avoid the boundary grey levels (252, 248, 244), better would be (254, 250, 246), see the test heightmap, you will see that the terraces are not perfectly straight. I dont know why. Maybe the gradient (made in gimp) is not perfect either

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8698
  • Total likes: 300
  • Helpful: 228
  • Languages: De,EN,JP
Re: Heightmap setup
« Reply #13 on: December 16, 2016, 08:54:01 PM »
The contrast/brightness or the lookup curve would achieve that trick both. The problem is rather to know what greys are needed for lowest and highest point. Best probably to check the levels with a palette for the grey map and then check the darkest and brightest spot on your map. So reduceding contrast reduces the span and brightness increases the zero level (if doen properly).

Offline killwater

Re: Heightmap setup
« Reply #14 on: December 16, 2016, 09:14:19 PM »
I have managed to get a map that more or less looks like I wanted. Thank you all very much. I used Vladki's advice - select color + fill tool. Tough to get a right height though - I went from level 100 to 128 which I hope cover following heights: 0, 22.5, 45, 67.5, 90, 112.5, 135 m above sea for the setting 45m/tile. The water level is -8 but I will fill the lowest level by hand and colour it with water climate as public service to get a nice flat transition from water to land.

Would be nice to have a possibility to define water as for example red to add it but keep the same level as all the terrain around.

Offline Vladki

Re: Heightmap setup
« Reply #15 on: December 17, 2016, 10:14:09 AM »
Usage of some color channel for water (including rivers) would be cool. I can see other features done this way - climates, forests, cities, infrastructure...

Offline AP

Re: Heightmap setup
« Reply #16 on: December 17, 2016, 04:00:47 PM »
I've had issues where the terrain changes height too quickly, you can get what should be sea fjords getting filled in, because the map code won't generate "cliffs".  So I agree with a colour to force it to obey sea level.

One thing I asked about ages ago, but I don't think was possible then, was a way to paint (on a seperate image for use as an overlay) the city spawn points and rivers (since experimental has proper rivers), so they arrive in the right place on the map. I believe it is only possible by means of co-ordinates at present (which would be a bit tedious...) and even then I didn't ever figure out how to load such a file.
« Last Edit: December 18, 2016, 03:23:37 PM by AP »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4577
  • Total likes: 167
  • Helpful: 106
  • Languages: EN, NO
Re: Heightmap setup
« Reply #17 on: December 18, 2016, 09:04:58 AM »
For cities, I assume people would typically like to specify a name and probably a population as well. At least the name can't be given in the image.

Offline AP

Re: Heightmap setup
« Reply #18 on: December 18, 2016, 03:15:49 PM »
Names can easily be changed in-game in seconds - populating a map takes hours.

Perhaps  e.g. 10 colours could link to spawning cities of 10 different population sizes, and another 10 colours rivers of 10 different widths? (NB check how many river widths are actually available...)

Also if anyone has found software other than MicroDEM that will allow editing of the google maps height data - please can they let me know? MicroDEM won't work on my Windows 10 32 bit PC.

Offline Tjoeker

Re: Heightmap setup
« Reply #19 on: December 18, 2016, 03:18:14 PM »
Or use the full scale of a coulour? which gives you 256 scales to choose from. (for population)

Offline AP

Re: Heightmap setup
« Reply #20 on: December 18, 2016, 03:22:08 PM »
Or use the full scale of a coulour? which gives you 256 scales to choose from. (for population)
Indeed.

If you're going to the trouble of scripting something, you could also perhaps allow different areas of the maps to preferentially spawn particular industries using a few more colours. But depends entirely how flexibly someone wanted to make it.

Offline isidoro

Re: Heightmap setup
« Reply #21 on: December 18, 2016, 11:58:32 PM »
[...]and another 10 colours rivers of 10 different widths? (NB check how many river widths are actually available...)
[...]

Problem with rivers is that terrain has to be modified when "building" them, to have proper slopes.  Not to mention that you have to get the river directions from the pixels (which can be feasible or pretty difficult, depending on how you "draw" those rivers in the map)...