Creating a Map from Digital Terrain Data and Google Maps

Ins and Outs of Creating the Map
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Ok, off to a good start with lakes and rivers too. I tried doing various things with MicroDEM but quite a few functions seem to be buggy. It's still good for heightmaps and relief maps, at least for the moment, but not so good for some other things.

So, I went and grabbed QGIS. Spent a bit of time swearing at the interface, but fairly quickly got a useful result. The same SRTM data that is the basis for the usual DEM's also comes in other datasets, like this - https://dds.cr.usgs.gov/srtm/version2_1/SWBD/ - which is a vector map of just about every lake on the planet, and this - https://hydrosheds.cr.usgs.gov/datadown ... ata=15rivs - which does the same for rivers.

So if you download a bunch of files from those pages and import the shapefiles into QGIS, you can make a nifty overlay for your game map that will contain more information that you'll ever need and will match the DEM projection perfectly. Which would have been handy to know some time back, but nobody ever mentioned it. :-P

Basic example using the heightmap for my Latvia scenario, since it was handy anyway and that area is chockers with lakes and rivers.

Basic.jpg
With_lakes.jpg
Lakes_and_rivers.jpg
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Ok, here's some more RT3 weirdness. :mrgreen:

When I did that ramp test back here, to check out the lowest smooth gradient the game was capable of, I noticed that even though it had a gradient of approximately 1 in 85 the track was shown as being at 0%. So, I decided to run a few tests to see what the game thought various gradients were, compared to what they actually are in terms of in-game mesh. The results are amusing.

Using the same test ramp heightmap, and just playing with the overall height modifier on import, I generated a range of in-game ramps with modifiers varying from 2.6 up to 48.0. Up until 2.6, the game will still show the track as being at 0%. In other words, this supposed 0% track gradient seems to apply to ramps as steep as 1 in 32, in terms of the actual game mesh geometry. That's an actual 3% ramp, still displaying to the player as 0% track.

Track starts getting displayed as a solid 1% at around a height modifier of 8, with a solid 2% kicking in around 16, etc. It looks like the internal calculations are done on the basis that 8 internal height units (which remember are 0.7 of the height units the game displays to you) over the length of one map pixel (the smallest squares visible when laying track) gives you a "track gradient" of "1%" shown in the interface, with the actual gradient of said track being around 8%.

Note that this is still an assumption, because changing ramp height via the overall height modifier on import is not as accurate as changing it directly via the heightmap RGB values. Large modifier values screw things up. Since the original ramp was 1 height unit per map pixel, and was dead smooth, obviously a modifier of 48 should make a smooth ramp of 48 height units per map pixel. It doesn't, though. It gets the top plateau height correct, but the ramp between that and the ocean is badly striated. It's mostly a grade of 6, but grades vary from 1 to 10 in places. At some point I'll probably make a few more RGB ramps to test some of this stuff without having to use height modifiers (IOW, ramps will still be dead smooth) but given the observed results I'm pretty sure the scale suggested is the correct one. !*th_up*!

So, in real terms, "0% track" is anything under an actual 1 in 32. "1% track" is about an actual 1 in 12, although with a bit of a range either side of that. "2% track" is about an actual 1 in 6, etc. By the time you're up to "12% track" the actual gradient is near to 45 degrees, which if you check things out in the game is about right. *!*!*!



That's today's first lot of weirdness. The second lot of weirdness is the editor's smoothing function. The ramp testing was all done with 0 smoothing, but just to see what would happen I also did a couple of import tests with smoothing values of 1.0 and 2.0. It definitely doesn't do what I would expect it to do. I would expect it to round off the edges of the top plateau, and round off the internal edges between the ramp and the steep sides up to the plateau.

Instead, what it does is only round off one edge of the plateau, and only round off the opposite internal edge between ramp and sides. The other two relevant edges, one edge of the plateau and the ramp-to-side internal edge opposite it, are not smoothed at all and remain angular.

And_they_call_this_smoothing.jpg

