Multi-Body Terrain — Procedural Profiles and Real Heightmaps

Parent Epic: #429 (Planetary Terrain System) Depends on: #743 (Terrain Data Pipeline — Luna) — CLOSED

Summary

Extend terrain rendering and landing support from Luna-only to all rocky/icy bodies across all three star systems. Two sub-phases:

  • Phase 5a: Procedural terrain profiles for ~40 rocky/icy bodies (no heightmaps needed)
  • Phase 5b: Real NASA MOLA heightmap for Mars
  • Phase 5c: Real NOAA ETOPO1 heightmap for Earth

Phase 5a — Procedural Terrain for All Rocky/Icy Bodies

Body Classification

Terrain enabled — rocky or icy surface bodies:

System Bodies
Sol (planets) Mercury, Venus, Earth, Mars
Sol (moons) Luna†, Phobos, Deimos, Io, Europa, Ganymede, Callisto, Mimas, Enceladus, Tethys, Dione, Rhea, Titan, Iapetus, Miranda, Ariel, Umbriel, Titania, Oberon, Triton
Alpha Centauri Erebus, Chiron, Chiron I, Tartarus, Nyx, Nyx I, Proxima b, Proxima d, Proxima e, Proxima e I, Proxima f
Barnard’s Star Barnard b, Barnard c, Barnard d, Barnard e, Niven

† Luna already has terrain (real LOLA heightmap + procedural fallback)

Terrain NOT enabled — gas giants and stars:

Sun, Jupiter, Saturn, Uranus, Neptune, Alpha Centauri A, Alpha Centauri B, Proxima Centauri, Barnard’s Star

Profile Parameters

Each terrain profile defines:

Parameter Description
baseRadius Mean body radius in meters
maxElevation Maximum surface elevation above mean radius (meters)
minElevation Minimum surface elevation below mean radius (meters)
noiseOctaves Number of fractal noise octaves (CPU-side)
craterDensity Voronoi crater frequency multiplier (0 = none, 1 = heavy)
seed Deterministic noise seed (MUST match between client and server)
highlandColor RGB [0-1] for terrain above mariaThreshold
mariaColor RGB [0-1] for terrain below mariaThreshold
mariaThreshold Elevation (meters) below which low-terrain color applies
largeBasins Named impact basins with lat/lon/diameter/depth

Sol System Profiles

Mercury

  • Radius: 2,440,000 m
  • Elevation: -5,380 m to +4,480 m
  • Heavily cratered, gray surface (similar to Luna)
  • Caloris Basin: lat 30.5°N, lon 170°E, diameter 1,550 km, depth 3,000 m
  • Seed: 101, octaves: 10, craterDensity: 0.9
  • Colors: highland [0.62, 0.60, 0.58] (gray), maria [0.35, 0.33, 0.31] (dark gray)

Venus

  • Radius: 6,052,000 m
  • Elevation: -2,900 m to +11,000 m (Maxwell Montes)
  • Low crater density (thick atmosphere), volcanic terrain
  • Maxwell Montes basin (inverted — high point): lat 65°N, lon 3°E
  • Ishtar Terra highland region
  • Seed: 102, octaves: 10, craterDensity: 0.15
  • Colors: highland [0.82, 0.72, 0.48] (tan/amber), maria [0.65, 0.52, 0.32] (darker amber)

Earth

  • Radius: 6,371,000 m
  • Elevation: -8,848 m to +8,848 m (simplified — no ocean rendering)
  • Very low crater density (erosion)
  • Seed: 103, octaves: 10, craterDensity: 0.02
  • Colors: highland [0.42, 0.55, 0.35] (green-brown), maria [0.25, 0.38, 0.55] (blue-gray for lowlands)

Mars

  • Radius: 3,390,000 m
  • Elevation: -8,200 m (Hellas) to +21,229 m (Olympus Mons)
  • Moderate crater density, massive volcanic and tectonic features
  • Large basins:
    • Olympus Mons: lat 18.65°N, lon 226.2°E, diameter 600 km, depth -21,229 m (inverted: positive height)
    • Hellas Planitia: lat -42.7°, lon 70°E, diameter 2,300 km, depth 7,152 m
    • Valles Marineris: lat -14°, lon 290°E, diameter 4,000 km, depth 7,000 m (linear, approximated as basin)
  • Seed: 104, octaves: 12, craterDensity: 0.5
  • Colors: highland [0.76, 0.44, 0.26] (rusty orange), maria [0.55, 0.30, 0.18] (dark rust)

