User Rating 0.0
Total Usage 0 times
Upload an image or select a preset to generate terrain
Is this tool helpful?

Your feedback helps us improve.

About

Topographic maps encode elevation as color intensity. Misreading contour intervals or misjudging vertical scale leads to flawed site assessments, incorrect drainage planning, and costly engineering errors. This tool extracts a heightmap from any 2D image by computing per-pixel luminance L = 0.299R + 0.587G + 0.114B, then constructs a triangulated mesh rendered in real-time via WebGL with Phong shading. Vertical exaggeration E is user-adjustable from 0.1× to 5.0×. The tool assumes brighter pixels represent higher elevation. Grayscale heightmaps (DEM exports, NASA SRTM tiles) yield the most accurate results. Color photographs or satellite imagery will produce approximate terrain based on overall brightness, not true elevation data.

terrain 3d webgl heightmap map converter topography elevation 3d model terrain generator

Formulas

Luminance (grayscale height) is extracted from each pixel using the ITU-R BT.601 weighted sum:

L = 0.299 R + 0.587 G + 0.114 B

where R, G, B are the red, green, and blue channel values in the range [0, 255]. The vertex height is then:

yi,j = Li,j255 × E

where E is the vertical exaggeration factor. Per-vertex normals for Phong shading are computed via central finite differences on the heightmap grid:

ni,j = normalize(hi1,j hi+1,j, 2, hi,j1 hi,j+1)

The perspective projection matrix uses field-of-view θ = 45°, near plane zn = 0.1, and far plane zf = 100. Camera orbits using spherical-to-Cartesian conversion: x = r sin(φ) cos(θ), y = r cos(φ), z = r sin(φ) sin(θ).

Reference Data

Heightmap SourceResolutionCoverageVertical AccuracyFormat
NASA SRTM30mGlobal (60°N - 56°S)±16mGeoTIFF / HGT
ASTER GDEM v330mGlobal (83°N - 83°S)±8.68mGeoTIFF
ALOS World 3D30mGlobal±5mGeoTIFF
USGS NED10mUSA±1.55mGeoTIFF / IMG
EU-DEM v1.125mEurope (EEA39)±2.9mGeoTIFF
LiDAR (Airborne)0.5 - 2mRegional±0.15mLAS / LAZ
Mapbox Terrain RGB5m (zoom 15)Global±10mPNG (RGB-encoded)
Copernicus DEM30mGlobal±4mGeoTIFF
ETOPO11.8kmGlobal (incl. ocean)±10mNetCDF / GeoTIFF
GEBCO 2023450mGlobal ocean bathymetry±100mNetCDF
TanDEM-X DEM12mGlobal±2mGeoTIFF
JAXA DSM5mJapan±5mGeoTIFF
Swiss ALTI3D2mSwitzerland±0.5mGeoTIFF / XYZ
OpenTopography LiDAR1mVarious regions±0.1mLAS / Raster

Frequently Asked Questions

The converter derives elevation from pixel luminance. Satellite photos contain color information that does not correlate with elevation - a snow-capped peak (white, high luminance) converts correctly, but a dark forest at high altitude registers as a valley. For accurate results, use single-channel grayscale Digital Elevation Model (DEM) exports where brightness linearly maps to height.
A grid of 128×128 vertices (32,768 triangles) renders at 60 FPS on most devices and suffices for overview terrain. 256×256 (131,072 triangles) captures fine ridgelines. 512×512 (524,288 triangles) approaches the limit for smooth WebGL interaction on mid-range GPUs. Beyond that, frame drops are likely without level-of-detail techniques.
The exaggeration factor E multiplies all Y-coordinates in the exported mesh. An E of 2.0 means a pixel with luminance 128 (normalized to 0.502) gets a vertex height of 1.004 instead of 0.502. If you plan to 3D-print the model or use it in a CAD tool with real-world units, set E to 1.0 and scale afterward in your target software.
Mapbox Terrain RGB encodes elevation in all three channels using the formula: elevation = −10000 + (R × 256² + G × 256 + B) × 0.1. This tool uses standard luminance weighting, which will not decode RGB-encoded elevation correctly. Convert the tile to a grayscale heightmap first using the Mapbox formula, then upload the result.
The OBJ export uses a right-handed coordinate system with Y-up. The mesh spans from (−0.5, 0, −0.5) to (0.5, E_max, 0.5) in normalized units. Vertex normals are included for smooth shading. No UV coordinates or material files are generated; the mesh is geometry-only.
Most heightmap images have black (zero-height) borders or anti-aliased edges from cropping. These create artificial cliffs at terrain boundaries. Crop your source image to remove padding, or use an image editor to feather the borders to match the average terrain height before uploading.