Show HN: TerrainSR – fast, realistic heightmap upscaling model

open
40 points by joegibbs · 7 comments
This is a model that I made for a historical game. I wanted to have a 1:1 scale model of Europe, but my problem was that 100m data was too low-res while 10m LIDAR data was patchy, took hundreds of GBs to store and was full of manmade objects like mines, buildings and so on.

I trained this model on undeveloped landscape so that it can quickly add plausible erosion features, rocks, etc to the low-resolution height data and sort of reconstruct what the terrain would look like before any human interference.

7 comments

Really neat idea - would have loved to have this 15-20 years ago!

I'm curious how it does for non-Earth data. Mars terrain for example.

joegibbs OP
Thank you! Not very well:

https://jgibbs.dev/assets/jezero_steepest.png

https://jgibbs.dev/assets/jezero_delta.png

Since Mars doesn't have the water-based erosion in areas it was trained on, it loses a lot of the sharper cliffs and adds gullies in places that would be smooth sand on Mars. It would probably be pretty easy to train a new model though that could handle it.

pugworthy OC
Ages ago I was working on a Mars-based game idea and at the time the terrain res data wasn't great. This kind of concept really would have been a game changer (as it were).
dvt
On my phone but very interested in this (hence leaving a comment so I can find it later). What’s the variation, can we generate different maps from the same low res seed?

I’m interested in this because “macro maps” can be hand built in a way that may want to preserve gameplay balance while individual games can still feel broadly unique.

joegibbs OP
Thank you! Yes as well as the input image you can pass in a seed value (otherwise the result is deterministic). I hadn't tried it with pure noise rather than satellite data but it does pretty well: https://jgibbs.dev/assets/terrainsr-noise.png
can you talk to some about how you trained this? this is such a neat idea!!
joegibbs OP
Mostly through trial and error really, I started off getting a bunch of 100m and 10m satellite data then tried a few different methods. First I tried a bunch of ways to do it as a GAN, but there were too many artifacts and it lacked detail every time. Then I did a diffusion model that worked but took minutes to run, then kept distilling it down from 64 steps to 1 step, which looked basically the same as 64 but was fast. All in all it was about $100 to train.