Phobos

  • Radius: 11,070 m (triaxial body approximated as sphere)
  • Elevation: -500 m to +500 m
  • Heavily cratered, Stickney crater dominant
  • Stickney: lat 5°S, lon 49°W, diameter 9,400 m, depth 1,500 m
  • Seed: 105, octaves: 8, craterDensity: 0.9
  • Colors: highland [0.20, 0.18, 0.15], maria [0.12, 0.10, 0.08] (very dark — real geometric albedo ~0.07; values raised for visible surface texture detail)

Deimos

  • Radius: 6,200 m
  • Elevation: -300 m to +300 m
  • Smoother than Phobos, fewer large craters
  • Seed: 106, octaves: 6, craterDensity: 0.5
  • Colors: highland [0.20, 0.18, 0.16], maria [0.12, 0.10, 0.09] (very dark — geometric albedo ~0.07)

Io

  • Radius: 1,822,000 m
  • Elevation: -1,500 m to +17,500 m (Boösaule Montes)
  • Volcanic terrain, very low impact craters (resurfaced constantly)
  • Seed: 201, octaves: 10, craterDensity: 0.05
  • Colors: highland [0.85, 0.78, 0.20] (yellow-sulfur), maria [0.70, 0.35, 0.10] (orange-sulfur)

Europa

  • Radius: 1,561,000 m
  • Elevation: -200 m to +200 m
  • Extremely smooth ice surface, subtle lineae
  • Seed: 202, octaves: 8, craterDensity: 0.1
  • Colors: highland [0.85, 0.82, 0.75] (icy white-tan), maria [0.70, 0.65, 0.55] (slightly darker ice)

Ganymede

  • Radius: 2,634,000 m
  • Elevation: -2,000 m to +2,000 m
  • Mixed dark/light terrain, moderate craters
  • Seed: 203, octaves: 10, craterDensity: 0.5
  • Colors: highland [0.60, 0.55, 0.48] (gray-brown), maria [0.38, 0.35, 0.30] (dark gray)

Callisto

  • Radius: 2,410,000 m
  • Elevation: -3,000 m to +3,000 m
  • Extremely heavily cratered, ancient surface
  • Valhalla multi-ring structure: lat 16°N, lon 55°W, diameter 3,800 km, depth 3,000 m
  • Seed: 204, octaves: 10, craterDensity: 0.95
  • Colors: highland [0.42, 0.38, 0.32] (dark brown), maria [0.25, 0.22, 0.18] (very dark)

Mimas

  • Radius: 198,000 m
  • Elevation: -5,000 m to +5,000 m
  • Herschel crater dominates (1/3 of body diameter)
  • Herschel: lat 0°, lon 110°W, diameter 130,000 m, depth 10,000 m
  • Seed: 301, octaves: 8, craterDensity: 0.7
  • Colors: highland [0.75, 0.73, 0.70] (light gray), maria [0.50, 0.48, 0.45] (medium gray)

Enceladus

  • Radius: 252,000 m
  • Elevation: -500 m to +500 m
  • Very smooth, icy, tiger stripes at south pole
  • Seed: 302, octaves: 8, craterDensity: 0.2
  • Colors: highland [0.92, 0.90, 0.88] (bright white ice), maria [0.75, 0.73, 0.70]

Tethys

  • Radius: 531,000 m
  • Elevation: -3,000 m to +3,000 m
  • Odysseus crater (400 km), Ithaca Chasma
  • Odysseus: lat 33°N, lon 128°W, diameter 400,000 m, depth 5,000 m
  • Seed: 303, octaves: 8, craterDensity: 0.6
  • Colors: highland [0.78, 0.76, 0.73] (light gray), maria [0.52, 0.50, 0.47]

Dione

  • Radius: 561,500 m
  • Elevation: -2,000 m to +2,000 m
  • Moderate cratering, wispy terrain (bright ice cliffs)
  • Seed: 304, octaves: 8, craterDensity: 0.5
  • Colors: highland [0.76, 0.74, 0.71] (light gray), maria [0.50, 0.48, 0.45]

Rhea

  • Radius: 763,800 m
  • Elevation: -2,500 m to +2,500 m
  • Heavily cratered, similar to Callisto but smaller
  • Seed: 305, octaves: 8, craterDensity: 0.7
  • Colors: highland [0.72, 0.70, 0.67] (gray), maria [0.48, 0.46, 0.43]

Titan

  • Radius: 2,575,000 m
  • Elevation: -500 m to +2,000 m
  • Low relief, atmospheric erosion, dune fields, methane lakes
  • Seed: 306, octaves: 10, craterDensity: 0.05
  • Colors: highland [0.72, 0.55, 0.25] (orange-brown haze), maria [0.55, 0.40, 0.18] (dark orange)