Given this behaviour it is no wonder I've found that the map "smoothing" modifier tends to make a mess of things. I wouldn't trust is as far as I could throw it. It's clearly going to be better to import terrain with a fine resolution (good elevation tables) and a smoothing value of 0, then do any minor route smoothing manually. !*th_up*!
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Been doing a bit more testing. I've found the 5 metre scale is very good for some maps. It works well for small areas done at large scale. For some maps even a 4 metre scale could be handy (ie: setting 8 of RT3's internal height units to be 4 real life metres). For example, a 4 metre scale would have been perfect for the Latvia map I made last year, because it's large and flat and you want some extra detail at low elevations. But minor tweaks to the overall height modifier when importing the heightmap would do just as well in that case (which is what I did when I made it) so a 5 metre scale would have been fine.

OTOH the 5 metre scale is not so good for larger areas that have wide ranges in elevation. The first Mount Everest test model was really too exaggerated at that scale, and looked more realistic with a height modifier of around 0.4 or 0.5. The Orient Express test maps I made the other day were done with the old 0-9999.dbf, which even though it didn't work properly (40 metre Lego blocks) was about right for overall height range on a map of that real life area and in-game pixel size, if imported with the height modifiers left on the default value of 1.

The other thing is areas below sea level. The Dead Sea is the most obvious example, but there are plenty of others: Sea of Galilee at -210 m, Afar Triangle at -150 m, parts of the Netherlands at whatever, central valley of California, etc. Sooner or later somebody is going to want maps of those places too, and they can't use tables that start at sea level. Obvious thing to do: make a few sets of tables in handy ranges, so you can pick whichever ones work best. So I did. !*th_up*!

The old monster Lego block table turns out to have been done on an 8 metre scale (ie: 8 of RT3's internal height units = 8 real life metres) or would have been if it had been working properly. That's basically what the RGB values were set for. So I whipped up a general sea level to 10,000 metres table on an 8 metre scale, and another -400 to 9,600 metres table on the same scale for handling the Dead Sea. Ran a test on that one to make sure it works, and it does.

Dead_Sea_test.jpg

That was done so that the Dead Sea itself was at 0 height for heightmap purposes, so was "ocean" in RT3 terms, with the Mediterranean being a manually-done lake at a nominal 400 metre altitude (the Dead Sea was around -400 metres before 1980, but has dropped a bit since). The same principle would work for any below sea level starting point. You could even just use this set of tables if you weren't worried about having an automatic "ocean", and your central Cali map (for example) could have the Salton Sea added in as a lake (obviously the Pacific would have to be a lake too). I like automatic oceans when I can get them, so personally I'd only use the -400 to 9,600 tables if I really needed to start below sea level.

Anyway I've zipped up both new sets: 0 to 10,000 m, and -400 to 9,600 m, both in 8 metre increments, for anyone who wants to use them. This is not as fine a resolution as the 5 metre tables, but is still 5 times better resolution than the old 0-9999.dbf.

Also included is the TGA heightmap for the Dead Sea test map, if anyone wants to try it out. I found that looked best if imported with an overall height modifier of about 2, since the real life area is quite small and the test map size is quite large. It would obviously be possible to make a set of tables with the same starting point and a 4 metre resolution, but it would mean a/ more tables to mess with and b/ you'd run out of RGB values at +6,743 metres, so no Himalayas.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
FlorianF

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

Gumboots wrote: Tue Jan 08, 2019 2:09 am I made the rest of the tables, and gave them a full testing. They work. (0!!0)

Obviously, the way to test them is with Mount Everest. Aint nothing taller than that. So, I grabbed the DEM for that area and exported 8 BMP images, using one elevation table after another. Stacked the BMP's in Photoshop, knocked out the green pixels, and saved as a TGA heightmap.

Imported that into RT3, and it looks like this...


Everest_import_testing.jpg


I've attached the TGA in a zip, so anyone can play with it themselves. !*th_up*!

Ok, so how did I make this beastie? I used the new elevation tables which are in the other zip.
They come with a readme file, and you are advised to read it, but I'll describe the procedure in the next post.

Edit: Just for fun, I threw a satellite shot on it.


Everest_satshot.jpg
Wow! Did you actually made this into a map to play? :O
User avatar
Gumboots
CEO
Posts: 1203
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Creating a Map from Digital Terrain Data and Google Maps Unread post

No. It was just an obvious test case for proof of concept. I figured if it will handle Everest, it will handle anything.

Edit: By the way, if you want to turn it into a scenario or sandbox I'm happy to give you a copy of the version with the satellite shot.
Gumbootz Lokomotivfabrik und Bierkeller

LMR Samson 0-4-0 - Pennsy H3 Consolidation - Custom double tank cars set
Post Reply