deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

TerrainSR upscales 100m heightmaps to realistic 10m terrain in under a second

A newly released open-weight model turns coarse 100m heightmaps into realistic 10m elevation data in under a second per large patch, using training that deliberately skips human-built features.

TerrainSR upscales 100m heightmaps to realistic 10m terrain in under a second

A super-resolution model for elevation data

TerrainSR is a newly released model that performs super-resolution on terrain heightmaps: it takes a low-detail elevation grid, typically at 100-metre resolution, and generates a realistic version at 10-metre resolution, inventing fine surface detail the coarse input never contained. The model was published on Hugging Face by its author under the username joe-gibbs and has since been featured on the front page of Hacker News.

According to the model's Hugging Face page, the network was trained on matched pairs of 100m and 10m elevation data. Inputs at 100m or finer resolution work well — the model can even extrapolate detail beyond 10m — but quality breaks down when it is fed anything coarser than its 100m training data.

Built for a game, trained to skip civilization

The author built TerrainSR to solve a concrete problem in a historical strategy game set at real-world scale: making a 100m map of Europe usable. A native 10m dataset of the continent would, by the author's estimate, take up hundreds of gigabytes and would demand extensive manual cleanup to strip out present-day features such as roads, docks and potentially buildings. The coarser 100m data is compact and naturally blurs those details away, leaving the model to synthesize believable terrain on top. One quirk the author flags: where very large buildings leave steep elevation spikes in the coarse data, the model may render them as hills.

Two further choices stand out. The training data deliberately excluded cities, mines and other human-modified land, so generated output contains none of those features. And the author positions the model as quicker and more varied than the classic alternative of simulating erosion across large terrains.

Fast enough for real-time use

Speed is the headline number. On an RTX 4070, TerrainSR converts a 50 by 50 kilometre patch from 100m to 10m resolution in 0.74 seconds once the model is loaded — performance the author says opens the door to real-time use cases like games.

How to run it

The release requires Python 3.10 or newer and PyTorch 2.6 or newer, with a CUDA build recommended for NVIDIA GPUs; CPU inference is supported but slower. Users supply two inputs: a 2D array of heights in metres on a 100m grid, and a water mask on a 10m grid where 1 marks water and 0 marks land, with ten times as many rows and columns as the height array.

The model expects 3.2km of surrounding context on every side, and the crop=32 setting removes those 32 context cells from each edge of the result. A 104x104 input at 100m combined with a 1040x1040 water mask produces a 400x400 output at 10m — a 4x4km patch. Input dimensions must be even and no larger than 564 cells per side, and the result is a float32 array of heights in metres. Both a command-line script and a short Python API are included, with a seed argument for reproducible results.

Licence and training data

The model weights and inference code ship under Apache 2.0, which permits use, modification and redistribution — including in commercial projects — as long as licence and attribution notices accompany any redistributed copies. The underlying geodata carries separate terms: training data comes from swisstopo, Kartverket, IGN and USGS, while Copernicus DEM, ESA WorldCover and OpenStreetMap supplied inputs and masks.

Why it matters

Elevation resolution has always forced a trade-off between fidelity, storage and manual effort. Game and simulation developers typically choose among shipping enormous high-resolution datasets, generating terrain procedurally, or accepting blurry interpolation. A learned upscaler that turns a 50km patch into 10m detail in under a second changes those economics: compact coarse data can be expanded on demand, even at runtime.

The artifact-aware training is a practical touch for anyone reconstructing historical or untouched landscapes, since modern infrastructure simply vanishes from the output. And with a permissive licence and a straightforward NumPy-based interface, the barrier is low for both game studios and geospatial tooling — though the terms of the upstream elevation datasets still govern any data users redistribute alongside the model.

  • #machine-learning
  • #geospatial
  • #procedural-generation
  • #hugging-face
  • #open-source

Related posts