Iapetus

  • Radius: 734,600 m
  • Elevation: -5,000 m to +13,000 m (equatorial ridge up to 13 km)
  • Two-tone surface (dark leading/bright trailing), equatorial ridge
  • Seed: 307, octaves: 10, craterDensity: 0.6
  • Colors: highland [0.65, 0.62, 0.58] (light gray-brown), maria [0.18, 0.14, 0.10] (very dark brown)

Miranda

  • Radius: 235,800 m
  • Elevation: -5,000 m to +5,000 m
  • Extreme terrain variation, coronae, Verona Rupes
  • Seed: 401, octaves: 10, craterDensity: 0.4
  • Colors: highland [0.70, 0.68, 0.65] (gray), maria [0.45, 0.43, 0.40]

Ariel

  • Radius: 578,900 m
  • Elevation: -2,000 m to +2,000 m
  • Youngest Uranian moon surface, canyons and flows
  • Seed: 402, octaves: 8, craterDensity: 0.3
  • Colors: highland [0.72, 0.70, 0.67] (light gray), maria [0.48, 0.46, 0.43]

Umbriel

  • Radius: 584,700 m
  • Elevation: -2,000 m to +2,000 m
  • Very dark, uniformly cratered, ancient surface
  • Seed: 403, octaves: 8, craterDensity: 0.7
  • Colors: highland [0.38, 0.36, 0.34] (very dark gray), maria [0.25, 0.23, 0.21]

Titania

  • Radius: 788,400 m
  • Elevation: -3,000 m to +3,000 m
  • Moderate cratering, some canyons (grabens)
  • Seed: 404, octaves: 8, craterDensity: 0.5
  • Colors: highland [0.68, 0.66, 0.63] (gray), maria [0.45, 0.43, 0.40]

Oberon

  • Radius: 761,400 m
  • Elevation: -3,000 m to +3,000 m
  • Heavily cratered, some dark floor craters
  • Seed: 405, octaves: 8, craterDensity: 0.7
  • Colors: highland [0.62, 0.60, 0.57] (medium gray), maria [0.40, 0.38, 0.35]

Triton

  • Radius: 1,353,000 m
  • Elevation: -1,000 m to +1,000 m
  • Nitrogen ice, cantaloupe terrain, geysers
  • Seed: 501, octaves: 10, craterDensity: 0.1
  • Colors: highland [0.78, 0.72, 0.72] (pinkish-white), maria [0.60, 0.55, 0.55] (pinkish-gray)

Alpha Centauri System Profiles

Erebus (Alpha Centauri A, hot Venus-like)

  • Radius: 5,500,000 m
  • Elevation: -3,000 m to +8,000 m
  • Volcanic, thick atmosphere, low craters
  • Seed: 601, octaves: 10, craterDensity: 0.1
  • Colors: highland [0.65, 0.40, 0.25] (dark rust), maria [0.45, 0.25, 0.15] (scorched brown)

Chiron (Alpha Centauri A, habitable zone)

  • Radius: 7,520,000 m
  • Elevation: -6,000 m to +8,000 m
  • Earth-like terrain, moderate erosion
  • Seed: 602, octaves: 12, craterDensity: 0.05
  • Colors: highland [0.45, 0.55, 0.38] (green-brown), maria [0.30, 0.42, 0.50] (blue-gray)

Chiron I (moon of Chiron)

  • Radius: 2,000,000 m
  • Elevation: -4,000 m to +4,000 m
  • Luna-like, rocky moon
  • Seed: 603, octaves: 10, craterDensity: 0.7
  • Colors: highland [0.60, 0.58, 0.55] (gray), maria [0.35, 0.33, 0.30]

Tartarus (Alpha Centauri B, hot super-Earth)

  • Radius: 9,800,000 m
  • Elevation: -5,000 m to +12,000 m
  • Volcanic hellscape, extreme tectonics
  • Seed: 604, octaves: 12, craterDensity: 0.08
  • Colors: highland [0.55, 0.30, 0.15] (dark volcanic), maria [0.35, 0.15, 0.08] (magma-tinged)

Nyx (Alpha Centauri B, habitable zone)

  • Radius: 6,940,000 m
  • Elevation: -5,000 m to +7,000 m
  • Cool Earth-like, more ocean (gameplay: rocky terrain visible)
  • Seed: 605, octaves: 10, craterDensity: 0.05
  • Colors: highland [0.50, 0.52, 0.42] (olive-green), maria [0.28, 0.35, 0.48] (ocean blue-gray)

Nyx I (moon of Nyx, icy)

  • Radius: 1,680,000 m
  • Elevation: -1,500 m to +1,500 m
  • Icy moon similar to Europa
  • Seed: 606, octaves: 8, craterDensity: 0.3
  • Colors: highland [0.80, 0.78, 0.75] (icy white), maria [0.58, 0.55, 0.52]

Proxima d (inner rocky)

  • Radius: 4,180,000 m
  • Elevation: -2,000 m to +4,000 m
  • Tidally locked, hot day-side, cratered
  • Seed: 607, octaves: 8, craterDensity: 0.6
  • Colors: highland [0.58, 0.52, 0.45] (warm gray), maria [0.38, 0.32, 0.26]

Proxima b (habitable zone)

  • Radius: 6,530,000 m
  • Elevation: -5,000 m to +7,000 m
  • Tidally locked, but potentially habitable
  • Seed: 608, octaves: 10, craterDensity: 0.1
  • Colors: highland [0.48, 0.52, 0.40] (muted green-gray), maria [0.32, 0.38, 0.45] (blue-gray)

Proxima e (outer rocky)

  • Radius: 5,960,000 m
  • Elevation: -3,000 m to +5,000 m
  • Cold, moderate cratering
  • Seed: 609, octaves: 10, craterDensity: 0.4
  • Colors: highland [0.55, 0.53, 0.50] (cool gray), maria [0.38, 0.36, 0.33]

Proxima e I (tiny moon)

  • Radius: 1,460,000 m
  • Elevation: -2,000 m to +2,000 m
  • Small rocky moon
  • Seed: 610, octaves: 8, craterDensity: 0.6
  • Colors: highland [0.58, 0.56, 0.53] (gray), maria [0.38, 0.36, 0.33]

Proxima f (mini-Neptune/ice)

  • Radius: 13,900,000 m
  • Elevation: -1,000 m to +2,000 m
  • Icy surface over deep atmosphere, low relief
  • Seed: 611, octaves: 8, craterDensity: 0.05
  • Colors: highland [0.65, 0.72, 0.78] (pale blue-white ice), maria [0.48, 0.55, 0.62]

Barnard’s Star System Profiles

Barnard d (innermost, hot)

  • Radius: 3,500,000 m
  • Elevation: -2,000 m to +4,000 m
  • Tidally locked, heavily irradiated
  • Seed: 701, octaves: 8, craterDensity: 0.5
  • Colors: highland [0.55, 0.45, 0.35] (warm brown), maria [0.38, 0.30, 0.22]

Barnard b (first confirmed)

  • Radius: 3,800,000 m
  • Elevation: -2,500 m to +4,500 m
  • Tidally locked, moderate terrain
  • Seed: 702, octaves: 10, craterDensity: 0.4
  • Colors: highland [0.52, 0.48, 0.42] (brown-gray), maria [0.35, 0.32, 0.28]

Barnard c (largest confirmed)

  • Radius: 4,000,000 m
  • Elevation: -3,000 m to +5,000 m
  • Tidally locked, most diverse terrain
  • Seed: 703, octaves: 10, craterDensity: 0.35
  • Colors: highland [0.50, 0.47, 0.42] (brown-gray), maria [0.33, 0.30, 0.26]

Barnard e (lightest RV exoplanet)

  • Radius: 3,200,000 m
  • Elevation: -1,500 m to +3,000 m
  • Small, tidally locked, moderately cratered
  • Seed: 704, octaves: 8, craterDensity: 0.5
  • Colors: highland [0.50, 0.48, 0.45] (gray-brown), maria [0.35, 0.33, 0.30]

Niven (habitable zone destination)

  • Radius: 5,500,000 m
  • Elevation: -4,000 m to +6,000 m
  • Primary destination, potentially habitable
  • Seed: 705, octaves: 10, craterDensity: 0.08
  • Colors: highland [0.48, 0.55, 0.40] (green-brown), maria [0.30, 0.40, 0.48] (blue-gray)

Phase 5b — Mars MOLA Real Heightmap

Data Source

MOLA MEGDR 16ppd — Mars Orbiter Laser Altimeter global DEM:

Property Value
Resolution 16 pixels/degree
Dimensions 5,760 x 2,880 pixels
Meters/pixel ~3,700 m at equator
Format 16-bit signed integer (big-endian)
Raw size 33.2 MB
Scale factor 1.0 (values are meters relative to areoid)
Reference radius 3,390,000 m
Projection Simple cylindrical (equirectangular)
Latitude 90°N (row 0) to 90°S (row 2879)
Longitude 0°E (col 0) to 360°E (col 5759)
Source URL https://pds-geosciences.wustl.edu/mgs/mgs-m-mola-5-megdr-l3-v1/mgsl_300x/meg016/megt90n000eb.img

Key Difference from Luna: Byte Order

MOLA data is big-endian (MSB). Must byte-swap to little-endian during the Docker build. The client’s Int16Array assumes platform LE. Luna (LOLA) data is already little-endian.

Build Pipeline

  1. build_mars_heightmap.py — Download MOLA .img, byte-swap BE→LE, write raw Int16 LE binary
  2. downsample_and_compress.py — Same as Luna: downsample 16ppd→8ppd, byte-shuffle, gzip
  3. Physics Dockerfile: downsample to 8ppd raw binary (no shuffle/gzip)

Verification Landmarks

Feature Lat Lon Expected Elevation
Olympus Mons summit 18.65°N 226.2°E ~+21,229 m
Hellas Planitia floor -42.7° 70°E ~-8,200 m
Valles Marineris -14° 290°E ~-4,000 m (floor)

Docker Image Size Impact

  • Web-client: +5 MB (mars_heightmap.shuf.gz)
  • Physics: +8 MB (mars_heightmap_8ppd.bin)

Phase 5c — Earth ETOPO1 Real Heightmap

Data Source

ETOPO1 Ice Surface — NOAA global relief model (topography + ice sheet surface):

Property Value
Resolution 1 arc-minute (~60 pixels/degree)
Dimensions 21,600 x 10,800 pixels
Meters/pixel ~1,850 m at equator
Format 16-bit signed integer (little-endian)
Raw size ~466 MB
Scale factor 1.0 (values are meters relative to sea level)
Reference radius 6,371,000 m
Projection Simple cylindrical (equirectangular)
Latitude 90°N (row 0) to 90°S (row 10799)
Longitude -180°E (col 0) to +180°E (col 21599)
Source URL https://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registered/binary/etopo1_ice_g_i2.zip

Key Differences from Luna/Mars

  1. Column origin: ETOPO1 starts at -180°E. Must shift +180° (rotate columns by half) to match the 0°E origin used by Luna/Mars.
  2. Resolution: 60ppd native (vs. 16ppd for Luna/Mars). Must resample to 16ppd (5760×2880) before the standard downsample pipeline.
  3. Already little-endian: No byte-swap needed (unlike MOLA).
  4. Zip archive: Source is a .zip file, not raw .img. Must extract during build.
  5. Ocean clamping: All negative elevations (ocean bathymetry) are clamped to 0m (sea level). Oceans render as flat terrain at sea level. Ships landing on ocean surface should eventually sink/be destroyed (future gameplay feature).

Build Pipeline

  1. build_earth_heightmap.py — Download ETOPO1 zip, extract .bin, shift columns to 0°E origin, clamp ocean to 0m, resample 60ppd→16ppd, write raw Int16 LE binary (5760×2880)
  2. downsample_and_compress.py — Same as Luna/Mars: downsample 16ppd→8ppd, byte-shuffle, gzip
  3. Physics Dockerfile: downsample to 8ppd raw binary (no shuffle/gzip)

Profile Updates

Earth profile minElevation changes from -8848 to 0 (ocean clamped). mariaThreshold updated so low-elevation terrain (coastlines) renders with the blue-ish mariaColor and highlands render with green-ish highlandColor.

Verification Landmarks

Feature Lat Lon Expected Elevation
Mount Everest 27.99°N 86.93°E ~+8,400 m (smoothed at 8ppd)
Dead Sea shore 31.5°N 35.5°E ~-400 m
Mariana Trench 11.35°N 142.2°E 0 m (clamped)
Great Plains (Kansas) 39°N 99°W (261°E) ~+600 m

Docker Image Size Impact

  • Web-client: +5 MB (earth_heightmap.shuf.gz)
  • Physics: +8 MB (earth_heightmap_8ppd.bin)

Critical Constraints

  1. Determinism: Client and server profiles MUST have identical seed, noiseOctaves, craterDensity, largeBasins for each body. Otherwise landed ships jitter or clip through terrain.
  2. Gas giants excluded: Jupiter, Saturn, Uranus, Neptune have no solid surface.
  3. Non-spherical bodies: Phobos/Deimos are triaxial ellipsoids but the terrain system uses a sphere. Procedural noise approximates surface roughness; base shape is spherical.
  4. Stars excluded: Stars have no surface for landing.

Back to top

Galaxy — Kubernetes-based multiplayer space game

This site uses Just the Docs, a documentation theme for Jekyll.