Taos Engine Taos Explorer Launch Taos ExplorerLaunch ↗

Inside Taos Explorer · an interactive guide

A Technical Deep Dive Into Taos Explorer

Cape Town seen from above Table Mountain: photoreal city, bay and a hazy horizon under a blue sky. Mount Everest at dusk under a starry purple sky. Earth from 3,000 km up, with a thin blue atmosphere at the limb and stars in black space. The lunar surface with Earth hanging over the horizon. Jezero crater's delta on Mars under a butterscotch sky.
Cape Town · 1.2 km up
One continuous world. Every frame here was rendered live in a browser tab by the same program, at well over 100 frames per second on a desktop GPU. You can fly between all of these without a loading screen. Earth imagery: Google Photorealistic 3D Tiles via Cesium ion · Moon & Mars: NASA, USGS, ESA data

Open a web page and you are hovering over Cape Town. The buildings are real, photographed from aircraft and turned into 3D. Push forward and the city slides under you. Climb and the haze thickens into a blue rim, the sky goes black and the stars come out. Press one button and you are flown 380,000 km to the Moon and set down on its surface, with Earth hanging above the horizon. Press it again and you are standing in a crater on Mars under a butterscotch sky.

This guide explains how that works: all of it, from the ground up. Taos Explorer is an app built on the Taos Engine, a WebGPU game engine written in TypeScript. The app itself is over 120,000 lines on top of the engine. Nothing here needs a graphics background. When a piece of math matters we will build it up from scratch, and wherever a picture or a slider can explain something faster than prose, there is one you can play with.

1 · NUMBERS

Precision

Planet-sized coordinates break 32-bit floats. Fix that first.

2 · DATA

Streaming

Pull just the right detail of a whole planet over the network.

3 · LIGHT

Rendering

Sun, shadows and materials for millions of triangles.

4 · AIR

The sky

Atmosphere, haze, clouds, stars, from the ground to orbit.

5 · SPEED

Performance

All of it in under 6 ms of GPU time a frame.

Want the full technical detail? Exploring the technology of Taos Explorer is a series of deep dives for graphics programmers, starting with how a frame is rendered. For the science behind it all, the models, the real-world data and how each is checked against reality, see Science and engineering.

Part I · Groundwork

Before any pixels: what the program does, and the numbers it has to survive

A planet is enormous and a city block is small. Any program that shows both at once has to handle that range in its numbers before it can draw anything.

The tour

What you are looking at

Taos Explorer is an app built on the Taos Engine: a single program that shows off what the engine can do. It runs in any browser with WebGPU, the modern API that lets a web page drive the graphics card directly, much as a desktop game would. From the user's side it offers:

  • The real Earth. The default dataset is Google's Photorealistic 3D Tiles: whole cities rebuilt in 3D from aerial photographs. Other datasets are Cesium World Terrain or the keyless open terrain (bare ground under satellite imagery, or a topographic, street or contour map: Settings → Ground map), OpenStreetMap buildings, or any 3D Tiles dataset you point it at.
  • The Moon and Mars, streamed the same way, with a rocket button that flies you between them, 7 to 12 seconds to the Moon and 16 to Mars.
  • The rest of the solar system: every planet, 20 major moons, 150,000 asteroids and the comets, where they really are, to look at from the ground or visit in orbit, and solar and lunar eclipses at their real times.
  • A plane to fly: a small flight sim with mouse-aim controls, a cockpit view, and landings on the streamed terrain.
  • 33 bookmarked places: 23 on Earth (New York, Everest, Machu Picchu, Cape Town…), 5 on the Moon (Apollo 11 and 17, Tycho, Copernicus, an Earthrise view) and 5 on Mars (Jezero, Gale, Valles Marineris, Olympus Mons, Hellas). You can also search for any address.
  • A full sky: an atmosphere that scatters sunlight, distance haze, volumetric clouds, a real star catalog, the Milky Way, optional aurora and a time-of-day slider.
  • Live data: from orbit, up to 16,000 tracked satellites placed with the same orbital model used by real tracking sites, the International Space Station as a 3D model, sea-surface temperature, and clickable building metadata.
  • Graphics extras: sun shadows, ambient occlusion, temporal anti-aliasing (TAA or the TAAU upscaler), motion blur, lens flare, bloom, auto exposure.

All of this runs at roughly 130–145 frames per second over the default New York view on a desktop GPU, using about 5.4 ms of GPU time per frame.

Mount Everest at sunrise with a low sun and long shadowsEverest, sunrise
Earth's surface from 400 km up with the curved horizon and blue atmosphere400 km up, the ISS's altitude
The walls of Valles Marineris on MarsValles Marineris, Mars

The shape of one frame

Everything the program does happens inside a loop that runs once per displayed frame, 100+ times per second. Here is that loop in the order it actually runs. Each item gets its own section later.

  1. Move the camera. Read the keyboard, mouse, touch, or an in-progress rocket flight. Keep "up" pointing away from whichever planet you are near.
  2. Keep the numbers small. If the camera has drifted more than 10 km from the current origin, move the origin to the camera (the floating origin).
  3. Decide which world you're on. Earth, Moon or Mars, whichever surface is nearest. That body gets streamed tiles; the others are drawn as painted spheres.
  4. Choose the tiles. Walk the planet's tile tree and pick the coarsest pieces that still look sharp from here. Ask the network for the ones that aren't loaded yet.
  5. Update the sky. Feed the sun position, camera altitude and planet size to the atmosphere, clouds and stars.
  6. Render. Assemble about 25 rendering stages into a graph and hand the whole frame to the GPU in one submission.
  7. Network housekeeping. Start the most urgent downloads, cancel ones the camera no longer needs, and evict old tiles if memory is over budget.
The first problem

Why big numbers break a renderer

Computers store most decimal numbers as floating point: a fixed number of significant digits plus an exponent, like scientific notation in base two. JavaScript uses 64-bit "doubles", with about 16 significant decimal digits. GPUs, however, work almost entirely in 32-bit floats, which have a 24-bit significand: about 7 significant digits.

Seven digits sounds like plenty until you measure the Earth. The planet's radius is 6,378,137 meters, already seven digits. If a building's corner is stored as its distance from the center of the Earth, there are no digits left over for anything smaller than about half a meter. Every vertex snaps to a half-meter grid. Worse, the grid point a vertex rounds to depends on the camera's exact position, so when the camera moves the whole city shakes.

The gap between one representable float and the next is called a ULP (unit in the last place). For a 32-bit float near a value x it is:

The math · spacing between neighboring 32-bit floats
ULP(x) = 2⌊log₂ x⌋ − 23
  • xthe magnitude being stored (here, meters)
  • 23the stored significand bits (24 with the hidden leading 1)
MagnitudeExample32-bit step
10 macross a room≈ 1 µm
10 kmthe floating-origin limit used here≈ 1 mm
6,378 kma point on Earth, measured from its center0.5 m
78,000 kma distant body in floating-origin space8 m
383,000 kmthe Moon's distance32 m
Interactive · what 32-bit floats do to a house far from the origin
32-bit step here: worst vertex error:
The house is 6 m wide and the figure is 1.8 m tall. Their corners are stored as 32-bit numbers at the chosen distance from the origin, and the camera drifts slowly sideways. Near the origin the drawing is smooth. Push the slider to Earth-radius scale (≈6.4 million meters) and corners snap to a half-meter grid and jump as the camera moves. Turn on the floating origin: positions are stored relative to a point near the camera, and the shaking stops at any distance.

The fix used everywhere in Taos Explorer has two halves:

  1. Do geography in 64 bits. All planet math (positions, frames, tile bounds, the camera's true location) stays in JavaScript doubles on the CPU. With 16 significant digits, 6,378,137.000 000 1 m is no problem.
  2. Only hand the GPU small numbers. Just before anything reaches the GPU, positions are re-expressed relative to a point near the camera, so they are a few kilometers at most. At that size a 32-bit float is accurate to about a millimeter.

The rest of Part I shows how those two rules shape the coordinate systems and the camera.

Where is anything?

Latitude, longitude, and the Earth-centered box

Maps describe a place by longitude (degrees east of Greenwich), latitude (degrees north of the equator) and height. That is great for people, but you can't add two latitudes or measure a straight line with them. For 3D math the program converts to ECEF, Earth-Centered, Earth-Fixed: ordinary x, y, z meters with the origin at the planet's center, +Z through the North Pole, and +X through the point where the equator meets the Greenwich meridian. It is fixed to the Earth, so it spins with it.

One catch: the Earth isn't a sphere. Its spin flattens it, so the equatorial radius is 6,378,137 m and the polar radius only 6,356,752 m, about 21 km less. The standard description of that shape is the WGS84 ellipsoid, the same one GPS uses. On an ellipsoid "straight down" (perpendicular to the surface) does not point at the center. Latitude is defined by that perpendicular, so the conversion to ECEF has to account for the flattening.

Interactive · a slice through the Earth
ECEF x: ECEF z: radius here: normal misses center by: geodetic − geocentric: if Earth were a sphere: off
The drawing exaggerates the flattening so you can see it; the numbers below are real WGS84 values. Blue is the surface normal, which defines latitude. Orange is the line to the center. They disagree by up to 0.19° at 45°, which is 21 km on the ground. A program that treated the planet as a sphere would put every city in the wrong place.
The math · latitude, longitude, height → ECEF
N = a√(1 − e² sin²φ)
x = (N+h) cosφ cosλ,   y = (N+h) cosφ sinλ,   z = (N(1−e²)+h) sinφ
  • φ, λ, hlatitude, longitude, height above the ellipsoid
  • aequatorial radius, 6,378,137 m (WGS84)
  • e²eccentricity squared, f(2−f) ≈ 0.006694 with flattening f = 1/298.257223563
  • Ndistance along the normal from the surface to the polar axis (the "prime vertical radius")

The function is written for any ellipsoid with radii a and b, so the same code serves the Earth, the Moon and Mars. The Moon is a sphere (a = b = 1,737,400 m, so e² = 0 and it reduces to ordinary spherical coordinates). Mars is flattened like Earth: 3,396,190 m at the equator and 3,376,200 m at the poles. Part VI shows what goes wrong when Mars is treated as a sphere.

src/geo/geo.tsTypeScript
export function geodeticToEcef(lon: number, lat: number, height: number,
                               a = WGS84_A, b = WGS84_B): Vec3d {
  const sinLat = Math.sin(lat), cosLat = Math.cos(lat);
  const e2 = (a * a - b * b) / (a * a);
  const n = a / Math.sqrt(1.0 - e2 * sinLat * sinLat);
  return {
    x: (n + height) * cosLat * Math.cos(lon),
    y: (n + height) * cosLat * Math.sin(lon),
    z: (n * (1.0 - e2) + height) * sinLat,
  };
}

Going back: ECEF → latitude, longitude, height

The reverse direction has no exact simple formula, because the height and the latitude depend on each other. The engine uses Bowring's method, a closed-form approximation that is accurate to well under a millimeter for any point near the surface and needs no iteration. It first computes a "reduced" latitude θ = atan2(z·a, r·b), with r = √(x²+y²), then the true latitude from it.

Why not the textbook formula

The textbook height formula is h = r / cosφ − N. Directly over a pole, r and cosφ are both zero, and the ratio collapses. A camera hovering over the North Pole would read its height as about −6,400 km. Everything that depends on altitude (the far plane, fly speed, level of detail) would behave as if it were deep inside the planet. The engine uses an equivalent form with no division, h = r cosφ + z sinφ − a√(1 − e² sin²φ), which is well behaved everywhere.

A local frame: east, north, up

ECEF is perfect for geography and terrible for a camera. At New York, "up" in ECEF is a diagonal mix of x, y and z. So the program also builds a local tangent frame at a chosen point: east, north and up (ENU), with up along the ellipsoid normal. The engine's own convention is Y-up and the camera looks down −Z, so the mapping is X = east, Y = up, Z = −north. Looking down −Z means looking north.

src/geo/geo.ts · GeoFrame.atLonLatTypeScript
const east  = { x: -sinLon,          y:  cosLon,          z: 0 };
const north = { x: -sinLat * cosLon, y: -sinLat * sinLon, z: cosLat };
const up    = { x:  cosLat * cosLon, y:  cosLat * sinLon, z: sinLat };
// rotation rows = [east; up; −north], then move the origin to the anchor point
const worldFromEcef = mat4dMul(rot, mat4dTranslation(-origin.x, -origin.y, -origin.z));

That 4×4 matrix (kept in 64-bit Float64Arrays) is the bridge between geography and the engine. Multiply an ECEF point by it and you get engine "world" coordinates: small numbers, meters east, up and south of the anchor. The class that owns it is called GeoFrame.

Keeping the numbers small

The floating origin

A GeoFrame anchored at the start location keeps nearby coordinates small. But you can fly. Ten kilometers away the world coordinates are already 10,000, and at 1,000 km they are back to the jittery range. The answer is to move the anchor. Every frame the program checks how far the camera is from the world origin. When it passes REANCHOR_DIST = 10_000 meters, the origin jumps to the camera, and the camera lands back at (0, 0, 0). Flying an aircraft the origin follows much more closely: 2 km in the chase view and 250 m in the cockpit, where the instrument panel is under a meter from your eye and even a millimeter of rounding would show.

The clever part is what doesn't happen. Thousands of tiles are already sitting on the GPU with their vertices baked relative to the old origin. Re-uploading them would take far too long. Instead, each tile remembers which origin it was baked against (bakeOriginEcef). When the origin moves, the program only adds a small translation to each tile's model matrix at draw time:

The math · moving the origin without touching the vertices
wnew = R(p − O′) = R(p − O) + R(O − O′) = wold + worldFromEcefnew(O)
  • pa vertex's true ECEF position (64-bit, never sent to the GPU)
  • O, O′the old and the new origin
  • Rthe east/up/−north rotation, kept fixed so the shift is a pure translation

So a re-anchor costs one 64-bit matrix–vector product and one addition per tile per frame, and the vertex data never moves. There is an allocation-free version of worldFromEcefPoint specifically for this hot loop.

Interactive · flying with a floating origin
distance flown: camera, world coords: camera, ECEF magnitude: re-anchors so far: 32-bit step, world: 32-bit step, ECEF:
The flag is the world origin. The camera (the triangle) flies east; its world coordinate climbs until it reaches the limit, then the origin jumps under it. The tiles never move in ECEF; only the small per-tile shift changes. The GPU always works with numbers below the limit, so the 32-bit step stays near a millimeter instead of half a meter.

Two details keep the jump invisible:

  • Temporal effects are told about it. Anti-aliasing (TAA) and motion blur compare each pixel with where it was last frame. A 10 km jump of the whole world would look like violent motion and smear the frame gray, most visibly over the dark Moon. The camera's notifyOriginShift folds the jump into the previous frame's matrices so the effects see no motion.
  • "Up" turns only when it must. Normally the east/north/up axes are not re-derived at the new origin, only the translation moves. That makes the shift exact. The cost is that the world's +Y drifts away from true local up as you travel: 100 km from the anchor it is tilted by 100/6378 rad ≈ 0.9°. Several systems assume +Y is up where the camera is (the cloud deck above all), so once the drift passes 1°, about 110 km of travel, the re-anchor also turns the axes to the new local up. Tiles then get one rigid transform instead of a translation, the camera's view is carried across, and the temporal effects are told about the turn as well. Between turns the camera simply compensates, as the next section shows.

Teleporting to a new place builds a completely new frame at the destination. That is the one time content is re-baked.

The camera

A camera that knows which way is up

A normal first-person camera assumes up is +Y. On a planet, up is "away from the center", and because the world axes are frozen, that direction slowly rotates as you fly. In deep space there is no up at all. Taos Explorer handles both with one rule. Every frame it measures the direction from the active planet's center to the camera (the radial direction), then turns the camera's up vector part of the way toward it:

The math · how strongly up locks to the planet
lock = 1 − smoothstep(0.005 R, 0.05 R, altitude)
up ← slerp(up, radial, lock)
  • Rradius of the body you're near: fully locked below 32 km on Earth (8.7 km on the Moon), fully free above 319 km (87 km on the Moon)
  • slerprotate along the shortest arc between two directions

Near the ground the horizon is always level and W/A/S/D move you along the surface. In space, lock reaches zero and up stops being corrected, so you fly freely in six directions with no sudden snap at the boundary. Because the correction happens a fraction at a time each frame, descending from orbit re-levels the horizon smoothly. The camera's orientation itself is built as tilt · yaw · pitch, where tilt is the shortest rotation from +Y to the current up. Yaw and pitch are separate angles, so roll can never creep in.

Near plane, far plane, and how fast to move

A 3D camera only draws between a near and a far distance. Make the range too small and you clip away the world; too large and you waste depth precision (Part VI explains why). Taos Explorer recomputes both every frame from your altitude, using the exact distance to the horizon. The usual shortcut √(2Rh) is fine near the ground but badly wrong from orbit: at 25,000 km it says 17,900 km when the true answer is 30,700 km. A far plane sized that way would cut off the whole planet.

The math · horizon, clipping planes and speed (explorer/main.ts)
horizon = √(rcam² − r²) = √(h(h + 2r))
far = max(200 km, 1.15 · horizon + 100 km)   near = min(max(1.5 m, 0.0005 h), 0.02 · far)
speed = max(220 m/s, 0.6 h per second)
  • rground radius directly below the camera (ellipsoid-correct)
  • hcamera altitude above that ground
Interactive · the camera at any altitude
horizon (exact): √(2Rh) shortcut: far plane: near plane: far ÷ near: fly speed: up-lock: mouse-look scale:
Drag from street level to the Moon's distance. The horizon lines touch the planet's edge; the shaded arc is the far plane. Notice how the up-lock fades to zero in space, and how the mouse-look sensitivity drops while the planet still fills your view, so a small drag doesn't swing a huge globe across the screen.

Places, links and shortcuts

Each bookmarked place is just a name, a longitude and latitude, a height, and an optional camera preset in local meters. The presets are captured in the program itself: pressing P re-expresses the current camera in a fresh frame directly below it and copies a ready-to-paste line of code. Three URL parameters make any view reproducible, which is essential for comparing quality and performance fairly:

  • ?place=Nboot directly at bookmark N (23 is the Earthrise on the Moon, 28 is Jezero crater on Mars)
  • ?alt=400000park the camera that many meters straight above the place, looking down at it
  • ?time=17.5pin the time of day and stop the clock, so two page loads have identical lighting
Part II · Streaming a planet

A whole planet, one screenful at a time

Google's photoreal Earth runs to many terabytes. You can't download it, and you don't need to: at any moment you only need the pieces in view, each at just enough detail. This part covers where those pieces come from and how the program decides which to fetch.

The data

Cesium ion, Google, and four other worlds

All the planetary data reaches Taos Explorer through Cesium ion, a hosting service for 3D geospatial data. Each dataset on ion has a numeric asset id. The program asks ion where an asset lives, and ion replies with a URL, a short-lived access token and the attribution text that must be shown on screen. After that the program downloads tiles directly from wherever ion pointed.

The Moon and Mars are the exception. By default they stream from Explorer's own tilesets, baked from NASA, USGS and ESA data and hosted with the site; the Cesium ion assets below are the fallback (Settings, or a failed load when there is an ion key).

Taos Explorer api.cesium.com /v1/assets/{id}/endpoint data host ion CDN or Google ① asset id + token ② url, token, credits ③ tileset.json, then tiles (Bearer token or ?key=) ④ bytes, cached on disk by the browser
Datasetion idWhat it isFormat
Google Photorealistic 3D Tiles (default)2275207Textured meshes of the whole globe, rebuilt from aerial photography; cities in full 3D.3D Tiles 1.1, glTF
Cesium OSM Buildings96188OpenStreetMap building footprints extruded to their heights, with per-building metadata you can click.b3dm + batch tables
Cesium World Terrain1Global elevation with a water mask; satellite imagery is draped on top by the program. Listed as Cesium World Terrain (Ion), with Cesium OSM Buildings on it unless Settings → Buildings → Buildings is off.quantized-mesh
Open terrain—AWS Terrain Tiles: global elevation (SRTM and others, to about 5 m per pixel), with OpenStreetMap's buildings extruded to their heights from OpenFreeMap's vector tiles; fetched directly with no ion key or account. With Settings → Buildings → Buildings off, the terrain alone.Terrarium PNG + Mapbox Vector Tiles
Cesium Moon Terrain2684829The whole Moon, centered on the Moon, radius 1,737,400 m. The fallback for Explorer's own Moon tiles (LRO LOLA elevation, LROC imagery, detail patches at the Apollo sites and Shackleton).3D Tiles, glTF
Cesium Mars3644333MOLA and HRSC elevation with a Viking color mosaic, on Mars's own ellipsoid. The fallback for Explorer's own Mars tiles (MOLA, HRSC, Viking MDIM 2.1 and HiRISE, with detail patches at Jezero and Gale).3D Tiles, glTF
CustomanyAny other ion asset id, or a plain tileset.json URL: pick Custom tileset… under Settings → Dataset, type either one in the Tileset field that appears and press Enter. To draw a tileset for one area over the dataset you are on, add it under Regional datasets → Add region instead: its area is traced from the tileset.any 3D Tiles

Google through ion

The Google dataset is external: ion's reply carries Google's own URL with an API key already in it, instead of an ion token. Google's root file then hands back child links that carry a session= parameter. Every child link has to keep both key and session, so the URL resolver copies any query parameter of the parent that the child doesn't set itself. That carries both values down the whole tree.

Google also requires on-screen credit for the imagery owners. Each tile's glTF carries an asset.copyright string. Every frame the tileset collects the strings of the tiles it actually drew, splits them on ;, removes duplicates and sorts them. The attribution bar only repaints when that list changes, which is a cheap check because the array object is reused while nothing changes.

A disk cache that survives reloads

Re-downloading the same city on every visit would be slow and expensive, but standard HTTP caching doesn't help here. Google's responses say Cache-Control: no-store, and the session token changes the URL on every visit. So the engine keeps its own cache with the browser's Cache Storage API (geo-tiles-v1). The cache key is the URL with the volatile session and key parameters removed, and the stored copy is a clean response with only a content type. A second visit to New York loads mostly from disk. Press O in the app to watch the data-source log: every request, its size, and whether it came from the network or the cache.

The format

3D Tiles: a tree of detail

3D Tiles is an open standard for streaming huge 3D datasets. A dataset is a tree. The root covers everything at very low detail. Each child covers part of its parent's area at higher detail, and so on down to the finest leaves. A small JSON file, tileset.json, describes the tree. Each tile in it has:

  • boundingVolumethe space the tile occupies: an oriented box, a sphere, or a geographic region (longitude, latitude and height ranges)
  • geometricErrorhow wrong, in meters, the tile's shape is compared with the real thing. The root of Google's Earth might be off by kilometers; a leaf by a few centimeters.
  • refineREPLACE: children replace the parent when shown. ADD: children are drawn on top of the parent.
  • contentthe actual mesh file, or a link to another whole tileset.json (an external tileset, loaded only when reached)
  • childrenthe finer tiles

The program reads the content type from the first four bytes of each file (its "magic"): glTF for Google and the Moon and Mars, b3dm for OSM buildings (a header and a feature table wrapped around glTF), pnts for point clouds, i3dm for instanced models, and cmpt for a composite of several. Newer datasets can use implicit tiling: a regular quad-tree or octree described by a formula and an availability bitmap instead of listing every tile. That is supported too.

Lazy everything

Google's tree is enormous and most of it is never visited. So when a sub-tree is parsed the engine stores each tile's raw JSON bounds and link, but defers the math. Converting a region into an oriented box (8 corners, each converted from geodetic to ECEF) and resolving the URL against its parent both happen the first time traversal actually reaches the tile. Parsing a large external tileset therefore costs almost nothing for tiles you'll never see.

Choosing detail

Screen-space error: is this tile good enough?

A tile's geometric error is in meters, but what matters is how big that error looks on your screen. A 10 m error on a mountain 50 km away is smaller than a pixel. The same error on the building in front of you is a disaster. So every tile's error is projected to pixels:

The math · screen-space error (src/geo/traversal.ts)
SSE = e · H2 d tan(θ/2)
  • ethe tile's geometric error in meters
  • Hscreen height in pixels
  • ddistance from the camera to the nearest point of the tile's bounding volume (at least 1 m)
  • θthe camera's vertical field of view (60° here)

If the SSE is larger than a budget, the pixel error setting, the tile isn't good enough and the traversal descends into its children. The engine's default is 16 pixels; Taos Explorer uses 12. The budget also loosens with altitude, from 1× at 2 km to 3× at 30 km (a smoothstep), because from high up you see far more tiles and a constant budget would overspend.

Distance is measured to the actual oriented box, not its enclosing sphere. The sphere around a box is about 1.7 times bigger, so using it would make every tile look closer than it is and over-refine everywhere.

Interactive · watch the tile tree refine around the camera
tiles drawn: deepest level: culled subtrees: effective budget:
A 128 km square of terrain seen from above. Drag on the map to move the camera; the wedge is its field of view. Each square is one tile, colored by level. Lower the pixel error and the tree splits further. Raise the altitude and detail fades out everywhere. Turn off frustum culling to see how much work it saves: off-screen tiles would otherwise be refined by distance alone.

Refining without holes

Deciding a tile should split is the easy part. Its children may not have downloaded yet, and under REPLACE the parent disappears when the children appear. Show them one at a time as they arrive and you get holes where the missing ones should be. The traversal in src/geo/tileset.ts follows three rules:

  1. All or nothing. A parent is replaced only when every child is ready, including children that are off screen. Until then the parent keeps drawing, and the missing children are requested at the parent's priority so off-screen siblings don't sort last and stall the swap. Readiness ignores the frustum on purpose, so turning the camera can't flip the level of detail back and forth.
  2. Sticky refinement. Once a tile has refined, it stays refined on the next frame even if a newly discovered grandchild briefly makes it "not ready". Without this, detail popped coarse and back.
  3. Empty is not missing. Some tiles legitimately contain nothing; OSM Buildings' root is a 400-byte file with zero triangles. These are treated as content-less containers, not as unloaded content, so a coarse setting shows coarse geometry instead of an empty screen. An empty leaf counts as "ready" too; otherwise its parent could never be replaced, and San Francisco's photogrammetry would stay stuck at its coarsest level.
Interactive · four children arrive at random times
Left: swap each child in as soon as it arrives; the parent vanishes at the first arrival and holes show the empty background. Right: the engine's rule. The coarse parent stays until all four children are ready, then they replace it in one frame. It costs a little sharpness for a moment, but nothing ever disappears.
Asking for bytes

Priorities, cancellation, and a memory budget

Each frame the traversal produces a wish list: every tile it would like to draw but doesn't have. That list can be hundreds long, and a browser shouldn't run hundreds of downloads at once. The TileCache in src/geo/tile_cache.ts decides what actually happens.

The math · load priority (smaller is more urgent)
priority = distance × budgetmax(SSE, budget)
  • distanceto the tile's bounds: nearer tiles first
  • ratiobetween 0 and 1: tiles badly over budget get pulled forward, but a near tile can never be starved
  1. Request every frame. The traversal calls request(key, priority) for every tile it wants, every frame. A tile already in the cache is simply marked as used.
  2. Cancel by omission. At the end of the frame, any download in flight that was not requested again is aborted with its AbortController. If you swing the camera away, its downloads stop at once.
  3. Start the most urgent. Sort what's left by priority and start downloads up to 16 at a time, with a separate cap per server.
  4. Evict the stale. The cache has a budget in both bytes and triangles (2,400 MB on a desktop, scaled down on phones; 20,000 triangles per MB). When it's over, tiles unused for more than 240 frames (about 4 s) are dropped, least-recently-used first. It may go up to 2× over budget before evicting anything recently used. That tolerance stops a burst of new loads from evicting the tiles on screen, and any eviction that does happen is counted, so it can be told apart from a streaming pop.

A preload ring warms tiles just outside the view: after the normal traversal, a second walk with the frustum widened by up to 50 km requests the same detail at a priority that always sorts after anything on screen. A quick pan then finds those tiles already loading. Earth, terrain, Moon and Mars each get their own cache, so landing on the Moon never evicts New York.

Interactive · the request queue while the camera pans
loaded: canceled: evicted: visible & missing:
The bright window is the screen; it wanders back and forth. Tiles inside it are requested, nearest the center first. Amber are downloading, blue are cached (fading as they go unused), and a red flash marks a canceled download. Too few download slots and the screen stays patchy. Too small a cache and tiles you just left get evicted and must be fetched again when you come back.
From bytes to triangles

Decoding a tile

A downloaded tile is a compressed file, not something a GPU can draw. Turning it into GPU buffers is a pipeline of its own:

  1. Unwrap. Strip any 3D Tiles header (b3dm, i3dm, cmpt) to reach the glTF inside, keeping the feature tables that hold per-building metadata.
  2. Decompress. Geometry may be Draco- or meshopt-compressed and textures may be KTX2 (Basis). This can run on a pool of up to four Web Workers so the page stays responsive (a toggle, off by default); the finished vertex buffers are transferred back without copying.
  3. Repack as static geometry. The engine's glTF loader normally builds skinned meshes for animated characters. Tiles never animate, so they're loaded as plain static meshes. That drops a per-tile skinning bind group, which would push the deferred renderer past a texture limit and turn distant tiles black.
  4. Bake into world space, in 64 bits. Every vertex is multiplied by the tile's full transform (tile → ECEF → current world frame) on the CPU in double precision, and the GPU draws it with an identity model matrix.
  5. Tidy up. Google marks its materials "unlit" (the photo already has lighting baked in); the engine forces them lit, rough and non-metallic so the sun, shadows and haze apply. Mip chains are capped at three levels, because photogrammetry texture atlases are padded only a few texels and deeper mips bleed black into the seams.
Why bake on the CPU?

The Moon's tiles carry absolute coordinates around 1.7 million meters. Multiplying them by a model matrix in 32-bit floats on the GPU loses decimeters, and sub-meter crater triangles collapse into slivers, which show up as sparkling "speckle" across the lunar surface. Doing the multiply in 64 bits before upload avoids it. As a bonus, two neighboring tiles that share an edge get bit-identical edge vertices, so they meet watertight.

Quantized-mesh: terrain in a few bytes per vertex

Cesium World Terrain uses a compact format called quantized-mesh. Each tile's vertices are stored as three 16-bit numbers (u, v, height) scaled to 0–32767 across the tile's extent. Neighboring vertices are usually close together, so each value is stored as the difference from the previous one. Differences can be negative, so they're zig-zag encoded: 0, −1, 1, −2, 2… become 0, 1, 2, 3, 4…, which keeps small numbers small. Triangle indices use high-water-mark encoding: each index is stored as "how far below the highest index seen so far, plus one", so new vertices cost a zero. Both streams compress very well afterwards.

Interactive · encode a row of terrain heights
heights: deltas: zig-zag: triangles: high-water codes:
Smooth terrain turns into a stream of small numbers, mostly 0–20, even though the heights themselves span thousands of steps. The triangle strip at the bottom shows high-water-mark coding: every index that introduces a new vertex encodes as 0. The decoder reverses both with two lines each: v += (n>>>1) ^ −(n&1) and idx = highest − code; if (code === 0) highest++.

The terrain decoder also reads optional extensions: a water mask (a 1-byte "all water/all land" flag or a 256×256 mask), and metadata that says which finer tiles exist. Every terrain vertex is converted from (u, v, height) to longitude/latitude/height to ECEF to world, again in 64 bits, and satellite imagery is draped on top. The imagery is Web-Mercator 256-pixel tiles from Esri World Imagery; up to 4×4 of them are stitched into one texture per terrain tile, falling back two zoom levels at a time if a tile is missing.

The seams

Cracks between tiles, and the apron that closes them

Neighboring tiles are made independently. Where a fine tile meets a coarser one, the fine edge has extra vertices that the coarse edge doesn't, so the two edges don't line up. This is a T-junction. The gap may be only centimeters, but at a grazing angle it becomes a one-pixel line where you can see straight through the world, or a dark sliver of edge-on geometry. On Google's tiles there are two kinds: centimeter gaps between tiles at the same level (from quantization) and steps of 1–1.5 m between tiles at different levels.

The classic fix for terrain is a skirt: a curtain hung straight down from every tile edge so any gap shows curtain instead of sky. Taos Explorer uses skirts on quantized-mesh terrain (5× the tile's geometric error deep, facing outward, together with 2:1 level balancing between neighbors). On Google's photoreal tiles, measured carefully, skirts are worse. In a controlled fresh-load A/B at a fixed grazing view, dark crack pixels measure 1.9% with no skirt, 4.0% with a shallow skirt and 9.1% with a deep one. Photogrammetry meshes are full of open edges (around every building, not just at tile borders), so curtains hang everywhere and their edge-on faces shade dark. The photoreal tiles use a different fix: the apron.

Interactive · a seam seen from the side
Rays from the camera (left) sweep across the seam. No fix: some rays slip through the gap to the black background, a crack. Skirt: those rays hit a vertical curtain, which is dark because it faces sideways to the light. Apron: a short flange angled 45° outward and down under the neighbor catches the rays with textured, sensibly lit geometry.

The apron, in buildTileApron, is built for each Google tile at decode time:

  1. Find the open edges. Weld vertices by position (quantized to 1 cm, so it works on unindexed, flat-shaded meshes) and keep edges used by exactly one triangle.
  2. Keep only border edges. Of those, keep the ones lying on a side face of the tile's bounding box (within 3 cm or 0.2% of the box size). The open edges around buildings in the middle of a tile are left alone, and so are the top and bottom faces.
  3. Extrude a chamfer. Each border vertex gets a twin at p + (outward − up) × width, a 45° flange outward and down, with width = 9% of the tile's horizontal half-size (about 1.6 m on a typical 35 m tile; 3% leaves cracks open).
  4. Mirror the texture. The twin's texture coordinate is taken the same distance inside the triangle, not copied from the edge. Copying would stretch the atlas's padding row into a visible band.
Part III · Lighting the world

Turning a pile of triangles into a lit, shadowed scene

Streaming hands the renderer around 600 tile meshes every frame. This part covers how a frame is organized, and how the sun, shadows and sky light are applied to those meshes.

The full technical detail is in the deep dives on the frame, lighting, shadows and motion, anti-aliasing and the lens (TAA, motion blur, exposure and the tone curve).

Organizing a frame

The frame as a graph of passes

A modern frame is not drawn in one go. It is a chain of passes, each reading images produced by earlier ones and writing new ones: first the geometry, then shadows, the sky and ambient occlusion, then lighting on top of the sky, then water, clouds and a stack of camera effects. Taos Explorer registers about 50 features with the engine, things like GeometryFeature, ShadowFeature and HQCloudFeature. Each feature contributes one or more passes, and the order of registration is the order of the pipeline. Features hand their results along through named slots on a shared Frame object (the G-buffer, the HDR image, the shadow map, depth, motion vectors).

The passes are assembled every frame into a render graph (src/renderer/render_graph/), which works a bit like a build system for GPU work:

  1. Virtual resources. Passes declare the textures and buffers they read and write by handle, not by real GPU object. Every write creates a new version of a resource, so "read the depth before the sky drew on it" is explicit, and reading a version nobody produced is an error.
  2. Culling. Starting from what must exist at the end (the screen, plus persistent resources like shadow maps and anti-aliasing history), it walks backwards and drops every pass whose output nobody reads. A disabled effect costs nothing.
  3. Pooling. Transient textures come from a pool keyed by size and format, handed out first-in-first-out. A static graph therefore gets the same physical texture for the same virtual one every frame, so cached views and bind groups keep hitting.
  4. One submission. All passes are recorded into one command encoder and submitted once. Each encoder is wrapped to drop redundant "set pipeline" and "set bind group" calls, and an optional profiler brackets every pass with GPU timestamps.

Rebuilding the graph from scratch each frame is cheap: it allocates only small JavaScript records for the fifty-odd passes of the default frame, and every GPU object comes from the pool. It isn't cached, because several passes capture per-frame data in their recorded closures, so the engine rebuilds it every frame.

Interactive · one real frame, pass by pass
Hover or tap a bar.
Measured with the engine's timestamp profiler in Chrome at 1280×720 on a desktop GPU. The whole frame takes 3.44 ms of GPU time in both views, but the cost moves: over the city, drawing the geometry dominates; facing the Cape Town horizon with clouds, the cloud ray-march is the biggest pass. The screen refreshes at 144 Hz, so the program runs at the 144 fps cap.

Deferred shading

Taos Explorer is a deferred renderer. The geometry pass doesn't compute any lighting. It only records, for every pixel, what surface is there: its base color, normal, roughness and metalness, and its depth. These go into a set of screen-sized images called the G-buffer. A single lighting pass then reads the G-buffer and lights each pixel exactly once.

The G-buffer here is six images: color and roughness, normal and metalness, emission, the shading-model data, material-extension multipliers and an anisotropy direction. Photoreal tiles never emit light and use none of the extensions, so their materials opt into a slim pipeline variant whose fragment stage writes only the first, second and fourth of those. WebGPU allows a shader to omit outputs for targets whose write mask is zero, so the other three keep their cleared values (black, identity multipliers, isotropic) and the city avoids paying the export bandwidth of twenty bytes per fragment for data it never has.

The benefit at planet scale is that lighting cost depends only on the number of pixels, not on the hundreds of overlapping tile meshes. Effects that need to know the surface (ambient occlusion, sky reflections, haze, clouds that stop at buildings, the depth-based sun flare) all read the same G-buffer instead of re-drawing the city. The geometry pass is still the single most expensive pass over a city.

The key light

Two suns and a real clock

The sun in Taos Explorer is the real one. The app keeps a simulation clock, a single instant in UTC, and computes the sun's direction for that instant from a solar ephemeris, in Earth-fixed (ECEF) coordinates. The floating frame (Part I) turns that into a world-space direction where the camera is. The rest is a small model on top:

The math · the sun's light (applySun)
day = clamp(sunup / 0.25, 0, 1)    color = (1, 0.97 − 0.32w, 0.90 − 0.55w),  w = 1 − day

Here sunup is the up component of the unit direction to the sun, so the light reaches full strength about 14.5° above the horizon and warms toward orange below that. Because the clock is real, the sun stands where it really does for the date and latitude: high over the tropics, low all day in a northern winter, up at midnight in an Arctic summer. The time controls and the ?time= parameter set the local hour at the place you are looking at (from its time zone), so "New York at 17:30" means 17:30 in New York on that day, and any lighting can still be reproduced exactly.

There are actually two sun objects. realSun always holds the true sun direction and drives the sky, the haze, the lens flare and the distant planets. It is never added to the scene. The scene's key light, sun, is what lights surfaces and casts shadows, and it changes role:

  • Day: it is the sun, warming toward orange as the sun gets low.
  • Night: it becomes moonlight, a cool (0.55, 0.66, 0.95), coming from where the Moon really is. Its intensity is 0.4 at most, scaled by the Moon's phase (the lit fraction to the power 2.5, so a half moon gives under a fifth of a full one's light) and faded out as the Moon sets.
  • Space: above 100 km (dropping back below 80 km, so it can't flicker at the boundary), or on the Moon or Mars, it becomes the full, unfiltered sun regardless of local time. Without this, the Moon seen from orbit would be a barely lit ball whenever it happened to be night under the camera.
Interactive · the sun on a real clock
elevation: azimuth: key light: intensity:
The arc is the sun's path across the sky dome over one day, seen from the equator side (east on the left in the north). The swatch is the key light's color and brightness: white at midday, orange near the horizon, and below the horizon it hands over to blue moonlight (drawn here for a full moon high in the sky). This demo uses a textbook approximation of the sun's declination and solar time; the app uses a full ephemeris and the place's time zone.
Shadows

Clipmap shadows: rings of detail around the camera

A shadow map is a depth image rendered from the sun's point of view: any surface farther from the sun than what the map recorded is in shadow. A single map can't cover both the building beside you and a ridge 4 km away at useful resolution, so the engine uses a clipmap. That is a stack of shadow maps with the same resolution, all centered on the camera, each covering twice the area of the one before:

  • level 0128 m across at street level: the sharpest shadows, right around you
  • each next level2× wider, so 2× coarser texels
  • up to 6 levelsat street level the widest is 128 m × 2⁵ = 4,096 m across (the graphics preset sets the cap: 4 on Low, 5 on Medium, 6 on High and Ultra; flying adds two more, up to 8)

Those sizes are the street-level ones. Each level is a box around the camera, so from 700 m up a 128 m box holds nothing but air: with fixed sizes, four of the six levels would shadow nothing, and shadows would stop 2 km out. The sample therefore sizes level 0 every frame from the distance to the nearest tile on screen, picking the smallest power-of-two box that can still touch it, and spends the levels it saves on reach (about eight altitudes). Nothing visible loses resolution, because only empty levels are dropped; from 700 m over Manhattan the same six maps carry shadows 8 km out instead of 2. Sizes change in power-of-two steps with some hysteresis, since every change re-renders all levels at a new texel size.

While the sun holds exactly still (the clock paused), each level is texel-snapped: it only moves in whole-texel steps as the camera moves, so shadow edges don't shimmer. On a running clock the sun direction changes every frame, and snapping to a grid that turns with the light would make the whole map jump, so the levels then simply ride the camera. Clipmaps also don't depend on which way the camera faces, unlike shadow cascades fitted to the view. (A frustum-fitted cascade mode and a depth-analysis "SDSM" mode exist in the engine; SDSM stays off here because tilting the camera visibly shifts its shadows.) Soft edges come from percentage-closer soft shadows (PCSS), and the sun direction is not quantized, so animated shadows sweep smoothly instead of stepping.

The catch is that the levels are concentric, so a building near the camera lies inside every level and is drawn into each of them. That redundancy is inherent to clipmaps, and it is why the level count is a performance dial.

Interactive · how many times is each tile drawn for shadows?
shadow reach: shadow draws: camera draws (for comparison):
Each dot is a streamed tile; tiles get bigger with distance, as the level-of-detail rules dictate. Squares are the clipmap levels. A tile inside several squares is drawn once per square, so darker dots cost more. Going from 8 to 6 levels removes the two outermost squares, which hold the most tiles; the far band they leave unshadowed is hidden by haze anyway.
Lower Manhattan in early-morning light without live shadows Lower Manhattan in early-morning light with long clipmap shadows across the blocks and river
shadows offshadows on
Lower Manhattan at 7:20 am, with the sun low in the east. Drag across the image. With live shadows, the towers throw long shadows west across the blocks and onto the Hudson. Photogrammetry already has the photographed (midday-ish) shadows baked into its colors, so live shadows matter most when the sun is low, and they keep the lighting consistent as the time of day changes.
Light from everywhere else

Ambient occlusion and sky light

Sunlight is only part of the picture. A street between tall buildings is darker than an open plaza because less sky can reach it. Two effects handle this:

  • Ambient occlusion (GTAO). For each pixel, the G-buffer's depth is used to estimate how much of the surrounding hemisphere is blocked by nearby geometry, within a 2 m radius. It runs on the High and Ultra presets; the engine also has SSAO, HBAO+ and CORTAO behind the same interface, but Explorer's settings offer only GTAO or off.
  • A sky reflection probe. The sky is captured into a small cube map (512 px per face, prefiltered to 256, on a desktop; half that on a phone) that supplies diffuse sky light and blurry reflections. Besides the sky it paints the real ground below, from the day imagery, and the real cloud deck, so glossy paint and glass reflect the land, the water and an overcast sky as they are. It is re-captured only when something it shows has changed: the sun has moved 1.5° (about six minutes of a real day), the cloud cover has changed, or the camera has traveled 3 km or changed altitude by about a third. One capture (6 faces plus filtering) is the single largest fixed GPU cost in the frame, and skipping it on almost every frame is invisible: the probe holds only soft, low-frequency light, and the sharp sun highlight comes from the analytic sun.
A night-time gotcha

The probe doesn't capture the physical atmosphere described in Part IV. It paints a cheap three-color gradient (zenith, horizon, ground) whose brightness follows the sun, down to a floor of a fifth of its daytime level. At night that dim copy of the day sky is nearly all the light there is, and on a moonless night it leaves the city close to black. The probe has an "ambient" setting, but it only applies to mesh captures, so raising it does nothing. Instead a cool blue "airglow" floor is added directly into the gradient colors, scaled by night = 1 − day, so daytime is pixel-identical while a moonless city reads as dim blue instead of black.

Water

Two kinds of sea

Water needs a different treatment from land: it is flat, it mirrors the sky at grazing angles, and it has to move. Taos Explorer has two ways of finding it, because its two surface sources describe water differently.

  1. Terrain tiles carry a water mask. Cesium World Terrain marks each tile as all land, all water, or with a 256×256 mask. When this water surface is switched on (it is off by default), the water tiles are drawn again after deferred lighting as a translucent surface that samples the mask per pixel (so the coastline is as sharp as the mask, not the triangles), reads the lit scene behind it as refraction, and adds animated ripple normals, a Fresnel sky reflection and a sun glint.
  2. Photoreal tiles don't. Google's tiles bake the ocean as flat textured meshes at sea level, with no mask at all. So a screen-space pass asks each lit pixel three questions: is it at sea level, is it flat, and does the imagery look like water? "Sea level" means the EGM96 geoid, mean sea level above the ellipsoid, which varies by more than a hundred meters around the world (about −33 m at New York); testing against the ellipsoid alone would flood low coasts in one city and dry the harbor in another. Pixels that pass get wave normals from an FFT ocean simulation, a Fresnel sky reflection and a sun glint over the baked color. This is the water you see by default.

The height test is a precision problem in disguise. Reconstructing a pixel's position from depth and subtracting a 6,378 km radius would discard every meter. Instead the pass measures against a tangent sphere anchored on the ellipsoid directly under the camera: the height is the distance along local up minus the sphere's sagitta, t² / 2R, with the position taken relative to that nearby anchor. The anchor, its east/north/up frame and the local radius of curvature are computed in double precision every frame; the shader only ever sees small numbers. The band it accepts as "sea level" is a couple of meters wide near the camera and widens with distance, where depth precision and the sphere approximation both loosen.

Part IV · The atmosphere

Painting air: the sky, sunsets and distance haze

Real air is a thin shell of gas and dust, about 60 km thick on this scale, that bends sunlight toward your eye. Getting it right is most of what makes a rendered planet look real. This part builds the engine's sky model from scratch and lets you run it.

The full technical detail is in the atmosphere deep dive.

The physics

Why the sky is blue and sunsets are red

Sunlight is white: a mix of all colors. As it crosses the atmosphere, some of it bounces off particles in the air and changes direction. That is scattering, and the light that reaches your eye from a patch of sky is sunlight that was scattered toward you somewhere along that line of sight. Three ingredients matter:

  • Rayleigh (air molecules)Molecules are far smaller than the wavelength of light, and they scatter short wavelengths much more strongly, in proportion to 1/λ⁴. Blue (440 nm) scatters about 4× more than red (680 nm). The engine uses βR = (5.5, 13.0, 22.4) × 10⁻⁶ per meter for red, green and blue. Its density falls off with height with a scale height of 8.5 km.
  • Mie (aerosols)Dust, water droplets and pollution are bigger, scatter all colors about equally (so they look white or gray), and scatter mostly forward, which gives the bright glow around the sun. βM = 21 × 10⁻⁶ /m, with absorption bringing extinction to 1.1 × that; scale height 1.2 km, so it hugs the ground. That is the engine's reference value; Taos Explorer gives Earth a clear day's 12 × 10⁻⁶ /m.
  • OzoneOzone doesn't scatter; it absorbs, mostly orange and green (βO = (0.65, 1.88, 0.085) × 10⁻⁶ /m), in a layer peaking around 25 km. It is why the twilight sky overhead stays deep blue instead of going gray.

Each kind of scattering also has a phase function: how likely light is to scatter by a given angle. Rayleigh is nearly symmetric, scattering forward and backward about equally. Mie is strongly peaked forward. The engine uses the Cornette–Shanks form with asymmetry g = 0.758 for the air, and (in Part V) a related function for cloud droplets.

Interactive · phase functions: where scattered light goes
Light arrives from the left and scatters at the center. Each curve's distance from the center shows how much light goes in that direction (on a compressed scale, or the forward Mie lobe would run off the page). Rayleigh is a fat peanut. Mie is a forward spike that sharpens as g grows. That spike is why the sky is brightest right around the sun.

How much air does sunlight cross?

How much light survives a path is its transmittance, given by the Beer–Lambert law: T = e−τ, where the optical depth τ adds up the scattering and absorption coefficients times the air density along the path. Straight up from sea level, the engine's numbers give Rayleigh τ = 0.047, 0.111, 0.190 (red, green, blue), Mie 0.028, and a little ozone. So the noon sun loses about 8% of its red, 15% of its green and 20% of its blue: it still looks white. Toward the horizon the path through the air is roughly 38 times longer. Blue is almost entirely scattered away before it reaches you, green mostly too, and what's left is the orange-red of sunset.

The model

A sky you can run: single scattering

The engine's sky (src/shaders/modules/atmosphere_model.wgsl) computes, for each view direction, the light scattered toward the camera exactly once on its way from the sun. It is a single-scattering model in the tradition of Nishita's 1993 paper. For one view ray it steps through the atmosphere, and at each step asks: how much air is here, how much sunlight reaches this point, and how much of what scatters here survives the trip to the eye?

The math · single scattering along one view ray
L = Isun Σk [ βR PR(μ) ρR(hk) + βM PM(μ) ρM(hk) ] · T(sun → k) · T(k → eye) · Δs
  • kone of 8–32 sample points along the view ray, more for long grazing rays
  • ρ(h)air density at that height: e−h/8500 (molecules), e−h/1200 (aerosols)
  • μcosine of the angle between the view ray and the sun
  • T(sun→k)8-step march from the point to the top of the atmosphere; exactly 0 if the planet is in the way
Interactive · the engine's sky model, running in your browser
direct sunlight color: ■samples per pixel: render time:
A full 360° panorama: the sun is in the center, the direction away from it at the edges, the horizon line across the middle. This is the same algorithm and the same constants as the engine's shader, ported line for line to JavaScript and evaluated at low resolution. Drop the sun toward the horizon for sunset reddening and the pink-and-blue twilight wedge opposite the sun. Climb to space and the sky turns black while the atmosphere becomes a glowing rim below you.

Several details in the shader exist because a simpler version would fail in a visible way:

  • Adaptive sample count. A ray straight up crosses 60 km of air; a ray skimming the horizon crosses hundreds. The number of samples is 8 + 24·√(length / grazing chord), so 14 straight up from the ground and 32 at the horizon, where the color changes fastest.
  • The planet's shadow. A sample point after sunset can't see the sun because the planet is in the way. A sun march that simply stopped when it dipped below ground would return "no air in the way", and for a moment after sunset the sun would flash bright white and un-reddened. So the march returns an optical depth of 10⁹ (zero light) whenever the path to the sun hits the planet.
  • Twilight fade. Real twilight glow comes from light scattered several times. Single scattering can't produce it, and leaves a permanent sunset band on the horizon long after dark. The sky is multiplied by sky_t = clamp((sun elevation + 0.12)/0.12), which reaches zero at about −6.9°, the end of civil twilight.
  • Ground bounce. The sunlit ground acts as a second, dim light source for the air near it. A cheap term (ground albedo × sunlight × an Oren–Nayar rough-surface factor, weighted toward low altitudes) brightens and warms the lower sky.
Doing it fast

Lookup tables: computing the sky 20,000 times instead of 2 million

Running that integral for every pixel of a 2560×1440 screen every frame would be wasteful. The sky changes slowly across the screen, so the engine computes it into a small sky-view lookup table (LUT): a 192×108 texture indexed by direction (azimuth relative to the sun, and elevation). It is re-baked every frame, about 20,000 evaluations, and every sky pixel then reads it with one filtered texture fetch.

The bake reads the same uniform buffer as the dome shader. Byte-identical struct declarations mean any live change (switching to Mars's coefficients, a new planet radius) flows into the table on the same frame with no extra code. That is why switching bodies needs no table recomputation.

The interesting part is how rows are spent. The sky changes fastest near the horizon, so the elevation coordinate is warped with a signed square root: v = ½ + ½·sign(l)·√|l|, where l is elevation ÷ 90°. From orbit, though, the horizon isn't at 0°: it dips below you by asin(√(1 − (re/r)²)). A "limb" mapping, on by default, re-centers the warp on that dipped horizon. At ground level it is identical to the default, so it costs nothing there, and from orbit the thin bright limb gets most of the table's rows instead of banding.

Interactive · where the sky-view table spends its 108 rows
rows within ±3° of the horizon: horizon dip:
Each line is one row of the table, drawn at the elevation it samples, from the zenith (top) to straight down. Linear spacing spends only a handful of rows near the horizon. The square-root warp packs them there, but from orbit the horizon has moved, and the dense band is pointing at empty space. The limb mapping follows the true horizon.

Three more small tables round out the sky:

  • transmittance · 256×64how much sunlight survives from any height in any direction. Baked once. The clouds use it to redden sunlight at dusk.
  • multi-scatter · 32×32light that scattered two or more times, using Hillaire's 2020 trick: assume it is isotropic and sum the bounces as a geometric series, Lms = L₂ / (1 − fms). Baked once. The haze uses it to fill shadows with soft sky light.
  • distant skylight · 2×1two texels: the average sky over the upper hemisphere, and around the horizon ring. The clouds use them as ambient light. Computing just two texels every frame would cost 0.5–1.2 ms (each one is a full hemisphere integral), so the result lives in a persistent texture and is only re-baked when its inputs change beyond a tolerance: camera altitude to 10 m, the local up and the sun direction to about 0.06°, atmosphere parameters exactly.
Distance

Aerial perspective: why far mountains are blue

The same scattering that colors the sky also sits between you and every distant object. Two things happen along that path. The object's own light is dimmed (by the transmittance T), and sunlight scattered off the air in between is added (the in-scatter). Painters call the result aerial perspective. It is the strongest depth cue in a landscape, and the most common reason a rendered city looks either fake or washed out.

The math · what reaches your eye from a distant surface
color = surface · T(d) + in-scatter(d)

The engine computes both terms ahead of time into a froxel volume (a grid of frustum-shaped voxels aligned with the camera): 32 × 32 screen cells × 32 depth slices. One compute pass marches each cell's ray once and stores in-scatter and transmittance at every slice. The depth slices are spaced quadratically, t = ((s + ½)/32)² × 128 km, so they are dense near you (the first two at 31 m and 281 m) and sparse far away. Unlike common implementations, transmittance is stored per color channel rather than as one gray value, so distant terrain shifts toward red as well as fading. The lighting pass then looks up every pixel's depth in the volume.

Interactive · haze density and the opacity cap
1/e distance: transmittance at 3 km:
Six ridges at 0.5, 2, 5, 12, 30 and 80 km. The air's extinction is (βR + 1.1 βM) × fogScale. At the physical value the nearest ridges are crisp and the last ones fade to sky. At 8, everything past a few kilometers turns to milk. The opacity cap limits only how much of the surface is hidden. Untick the last box to see why the in-scatter must be cut by the same fraction, or capped pixels get full haze added on top of a full-strength surface.

Density, not opacity

When city views come out pale and milky, the tempting fix is to lower the maximum opacity (hazeOpacity in explorer/main.ts). That treats a symptom: even at 0.1 a too-dense atmosphere still washes a whole city view toward white. The cause is the density. At a fogScale of 8 the air is eight times thicker than physical; its haze reaches 1/e in about 3.5 km instead of 28 km, so every city view saturates a few kilometers out. The sample uses 1.5, slightly thicker than clear air for a sense of depth, with the cap at 0.85.

Cape Town washed out to near-white by too-dense haze Cape Town with physically scaled haze: crisp foreground, blue distance
fogScale 8fogScale 1.5
Same view, same frame, one number changed. Drag across the image.
Cape Town with aerial perspective disabled: flat, over-saturated distance Cape Town with aerial perspective
no hazehaze on
And with no haze at all: the far shore looks pasted onto the sky, and the bay is an unnatural saturated blue.

Two more details close out the haze:

  • Converging to the sky. Far geometry should fade into exactly the color of the sky behind it, or distant ridges show a visible seam against the horizon. So the in-scatter is blended toward the sky-view table's color in the horizontal direction, weighted by how opaque the haze is. After sunset that blend is switched off: the horizon is still lit by far-off sunlit air while the air near you is in shadow, and converging toward it would paint a pale veil over the dusk landscape.
  • No NaNs from orbit. The analytic height-fog term computes exp(−optical depth). From orbit the optical depth can overflow, and infinity times zero produces not-a-number pixels that show as black holes on the planet. So the exponent is clamped to 32 first.
Climbing

From the ground to space without a seam

Many sky renderers assume the camera stands on the ground. Taos Explorer's camera can be anywhere: in a canyon below sea level, at 400 km, or 380,000 km away. The trick that makes this work is small. The dome shader puts the planet's center at its real position relative to the camera (ray origin = camera − planet center) and leaves the ray direction in ordinary world space. Every frame the sky coordinator (CurvedHorizonSky) maps the active body's center through the floating origin and hands over its local ground radius, so the same equations describe standing in a street and looking down from orbit.

Altitude (Earth)What changes
0 kmfull haze; sky-view table in its ground-level mapping
7 kmstars begin to fade in, even in daylight (12% of the 60 km shell)
30 kma soft blue limb glow starts to appear around the planet's edge
45 kmstars at full brightness (75% of the shell)
50–150 kmthe distance haze fades out; the cloud deck has already faded by ~40 km above its top
60 kmtop of the atmosphere: rays now start where they enter the shell, and the air becomes a band around the limb
100 kmthe key light becomes the full sun (switches back below 80 km)
32–319 kmthe camera's up-lock fades out; free flight
Cape Town from just above Table Mountain1 km
Earth from 400 km400 km
Earth from 3,000 km3,000 km

Beyond the edge of the streamed tiles, the sky shader paints a stand-in ground globe: where a view ray hits the planet sphere it shades a sunlit surface (procedural continents for Earth, flat gray for an airless body), seen through the atmosphere in front of it. Real tiles drawn later simply cover it. Near the limb, the painted ground blends into the horizon sky color so the last sliver of globe melts into the glow.

Standing below sea level

The atmosphere model assumes the camera is above the ground sphere. Jezero crater on Mars is 2–3 km below Mars's reference surface, so a camera standing in it would be "underground" as far as the math knows: the horizon would go black and the haze would turn into an opaque fog. The fix is one line. The ground radius given to the atmosphere is clamped to min(true radius, camera radius − 2 m), so the camera is always just above it, while the streamed terrain still shows the real crater floor.

Part V · Clouds, stars & night

Volumes of water, and points of light

Clouds are the hardest thing in the sky to render: they have no surface, and light bounces around inside them many times. Stars are the opposite problem: thousands of tiny, precise points that must stay sharp. Both are covered here.

The full technical detail is in the deep dives on volumetric clouds, rain, snow and wet weather and space, stars and other worlds.

Clouds · the shape

Building a cloud out of noise

Taos Explorer's clouds are volumetric: a 3D density field filling a shell around the planet, a kilometer or so above the lay of the land (1.2–3.2 km on the manual cloud settings; each weather type sets its own heights). There are no cloud meshes at all. For each pixel the shader walks a ray through the shell and asks "how much water is here?" at each step. The density at a point combines three ingredients:

  1. Weather: where clouds may form. A slow, large-scale noise (three octaves of value noise) varies the coverage from place to place, so the sky breaks into banks with clear gaps rather than an even sheet. The variation is mean-preserving: coverage × (1 + 0.7 × (2w − 1)), so the slider sets the average.
  2. Shape: the billows. A 128³ Perlin–Worley noise texture, which is smooth Perlin noise combined with the "cellular" Worley pattern that looks like packed bubbles, sampled with a period of about 20 km. A vertical profile per preset makes clouds flat-bottomed and rounded on top. The noise is remapped so that lowering coverage shrinks every cloud from its edges inward instead of thinning it uniformly.
  3. Erosion: the wispy edges. A finer 64³ noise (wispy Perlin and billowy Worley), with a period of about 935 m, is subtracted near the edges to carve fine detail and break up the "cauliflower" look.

The noise textures are baked images loaded at startup. The engine can generate cloud noise at runtime, but that noise is far too weak for this density model: it reads as thin wisps.

That recipe is the single-deck "classic" style, the default on phones. On desktops the default "layered" style builds the sky from up to four typed layers (cumulus, stratocumulus, altostratus, cirrus and others), each in its own height band. Each layer keeps the noise above a threshold set by its cover, and the layers are baked into a 256×256×40 volume around the camera that the march reads, with the fine erosion added as it goes.

Interactive · build a cloud layer, then light it
A 6 km wide, 2 km tall slice through the cloud layer. Step through the stages to see how the density is assembled, then light it. With one scattering octave, the light is plain Beer–Lambert absorption and cloud interiors go nearly black. Real clouds are bright inside because light bounces many times; the extra octaves fake that cheaply. Coverage acts on the square of the remapped noise, so low settings leave an almost empty sky. The default is 0.85, which the screenshots below use.
Cumulus clouds drifting over Cape Town's bay in afternoon light
The volumetric clouds over Cape Town, at coverage 0.85. Each one is a region of the noise field above the remap threshold, lit by an 8-octave multiple-scattering approximation and fading into the haze with distance. Imagery: Google Photorealistic 3D Tiles via Cesium ion

Clouds on a curved planet, in 32-bit floats

Each cloud layer lies between two concentric spheres (for the manual deck, the planet's radius plus 1.2 km and plus 3.2 km), centered on the real planet center. The ground they are measured from is a regional mean elevation from the ground map, eased over about ten seconds, not the terrain directly under the camera, so the deck doesn't bob up and down as you cross ridges and valleys. That raises the precision problem from Part I again. The obvious altitude calculation, length(p − center) − R, subtracts two numbers around 6.4 million in 32 bits and keeps only about half a meter of precision. The shader avoids it with a parabolic approximation that never forms R²:

The math · altitude without catastrophic cancellation (clouds_hq.wgsl)
alt ≈ (py − surfacey) + dx² + dz²2R
  • dx, dzhorizontal offset from the point directly below the camera, a few km at most

Ray–shell intersections solve the same parabola for the ray using the numerically stable form of the quadratic formula. The noise is also sampled in camera-relative coordinates, with the world anchor and wind offset folded into small per-layer phase offsets computed in 64 bits on the CPU. Without that, at world coordinates around 100 km the noise lookups would go coarse and the cloud deck would turn to "position-dependent popcorn".

The clouds also have to ride through every jump of the floating origin (Part I) without changing. Three things make that so. Where the camera sits in the noise field is a running noiseAnchor, advanced each frame by the camera's real travel in ECEF, not read from world coordinates; when the origin re-derives its axes (about every hundred kilometers, and on every airport jump), world X and Z point somewhere new, and a position read from them would swap the whole sky for a different one. The blend with last frame's clouds reprojects through the camera's previous view-projection, which already has the jump folded in, so the history lines up across it. And the cloud shadow map is stored relative to the camera and keyed on the planet center's world position, so a jump forces a rebuild instead of leaving shadows offset by the jump.

Interactive · altitude error in 32-bit floats
● length − R in 32-bit● parabolic, 32-bit● parabola vs true sphere
Every arithmetic step is rounded to 32 bits with Math.fround, for a point 1.5 km above an Earth-sized sphere. The naive method's error bounces between zero and half a meter, which is enough to make the cloud base shimmer. The parabolic form stays at millimeters. Its only real error is that a parabola isn't quite a sphere, and that grows as distance⁴: a few cm at 100 km and still under a meter at 200 km, the farthest a cloud ray goes.
Clouds · the light

Lighting a volume

At each step along the view ray, the shader works out how much sunlight reaches that point and how much of it scatters toward the camera, then dims everything behind by the step's own transmittance. The building blocks:

  • Energy-conserving stepseach step adds light × (T − T·e−σΔs), the light scattered by exactly the fraction of transmittance the step removes. This stays correct with large steps, where the naive light × σΔs would over-brighten.
  • Sun visibilitythe optical depth toward the sun: a short march over the first few hundred meters, then, for everything farther up-sun, a baked light volume (layered style) or a Beer shadow map (classic deck). The shadow map is two 512² sun-aligned maps, about 12 km and 120 km across for a 2 km deck, each texel summarizing the cloud along a 32-sample sun ray (its optical depth, and where the cloud starts and ends along it). Either way, one cloud can shadow another far down-sun, beyond the reach of a short per-step light march.
  • Multiple scatteringeight "octaves", following Wrenninge's approximation: Σ e−τ·ao · phase(g·ao) · ao with a = 0.5. Each octave pretends light penetrates further (smaller τ) and scatters more evenly (flatter phase), at less strength.
  • Phasea fitted approximation of real Mie scattering for 12 µm droplets (Jendersie & d'Eon 2023): a Henyey–Greenstein lobe blended with a Draine lobe, giving the bright silver lining when you look toward the sun through a cloud's edge.
  • Powdera darkening of thin edges seen away from the sun, where little light has had a chance to scatter in: the dark crinkles on a cumulus.
  • Color of the lightsunlight is reddened by the atmosphere's transmittance table at the cloud's altitude, so clouds catch sunset colors. Ambient light comes from the 2-texel skylight table: sky above for the tops, horizon ring for the bases.
The Grand Canyon from above, no clouds The Grand Canyon from above with a cloud deck and its shadows
clouds offclouds on
From 7 km above the Grand Canyon, looking down on the deck. The cloud shadows on the canyon come from a top-down map of the clouds' transmittance to the sun, baked from the Beer shadow map and read by the lighting pass for the sun; the clouds' god rays then darken the shadowed air above the ground.
Clouds · the cost

One pixel in sixteen, and a memory of many frames

A full-quality cloud march at full resolution would cost several milliseconds. The engine makes it affordable with a chain of shortcuts:

  1. Interleaved marching. Each frame, clouds are marched for one pixel of every 4×4 block (2×2 on the Ultra preset), a different one each frame, so every pixel is re-marched every 16 frames; up to 64 steps per ray by default.
  2. Empty-space skipping. In the layered style the baked cloud volume stores the distance to the nearest cloud, so the march jumps most of the way there through clear air. The classic deck, after 8 empty samples in a row, switches to cheap probes at twice the stride, using a coarser noise level and no erosion; on finding cloud it steps back and resumes fine steps.
  3. Jittered starts. Each ray goes through its pixel's center but starts at a different random fraction of a step, using "interleaved gradient noise" plus an offset that steps by the golden ratio each time the whole block has been covered. Any single frame is grainy, but each visit samples different points.
  4. Temporal reprojection. At full resolution, the fresh samples are upsampled with depth awareness and blended with last frame's result, reprojected to where it now appears on screen. At rest a pixel takes 15% of the new estimate each frame (30% on the frame it is marched itself; less with 2×2 blocks, which refresh four times as often), and more as the image moves, so motion doesn't smear. The history is clipped to the range of the fresh samples around it (mean ± 1.5 standard deviations), so stale colors can't linger as ghosts when things move.
  5. A fast path. If the four fresh samples around a pixel are exactly equal, as they are wherever no cloud is visible, the reprojection returns at once and skips about 40 texture reads. In a downward city view that brings the pass to 0.05 ms, against 0.8–1.0 ms without it.
Interactive · averaging noisy frames over time
Top: the true cloud brightness across a row of pixels. Middle: one frame's estimate, very noisy because each pixel took only a few jittered samples. Bottom: the accumulated result. With a weight of 0.05 the noise averages out; at 1.0 you see raw frames. Turn off reprojection while moving and the history smears behind the motion. Turn off clipping and edges trail ghosts when the reprojection is imperfect.

Where a pixel's fresh samples hold cloud, the reprojection uses the cloud's distance, averaged over the samples around it (one alone wanders with its jittered start), so a cloud passing close beside the camera keeps its history; over buildings and ground it takes the nearer of that and the scene depth. For clear sky it intersects the ray with a sphere halfway up the cloud deck, which gives the clouds proper parallax as the camera flies. Clouds only exist on Earth, and they fade out between 3 and 40 km above the deck so the whole effect costs nothing from orbit.

Weather

The Effects panel has a Weather selector with thirteen types. The cloudy ones follow the cover a pilot reads in a weather report: clear skies, few clouds (one or two eighths of the sky), scattered (three or four), broken (five to seven, with gaps) and overcast (a continuous deck for instrument approaches). Showers is towering cumulus with rain hanging under some of the cells: seen from afar, flown around or through (the rain comes and goes as you pass under them). High clouds is a sheet of altostratus at 5 to 6 km with cirrus above and clear air below it. Then light rain, rain, snow, storm, light fog and dense fog. Each type is only a row of target numbers: cloud coverage, density, base and top; ground-fog density; a rain or snow rate; the air's temperature against the standard atmosphere; and whether lightning may strike, plus the cloud types it brings (cumulus, stratocumulus, altostratus, nimbostratus, cumulonimbus, cirrus). The system eases the live values toward the selected row over about 22 seconds, so a change of weather rolls in. On Manual the Clouds and Rain settings are used as they are. Any weather type overwrites those settings as it goes, so the sliders show what the weather is doing, and they keep those values when you switch back to Manual. The N key steps to the next weather type, wrapping around (Manual is not in the cycle). The readout in the bottom-left corner shows the current weather and, in dynamic mode, the time until it next changes.

Snow falls as slow, drifting flakes around the camera, makes the air about 22 °C colder than standard (around −7 °C at sea level, so ice builds in cloud) and lies on the ground: it builds up over a minute or two of snowfall, settling first on level, open ground and last under dark green canopy, buries the grass, and stays while the ground is below freezing; it melts over about a quarter of an hour once it is not. Runways stay clear, as if plowed; roads, taxiways and aprons in the photo keep only a dusting. Snow also lies on the upper side of the tree crowns, in clumps, leaving their sides and undersides dark. Choosing Snow at the start of a flight puts the snow on the ground at once. Under a deck that covers the whole sky (overcast, rain, snow, storm), the base is lit by the light that diffuses down through it, so it reads gray rather than dark blue.

Dynamic weather is the default, starting with scattered cloud. With Dynamic on, the weather holds a type for 90 to 240 seconds and then moves to a neighboring one, chosen by weighted odds: clear skies cloud over before it rains, a storm only grows out of showers or heavy rain, dense fog only out of light fog, and snow only comes out of overcast, and only where it can snow (above 2,000 m, beyond 62° latitude, or beyond 33° in that hemisphere's winter, by the sim's date). The Pace slider speeds up both the holds and the transitions. In a thunderstorm a strike comes every 5 to 22 seconds: the cloud deck's ambient light is raised for a 0.7-second flicker, a faint wash covers the view, and synthesized thunder follows after the sound's travel time from the strike, which falls in the nearest storm cell within 20 km (at a random 0.6 to 7.6 km when there is none). Rain, the flash and the thunder all stop once the camera climbs above the cloud layer.

Live (METAR) takes the weather from the real world: the report of the nearest airport weather station (within 150 km), fetched through the game server from aviationweather.gov and refreshed as the aircraft travels or every ten minutes. The report's cloud layers set the cloud cover and base (the ceiling is the lowest broken or overcast layer), its visibility the fog, its present weather the rain or snow and any thunderstorm; its wind becomes the wind, its temperature makes the day warmer or colder than the standard atmosphere (thinner or thicker air, and the icing), and its pressure moves the pressure field, the altimeter being set to it. The readout shows the station, its distance, the wind, the temperature and the pressure. Choosing a weather type by hand turns it off.

With live weather on, the wind above the ground comes from a forecast: Open-Meteo's winds at seven pressure levels (1000 to 300 hPa), read for the aircraft's place and hour and again every 50 km. The station's wind holds near the ground and hands over to the forecast's between 300 and 800 m up, so the wind turns and strengthens as you climb; the readout shows the forecast wind at your altitude. In a multiplayer room that follows its host's sky, the host's live wind, temperature and pressure are shared too.

Where the rain falls

Rain does not fall evenly. Each rainy weather has cells, as a weather radar shows them: a grid of squares 15 km across, some of them holding a cell 1.5 to 10 km in radius with a strength (light, moderate, heavy cores in a storm), the pattern the same for everyone and drifting with the mean wind through the day. The same cells set three things: how hard it rains on the aircraft (half the cell's radar level, with a lighter rain between the cells), the rain shafts drawn under the clouds, and the picture on the weather radar in the cockpit. So the dark curtain hanging under a cell is where the radar shows rain and where it rains on the windshield. Showers rain only under their cells, dry between them.

Towering cumulus over a valley, rain shafts hanging under some of the cells.Showers: rain under some of the cells
Wind-driven waves on a bay in rain, rings spreading where drops land.Rain rings on San Francisco Bay

Rain wets the ground: soil and grass darken (water fills their pores), paving turns glossy, and once it is soaked, puddles stand on level ground, more on paving. It soaks in a minute or so of rain and dries over about twenty minutes. On the water, rings spread where the drops land near the camera, and the waves build with the surface wind the aircraft has. At night the rain and snow are dim, except where the aircraft's landing lights catch the drops and flakes near it. A lightning strike lights the ground and the aircraft for a moment, from a point a kilometer or two to one side, high above.

Wet ground and glossy paving after rain, puddles on the level.Soaked: darker ground, glossy paving
A runway at night lit by a lightning flash.A lightning flash at night

Seasons, snow and ice

The plants follow the sim's date: broadleaf trees turn gold and red in the fall and then go bare, their crowns thinned to twigs (conifers stay green); grass and fields turn straw-colored in winter, and on clear, cold nights and mornings a rime of frost lies on open ground. Spring comes later toward the poles and up high, the southern hemisphere's seasons are the other way around, and the tropics have none.

Bare winter woods and frosted fields around an airport.January: bare woods, frost on the fields

Real snow lies where satellites see it: NASA's daily MODIS snow cover (500 m), read through NASA GIBS for 64 km about the camera, for the sim's date or the latest day there is. A day's map has holes wherever there was cloud, so four days are read; a spot counts as snowy when two of them saw snow there, or one saw it plainly (a single weak reading is more often cloud). It is laid on the ground and the trees as the Snow weather's own snow is. In a wind over 6 m/s, lying snow drifts along the ground in a low stream around the camera.

The Lake Tahoe basin under real snow cover, the airport's runway plowed clear.Lake Tahoe under the day's real snow
Woods in fall colors around an airport in Vermont.October in Vermont

Ice builds on the aircraft in cloud or rain below freezing, and it shows: a white, rough rime on the surfaces that face the airflow (the nose, the spinner, the leading edges, the struts), and frost growing over the windshield from its cold spots, blurring the view through it. Parked on a frosty morning, the aircraft frosts over too, on its upper surfaces, and the frost is gone soon after it starts to move. Lakes and rivers freeze in a deep winter well away from the tropics, or in a hard frost: dark, glossy ice, white where snow lies on it; the sea does not freeze.

A light aircraft with white rime ice on its nose, spinner and wing leading edges.Rime on the leading edges
The cockpit view through a windshield covered in frost.Frost on the windshield

At a low sun the mountains shade the clouds as well as the ground: the terrain-shadow bake also records, for each point of the map, the height below which the air is in the terrain's shadow, and cloud below it loses the sun's direct light.

The weather briefing

Shift+B (or the Weather briefing button) opens a briefing for the departure (the nearest airport) and the destination (the flight plan's): the nearest station's report read out in plain words, with its flight category (VFR, marginal VFR, IFR, low IFR) and the report as sent; the forecast winds at 3,000 to 18,000 ft; the freezing level and the icing risk in cloud; and the radar cells within 40 km. It updates while open, as the reports arrive.

The weather briefing dialog: report, winds aloft, freezing level and icing, and radar for Medford.The briefing

Weather sounds

Rain hisses on the airframe; in the cockpit it drums on the canopy, louder and lower as the aircraft drives into it. The wind's noise follows the air's speed past the aircraft (so a gale is heard on the ground too) and swells and falls with the gusts. Falling snow muffles it. Thunder heard from the cockpit is a low, muffled boom.

The night sky

Nine thousand real stars

The stars aren't random dots. They come from the Yale Bright Star Catalog (BSC5): every star visible to the naked eye, 9,096 of them, each with its position (right ascension and declination), its brightness and its color temperature. The catalog ships inside the engine as about 190 KB of packed 32-bit floats. At startup an asynchronous job "splats" every star into a 4096×2048 sky texture (half that on phones), with procedural stars standing in until it is done:

  • brightnessastronomical magnitude m is logarithmic and backwards (smaller is brighter); light flux is 10−0.4 m, so each magnitude step is 2.5× dimmer. Stars down to magnitude 6.5 are drawn.
  • colortemperature in kelvin is converted to RGB with a blackbody curve fit (Tanner Helland's), then normalized to unit brightness, so temperature sets only the hue and flux sets how bright the star is.
  • shapea small Gaussian blob, slightly larger for bright stars, wrapping around at the 0°/360° seam

A procedural Milky Way is added on top, defined in galactic coordinates: a noise-textured band, a bulge toward the galactic center, and a dark dust rift down the middle. There is also an optional aurora: curtains whose noise is sampled around a circle (cos and sin of the azimuth) rather than by raw angle, so there is no seam where the angle wraps.

Interactive · the catalog, as a sky map
Hover a star.stars shown:
The 1,252 brightest stars from the same catalog (magnitude ≤ 4.8), on an equirectangular map: right ascension runs right to left, declination bottom to top. Orion is just right of center, with red Betelgeuse and blue-white Rigel. Lower the magnitude limit to see how few stars are truly bright; the faint ones are what make a dark-site sky feel full.

When should the stars show?

Two independent reasons make stars visible: it is night, or you are high enough that there's little air above you. The engine takes the larger of the two:

The math · star visibility (geo_sky.ts)
alt = smoothstep(0.12, 0.75, altitude / 60 km)    night = clamp((−sunelev − 0.05) × 10, 0, 1)
visibility = max(alt, night)    stars ×= e−6 · luminance(sky behind)

The last factor dissolves stars smoothly into bright sky (near the sun, or the bright limb) instead of cutting them off at a hard edge. On an airless body like the Moon the stars are simply always on, even in full daylight, which is exactly what the Apollo astronauts would have seen with dark-adapted eyes. A ray–sphere test against the planet keeps stars from showing through the ground from orbit.

Everest just after sunset with stars appearing in a purple sky
Everest just after sunset: the night factor is ramping up, and the stars are already brighter than the darkening sky.
Where the pole points

The star texture is in equatorial layout, so it has to be rotated into the sky you would see from the anchor. The rotation is the Greenwich sidereal angle of the same UTC clock that places the sun, so the celestial pole sits at an altitude equal to your latitude, the season's constellations culminate at midnight, and the sky turns as the hours pass. In space the applied angle is held still, since a fast clock would spin the starfield around the camera, and it eases back to the live angle on descent. The rotation is applied through the floating origin's east/up/north basis, so it survives re-anchoring, and it includes the axis swap that keeps the equirect from reading mirror-imaged from inside the sphere.

The daytime Moon

Why the Moon must not be pasted on the sky

From Earth, the Moon is drawn as an analytic ellipsoid (Part VI explains why). It is lit by the sun with a soft terminator. Simply replacing the sky pixels it covers would be right at night: the Moon blocks the stars. In daylight it looks wrong, a gray-and-black ball stuck on a blue sky, because its shadowed half is darker than the sky around it.

The physics says why. The Moon is 380,000 km away and the atmosphere only about 100 km thick, so all of the bright daytime air is in front of the Moon. The sky's light adds on top of the Moon's. So the body is composited with a weight that depends on how bright the sky behind it is:

The math · distant body over the sky (distant_body.wgsl)
wash = smoothstep(0.015, 0.25, luminance(sky))    out = mix(body, body + sky, wash)
Interactive · compositing the Moon over a sky
Left: the body replaces the sky, so its dark limb is darker than daylight. Right: the engine's blend. At night (sky brightness near 0) the two are identical and the Moon properly hides the stars; by day the dark side melts into the blue and the lit side becomes the pale wash you see in a real afternoon sky.
Part VI · Other worlds

The Earth, the Moon, Mars and the solar system in one continuous space

Most planet viewers show one planet. Taos Explorer puts the whole solar system in the same coordinate system. You can stand on the Earth, the Moon and Mars, go into orbit over every other planet and major moon, and fly between them without a loading screen, and each one is drawn correctly from any of the others. Doing that reuses everything above, and adds a few new problems.

The layout

One universe, centered on Earth

The Moon and Mars are not separate scenes. Every body lives in one "universe" space with Earth's center at the origin. The Moon is placed where the lunar ephemeris says it is at the simulation's UTC clock, and Mars and the other planets where the planetary ephemeris puts them:

BodyRadiusDistance from EarthNotes
Earth6,378,137 m (eq.)
6,356,752 m (polar)
0WGS84 ellipsoid
Moon1,737,400 m60 R⊕ ≈ 382,688 kmreal direction and distance from the ephemeris (distance adjustable 3–60 R⊕)
Mars3,396,190 m (eq.)
3,376,200 m (polar)
55–400 million kmits real place from the planetary ephemeris, held still from the moment a trip to it starts until you leave

The Moon and Mars tilesets are ordinary Tileset3Ds given two extra parameters. A body offset is a pure translation from the body's own centered coordinates into the universe, applied to both the baked vertices and the bounding volumes, so tile selection and culling agree with what is drawn. A region ellipsoid tells the tileset how to interpret geographic tile bounds on that body: a sphere for the Moon, Mars's own flattened shape for Mars. Because the offset is only a translation, each body's axes line up with the universe axes, and converting lunar or martian latitude and longitude needs no rotation.

The universe's axes are not always the Earth's, though. Earth-fixed axes turn once a day: in them Mars, hundreds of millions of km off, would sweep round the Earth at thousands of km a second, and the stars would wheel past a ship in deep space. So the frame changes with where you are. Near the Earth it is Earth-fixed (ECEF). Out between the worlds it is centered on the Earth with its axes held still, so the planets move only as fast as they really do. At Mars it is Mars' own axes about Mars, so its tiles stand still and the Sun, the stars and the Earth go round its sky once a sol. Every position is computed from the Earth's center in the J2000 equator and mapped into whichever frame is current; changing frame is a rigid move of the whole universe, made out in space where only spheres are drawn.

Where am I?

Choosing the active body

Every frame, one body is active: the one whose tiles stream and draw, whose sky the atmosphere renders, whose surface the camera's up-lock follows, and whose horizon sets the far plane. The choice is "whichever surface is nearest". Measuring to the surface rather than the center matters, or giant Earth would win almost everywhere. To stop the choice flickering back and forth near the midpoint, a challenger has to be 10% closer than the current active body to take over:

The math · active body with hysteresis (pickActiveBody)
surfaceDist(b) = max(0, |cam − cb| − Rb)    switch to b if surfaceDist(b) < 0.9 × surfaceDist(active)
Interactive · flying from Earth to the Moon and back
to Earth's surface: to Moon's surface: active body:
Drag the camera along the Earth–Moon line. Going out, the Moon takes over at about 177,000 km from its surface; coming back, Earth only takes over again at the mirror point. The shaded band of roughly 20,000 km in between is where the answer depends on which way you came from, so it can never flip-flop.

A lot keys off the active body: the camera's up and ground clamp, the shadow range, the pixel-error budget, the sky, the clouds (Earth only), the near and far planes, fly speed, place labels, the HUD, and the destination of the rocket button.

Precision, again

Why distant planets are painted, not streamed

Drawing every enabled body from its streamed tiles does not work. Standing on the Moon you would see Earth's tiles hanging in the sky, but also through the ground: a patch of Earth bleeding through the lunar hills. Two precision problems combine:

  1. Positions. Earth's tiles, seen from the Moon, sit about 7.8 × 10⁷ m from the floating origin. A 32-bit float there has steps of about 8 m. Projecting them subtracts huge, nearly equal numbers (catastrophic cancellation), and the computed depth comes out wrong.
  2. Depth range. To include Earth, the far plane would have to stretch hundreds of thousands of km. Even with the engine's reversed-Z depth buffer (depth 1 at the near plane and 0 at the far, which pairs with how floats are densest near zero), squeezing such a range starves the nearby terrain of precision.

The result: a distant body's depth sometimes "wins" against hills a few hundred meters away. Capping the far plane helps, but does not remove the problem; this does. Only the active body's tiles are drawn. The others are painted as analytic ellipsoids by a post-process pass, DistantBodyFeature, which:

  • runs only on sky pixels, those with background depth, so any real geometry in front automatically hides the body, with no depth test against it at all;
  • works out each body along the pixel's view ray analytically, in the body's own axes and in units of its own radius (computed in 64-bit on the CPU), so a planet 600 million km away is as well-conditioned in 32-bit floats as a moon next door;
  • lets the far plane hug the active body's own horizon (far = max(200 km, 1.15 × horizon + 100 km)), which keeps local depth precision tight.
Interactive · how precisely can the depth buffer tell two distances apart?
reversed-Z, at 300 m: standard Z, at 300 m: reversed-Z, at 10 km: vertex error at 78,000 km:
The smallest distance difference the depth buffer can resolve, at each distance, for a 32-bit float depth buffer. With standard depth (red), precision collapses with distance. Reversed-Z (blue) stays proportional to distance everywhere. Even so, the vertex positions themselves (gray, the step of a 32-bit coordinate at that distance) are meters off at Moon range, which is why far bodies are drawn analytically.

Painting a planet in a post-process

For each sky pixel the distant-body shader rebuilds the view ray from the inverse view-projection matrix, tests it against each body on the screen (up to 64: ellipsoids, some with rings), keeps the nearest hit, and shades it. In its simplest form, a sphere of one color, as the Earth, the Moon and Mars are drawn:

explorer/lib/space/distant_body.wgsl (simplified)WGSL
if (!dz_is_background(depth)) { return vec4(scene, 1.0); }   // real geometry always wins
let oc = cam - c;  let b = dot(oc, ray);  let disc = b*b - (dot(oc, oc) - r*r);
let t = -b - sqrt(disc);
let nrm = normalize(cam + ray * t - c);
let day = smoothstep(-0.08, 0.20, dot(nrm, sun_dir));          // soft terminator
var col = base * (0.025 + day);
if (atmo > 0.0) {                                                // rim glow for bodies with air
  let limb = pow(1.0 - max(dot(nrm, -ray), 0.0), 3.0);
  col += glow * (limb * atmo * (0.15 + day));
}
let wash = smoothstep(0.015, 0.25, luminance(scene));           // daytime sky in front
out = mix(col, col + scene, wash);

Earth gets a real photo: a "blue marble" image wrapped onto the sphere. The surface normal is turned into an ECEF direction with a 3×3 world-to-ECEF matrix supplied each frame, then into longitude and latitude to look up the photo. Because that matrix comes from the current floating-origin frame, the continents stay put as the origin moves. The Moon is plain gray with no atmosphere; Mars is rust-colored with a thin rim. The other planets and moons get far more: procedural surfaces, cloud bands, rings, shadows and photo maps (the solar system, below). Under a few pixels across, a body becomes a point of light as bright as its real magnitude, on the same scale as the stars.

Interactive · a distant body, behind a lunar horizon
The planet is computed per pixel from a ray–sphere test, a soft terminator and, for Earth and Mars, a rim glow. The ground in front is a separate layer with real depth; the planet pass only touches pixels where nothing else was drawn, so a body sinking behind the horizon is cut off cleanly no matter how far away it is. (Earth's continents here are procedural; the engine uses a photo.)
Earth, small and blue, above the lunar horizon under a starry black skyEarth from the Moon, at its true size: about 1.9° across
The Moon's cratered surface from 300 km upThe Moon from 300 km: now the active body, fully streamed

There is a trade-off: a far body is a lit ball, not its detailed data. Its real tiles only stream once it becomes the active body. In practice the switch happens while you're still far away and moving fast, and the sphere is pixel-for-pixel where the tiles will appear.

The rocket

Twelve seconds to the Moon

The rocket button cycles Earth → Moon → Mars → Earth, picking a random bookmarked place on the destination. The flight itself is simple. It's a straight line through universe space, eased with a smootherstep curve, with the camera looking along its path. A trip of more than 2 million km (to Mars) takes 16 seconds instead, and crosses the gulf on a log scale: the distance left falls by the same share each moment, so the last thousand km take as long as the first hundred million.

The math · the flight (advanceFlight)
u = t / duration,   e = u³(u(6u − 15) + 10),   position = start + (end − start) · e
duration = clamp(distance / 10,000 km, 7 s, 12 s)    arrival height = max(3 km, 0.3% of the radius)

The interesting parts are around the line:

  • Immune to re-anchoring. At about 60,000 km/s on the way to the Moon, and far faster on the way to Mars, the floating origin jumps every frame. The flight is computed in universe ECEF, with 64-bit start and end points, and converted to the current world frame only to place the camera, so the jumps can't accumulate error.
  • A moving target. For the Moon the end point is recomputed every frame from its current orbital position. Mars is held still for the trip.
  • A straight line is safe. Earth is only ever reached from another body, so the chord never passes through a planet.
  • The hand-off. On arrival, the program builds a new frame at the destination and starts streaming its tiles. Until the first tiles arrive the destination isn't "live" yet, so the previous body stays active and the destination is still drawn by the distant-body pass, exactly where its tiles will appear. The gap is invisible.
  • Level horizon on arrival. The flight writes yaw and pitch in the normal +Y-up convention, but the camera's tilted up vector is still frozen at the departure body's radial, and in deep space the up-lock is zero so it never corrects itself. Left alone, arrivals would come out with a rolled horizon, so up is reset to +Y at arrival.
Interactive · the Earth → Moon flight
distance flown: speed: floating-origin jumps: active body:
The top line is the trip; the curve below is speed over the 12 seconds. The smootherstep curve has zero speed and zero acceleration at both ends, so departure and arrival don't jolt. Peak speed is about 60,000 km/s, and with a 10 km re-anchor threshold the origin moves on essentially every frame.
The Moon

A Moon that orbits, and stops when you land

The Moon is where it really is. Each frame its position is recomputed from a lunar ephemeris on the simulation's UTC clock, so it rises and sets, goes through its phases and lights the night only when it is up (with the Moon below the horizon, or new, the land is nearly black). Only its distance is a liberty: the Moon dist setting can pull it in to shorten the trip. In Earth-fixed coordinates it sweeps around the planet once a day. Re-baking its tiles every frame as it moves would be far too slow. Instead the tiles are baked once at a reference position, and each frame:

  • every Moon draw gets a world translation equal to the orbit's offset from that reference;
  • tile selection uses the camera position shifted the opposite way, so screen-space error is measured as if the Moon hadn't moved;
  • the frustum's culling planes are shifted to match (d′ = d + n·shift). Without that last step the culling test would be misaligned and cut the Moon into wedges.

The orbit must freeze when you stand on the Moon, or the ground would slide out from under you. It stops when the place is lunar, when the Moon is the active body, or when you're simply closer to the Moon's surface than Earth's. The first condition closes a subtle window: right after arriving, before the Moon's tiles stream, the active body is still Earth, and in those few seconds the orbit would carry the surface about 100 km away, leaving the "Earthrise" bookmark's camera hanging far above the ground or buried under it. Once frozen with more than 50 km of accumulated offset, the Moon is re-baked once at its new position, so the vertices aren't left carrying a large shift into 32-bit floats.

A few more Moon-specific touches:

  • Earthrise places you so Earth sits about 18° above the horizon: the direction toward Earth, rotated 72° about a surface tangent.
  • From far away the Moon reads as a bright ball because its albedo texture doubles as an emissive map, ramped from 0.22 near the surface to 6.0 at 80,000 km. That stands in for the ambient light an atmosphere would provide, and the ramp only gets strong far beyond approach range, so crater shading isn't flattened as you descend.
  • A lunar eclipse is worked out from both sides. On the Moon, the Earth covers the Sun: the key light falls with the share of the Sun's disc left and turns copper in the umbra. From the Earth, the Moon goes copper in the Earth's shadow (eclipses, below).
The hills and valley floor of Taurus-Littrow, the Apollo 17 site, from low over the valley under a black sky
The Apollo 17 landing valley, Taurus–Littrow. No air means no haze, no blue sky, and stars at full strength.
Mars

Four details behind a butterscotch sky

Mars shares the Moon's code, generalized from one extra body to N. Four details make it look right:

  1. Mars isn't round. Mars, like Earth, is flattened: 3,396,190 m at the equator and 3,376,200 m at the poles. With a sphere of the equatorial radius, the painted globe, the horizon and the clipping planes would sit up to 2 km above the real terrain, so the tiles would draw but be hidden, visible only in a band of altitudes. So they use the true ellipsoid (radius at latitude A·C / √(C² cos²φ + A² sin²φ)).
  2. No 5 km leash. Tileset3D has a default maximum draw distance of 5 km, sized for dense OSM building sprawl. On Mars that would cut the terrain off at a sharp edge a few km away, leaving a sky-colored gap below the horizon, so planetary terrain draws to infinity. The Moon does the same; there the gaps would let Earth show through the lunar hills.
  3. Underground air. Jezero's floor is below the datum, so the camera would be "inside the planet" to the atmosphere math without the ground-radius clamp in Part IV.
  4. White-out. Even a weak haze washes the surface to white at grazing angles, because the opacity cap limits extinction but not the additive in-scatter. On a world with 1% of Earth's air pressure, aerial perspective just doesn't belong, so for Mars it is switched off entirely while the sky dome keeps its color.

The color itself comes from swapping the Rayleigh coefficients live: βR = (21, 12, 6) × 10⁻⁶ per meter, reversed from Earth's so red scatters most, with a 9 × 10⁻⁶ Mie term and an 80 km shell. That gives the butterscotch dome. It's a stylization: Mars's real sky color comes from suspended dust rather than gas. A side effect is that the low Martian sun loses red first and turns bluish-white, loosely echoing real Martian blue sunsets, though for a different reason. Sunlight is tinted (1, 0.93, 0.84) at 0.78× strength. All of it is set through the same live uniform overrides as Earth's defaults, which are re-applied every frame, so leaving Mars restores a blue sky.

Mars from 600 km: rust terrain, craters and a glowing limbMars from 600 km
The front of the delta in Jezero crater, in sharp HiRISE detail, with coarser terrain beyond and a butterscotch skyJezero crater: the delta's front in HiRISE detail, under the butterscotch sky

The limb glow in the orbital view takes its tint from the body's own Rayleigh coefficients (normalized to the strongest channel), so Earth's rim is blue and Mars's is rust without a per-body color table. The painted globe that fills gaps between streamed tiles follows the same rule: only Earth gets the procedural continents and oceans; Mars shows its flat rust albedo there.

The other planets

A solar system that is never streamed

Beyond the Earth, the Moon and Mars, nothing is tiled terrain. Mercury, Venus, Jupiter, Saturn, Uranus, Neptune, Pluto and 20 major moons are the distant-body pass's ellipsoids at every distance, even in orbit a few hundred km over Jupiter's clouds. That works because the pass needs no geometry, only a few numbers per body: where it is, how it is turned, its radii and its look. A trip to any of them arrives into a circular orbit at the real speed for its height.

  • Where they are. JPL's planetary elements for the planets; for the moons, the theories in Meeus' Astronomical Algorithms (Jupiter's and Saturn's) and JPL's satellite mean elements; each body turned by the IAU's rotation models. Jupiter's Great Red Spot is tracked as it drifts, so it is drawn where it is today.
  • How they look. Procedural surfaces: craters on rocky moons, Io's volcanoes, Europa's cracks, Enceladus' tiger stripes, Iapetus' dark half; cloud bands on the giants, carried round at each latitude's measured wind speed. Jupiter wears Hubble's 2015 global map, and fifteen moons wear USGS maps from Voyager, Galileo and Cassini, with the procedural surface filling the gaps in them.
  • Rings and shadows. Rings are a plane through the equator, lit as a thin layer of scattering particles from their published optical depths. The planet shadows its rings and the rings shadow the planet, and moons cast shadows on their planets and fall into theirs.
  • Brightness. From the ground the planets are points of light as bright as their real magnitudes (the Astronomical Almanac's formulas), on the same scale as the stars, so Venus and Jupiter outshine everything else at dusk.
  • The asteroid belt. 150,000 asteroids from JPL's Small-Body Database (40,000 on phones), each one moved along its own orbit in the vertex shader every frame and drawn as a point. Out in space the belt is brightened so its shape shows: the Kirkwood gaps and Jupiter's Trojans.
  • Comets. A glowing coma, an ion tail straight away from the Sun and a dust tail curving back along the orbit, growing as the comet nears the Sun.
  • Close up. Lumpy bodies get real meshes near the camera: Phobos and Deimos from published shape models, named asteroids and comet nuclei as a rock scaled to their measured size. In Saturn's rings, on High and Ultra, the ring plane gives way to real ice chunks orbiting at their own speeds.

The space deep dive has the shaders and the numbers.

Shadows of worlds

Eclipses that arrive on their own

With the Sun and Moon placed to within arcseconds, solar eclipses happen by themselves, at the right place and minute. The renderer only has to show them. The program hands every pass the same description of the Moon's shadow (the Moon's center and radius, the shadow's axis, the Sun's distance and size), and each pass works out how much of the Sun's disc is left at its own points:

  • The ground and the air. The lighting dims each pixel by the Sun left there, so a hill outside the umbra stays sunlit while you stand in the dark. The sky does the same along each view ray, which gives totality its sunset all round the horizon.
  • The Sun and the corona. As the Moon closes in, the Sun's disc eases to its true size. The Moon's limb is jagged, so the last light through its valleys makes Baily's beads and the diamond ring, and then the corona and the pink prominences come out, shaped by where the Sun is in its 11-year cycle.
  • Small things. Shadow bands ripple over light ground in the last minute before totality, and under trees the gaps in the leaves throw crescent images of the Sun.
  • The eye. The exposure adapts as the light goes, so 99% coverage reads as a strange dim day rather than night, and totality as deep twilight with the bright stars out.
  • Lunar eclipses. From the Earth, the Moon turns copper in the Earth's shadow, lit by every sunrise and sunset on Earth at once. From the Moon, the Earth covers the Sun, and its air shows as a thin red ring.

The space deep dive has the shadow math, and the Science and engineering overview how the eclipse times compare with NASA's Canon.

Satellites

Sixteen thousand points of light

From orbit, the optional satellite layer shows every object in a public catalog snapshot: 15,995 of them, 10,741 of which are Starlink, plus the crewed stations. Each is placed with SGP4, the standard orbital model the published elements are fitted for, at the real time of day rather than the simulation clock, so whether an object is in Earth's shadow matches the sky you see. A sunlit object glows; an eclipsed one is dimmed (or, with "sunlit only", left out, which gives the dusk satellite-spotting view). The layer exists only between 100 km and 100,000 km up, or on the ISS ride; on the ground the catalog isn't even downloaded.

Sixteen thousand orbits are too many to compute every frame, so the work is split. A rolling slice of 1/120 of the catalog is refreshed each frame, keeping every object within about two seconds of where it should be, and only the objects in view are recomputed every frame. The view test can't use the camera's far plane, which hugs the horizon a few hundred kilometers out while satellites orbit 400 to 35,000 km away; it is dropped, and a line-of-sight test against Earth culls the objects behind the planet instead. The International Space Station is drawn as a 3D model when you're near it. The full detail is in the space deep dive.

The plane

A small flight sim in the same world

The plane button puts you in a Cessna 208 over whatever is streaming. You don't fly it directly. The mouse steers an aim point, drawn as a ring; an autopilot banks and pitches the aircraft toward it, and a small cross shows where the nose is pointing now. The camera looks along the aim, so flying is a matter of looking where you want to go.

  • mouseaim (click the view to capture the pointer; on a touch screen, drag)
  • W / S, A / Dpitch and roll by hand, overriding the autopilot on that axis
  • E / Qthrottle up / down; Shift is a speed boost
  • Spacewheel brakes
  • V, Mchase or cockpit view; sound on or off
  • Backspacereset: back in the air above where you are
A white and red single-engine aircraft banking over Manhattan, seen from behindChase view
The instrument panel and windshield from the pilot's seat, with the city belowCockpit view
The same aircraft far above the Earth, with the curved horizon and a dark sky20 km up

Where the aircraft lives

Like the rocket, the aircraft is simulated in ECEF with 64-bit numbers: position, velocity and attitude all live in the planet's own frame, and are converted to the floating world frame only to draw the model and place the camera. Re-anchoring the origin therefore can't disturb the flight, and "up" is just the direction away from the planet's center at wherever the aircraft is. As it travels, the aim point is carried along with that turning vertical, so level flight stays level around the curve of the globe.

The flight model

The aircraft is a rigid body in moving air. Each step the model takes the velocity in the aircraft's own axes, reads off the angle of attack and the sideslip, and from them computes:

  • Lift, perpendicular to the airflow: linear in the angle of attack up to 15°, collapsing past it (the stall).
  • Drag, along the airflow: a fixed part plus the cost of making lift, so turning and climbing cost speed.
  • Thrust from a constant-power propeller: strong standing still, fading with speed. Near idle the propeller turns from pulling to braking, which is most of how the aircraft slows down, in the air and on the runway.
  • Moments about all three axes: the nose seeks the airflow, the wings level out of a slip, and the control surfaces push against both. Rolling with the ailerons swings the nose the other way first (adverse yaw: the rudder is for that), a yaw rolls the wings into it, flaps pitch the nose, and the propeller's torque and the spiral of its slipstream want to turn the aircraft left at high power.
  • The stall, strip by strip: the wing is cut into strips across its span, each at its own angle of attack (higher on the down-going wing of a roll, lower toward the twisted-down tips). One wing lets go first and drops, its partner keeps flying, and the stalled side's drag swings the nose toward it: held there, it spins. The airframe shakes (the buffet) as the stall begins.
  • Engines that take time: a turbine winds up slowly from idle (some seven seconds for the jets), and the fuel they burn makes the aircraft lighter; the center of gravity moves with the fuel, and with empty tanks the engine stops.
  • The landing gear: each wheel's spring takes its share of the weight, the struts soak a landing up rather than bounce it back, the tires grip sideways by their slip angle (a crabbed touchdown straightens out), the rudder pedals steer the nose wheel, and braking with a pedal brakes that side harder.
  • The air is the standard atmosphere (temperature, pressure and density by height), the wind weakens toward the ground, and turbulence is random gusts whose size depends on the height: slow swells up high, sharp jolts down low.

Nothing holds it up for you. Pull too hard or fly too slowly and the wing stalls; the air thins with altitude and takes lift and power with it. With the numbers of a Cessna 208 it cruises near 150 knots, glides at about 13 to 1, and leaves the ground at around 70 knots. The tail sits in the propeller's slipstream, which is what lets the nose come up before the wing is flying.

How close each type comes to its book is measured, not assumed: a scripted pilot flies every fixed-wing aircraft headless through a phugoid, a Dutch roll, a stall and its recovery, a takeoff and a landing, and a wind tunnel holds it still to read its lift and drag. The validation report sets each result against the published figure, with the misses that are still understood rather than fixed.

The mouse sets an aim point, and an autopilot flies the aircraft toward it the way a pilot would: it steers the flight path (not the nose) onto the ring, so the throttle sets the speed; it banks toward the ring, to 45° at most, lets the lift pull the nose around, and uses the rudder only to keep the turn tidy. A 90° turn takes about fifteen seconds, and the ring leads the nose the whole way. On the runway, holding the pitch key raises the nose to a takeoff attitude and holds it there, and for a few seconds after liftoff it stops short of the stall; after that the keys have the whole elevator. The model sits behind a small interface (stick and throttle in, new state out), so another can replace it without touching the rest.

The mouse aim is optional. Controls (C) switches to direct control: no ring and no autopilot, and the keys are the stick, the rudder pedals and the trim, laid out as in desktop flight simulators, except for their function keys, which a browser keeps for itself (help, find, reload).

ControlKeys
Pitch (elevator)W / S, or numpad 8 / 2, or the up / down arrows. Forward is nose down.
Roll (ailerons)A / D, or numpad 4 / 6, or the left / right arrows
Yaw (rudder, and nose-wheel steering on the ground)Z / X, or numpad 0 / Enter. These also work with the mouse aim.
ThrottleE / Q
Elevator trim= / −, or numpad 1 (nose up) / 7 (nose down)
Flaps (direct control only; automatic with the mouse aim)] / [, a notch at a time
Wheel brakesSpace, or numpad Del
Reverse thrust (on the runway; the Caravan and the 777)Hold R; the throttle sets reverse power
Speedbrakes (the Panther's dive brakes, the 777's spoilers; the 777's also deploy by themselves on the runway once the throttles close)\ (backslash), in or out

The stick has travel: it moves toward what a key asks at a finite rate and springs back when released, the elevator to its trimmed position. The chase camera follows the aircraft instead of the ring, and the mouse looks around: the pilot's head in the cockpit, the camera swinging around the aircraft outside. The view drifts back to straight ahead three seconds after the mouse stops.

Touching the ground

On the ground the aircraft becomes a small rigid body with nine contact points: three wheels, and skids at the propeller, tail, wing tips, roof and fin. Each is a spring and damper pushing up from the ground beneath it. Wheels roll forward and grip sideways; skids just drag. The forces turn the airframe through its moments of inertia, so it settles on its gear, rotates on takeoff, and drags a wing if you put it down badly.

"The ground beneath it" comes from the same colliders that keep the free camera above the tiles: each frame a short vertical ray is cast under every contact point. Two details matter:

  • The ray starts only 3 m above the point. Starting it 30 m up would make a roof overhead count as ground the aircraft is 30 m inside, and the spring would fire it into the sky at 200 knots.
  • Walls need their own ray. A ray cast downward never sees a building's side, so a second ray runs from the aircraft to where its nose will be at the end of the frame. A hit there, an arrival faster than 9 m/s downward, or a contact point more than 2.5 m under the surface is a crash: the wreck sits for two seconds, then the aircraft is put back in the air.
  • The wings need rays too. The nose ray only covers the centerline. Each of the airframe's extremities (wing tips, propeller, tail, fin, roof) also sweeps a line from where it was last frame to where it is now, and anything solid on that line is a crash: a building a wing clips, a hillside met at a shallow angle.
  • Colliders must outlive the view. Only tiles inside the camera's view are drawn. A camera that looks ahead does not see the ground beneath it, so if colliders were retired with their tiles, the aircraft would have solid ground only in the distance in front and nothing underneath, and fly through ground and buildings it had just been looking at. So a collider is kept while it is in reach and its tile has left the view; one whose tile is still in view but no longer drawn has been replaced by another level of detail, and goes.
  • Under the world is a crash. The scan is one surface draped over ground and buildings, with nothing behind it, so an aircraft that gets underneath meets nothing more. Something solid above the aircraft and nothing at all below it means it is under the surface. (Under a bridge there is ground below, which is the difference.)
  • The ground around the aircraft is selected whether or not it is seen. Tiles within 250 m of the aircraft pass the view test regardless, so the ground under and behind it is loaded and gets colliders; and colliders are built around the aircraft, not the camera, which can be far away in the fly-by view.
  • A replaced collider waits for its successors. When finer tiles replace a coarse one, their colliders are cooked a few per frame. The old one is kept (for at most two seconds) until the tiles that took its place have colliders, so there is no frame without ground during the hand-over.

Collision view (K, or COLLISION VIEW in the settings panel) shows what the aircraft can actually hit. Tiles are washed green where they have a collider, orange where one is waiting to be cooked, and red where the tile carries no collision data; the collision mesh within 70 m of the aircraft is drawn as lines (magenta for a collider whose tile is not being drawn). The readout adds the number of colliders, how many are waiting, and the distance to the ground under the aircraft, or says that there is none.

A moving object in a static world

One moving object breaks three assumptions made for a world that never moves:

  • The near plane. It grows with altitude (0.05% of it) to keep depth precision over a planet-sized view. The chase camera sits 26 m behind the aircraft, so from about 35 km up that near plane would slice into the tail, and above 50 km it would pass the aircraft entirely. In flight it is pinned at half a meter (8 cm in the cockpit); reversed depth keeps the precision.
  • Temporal reprojection. Anti-aliasing and motion blur find each pixel's previous position from the camera's motion alone, which is right for static tiles. An aircraft that moves with the camera would get its history from the ground behind it, and smear. So a velocity pass records true motion for the aircraft's draws only; every other pixel stays zero, which both effects read as "use the camera".
  • Shadow levels. The clipmap sizes its finest level from the nearest geometry, which in flight is the aircraft beside the camera. That keeps its own shadow sharp, and two extra levels (eight in all) restore the reach over the ground below.

The cockpit view adds a fourth and fifth. Anti-aliasing checks that a pixel's history held a surface at the depth this one "had" last frame, again assuming a static world; a panel half a meter from a camera doing 50 m/s would fail that test every frame and its fine print would shimmer, so recorded movers are taken at their current depth. And the screen-space contact shadows, which march the depth buffer toward the sun, would turn the propeller into a strobing shadow across the dashboard; they are switched off while you sit in the cockpit.

The instruments are live. Each needle is its own small part, pivoted at the center of its dial, and is pointed from the flight state through a table read off the dial's artwork: airspeed, the altimeter's three hands, vertical speed, the attitude indicator's horizon and pitch ladder, the heading card, the turn coordinator, the clock (your local time) and five engine gauges that follow the throttle. Outside, the aircraft carries its lights: red and green on the wing tips, a red beacon flashing on the fin, white strobes, and landing lights that come on with the flaps.

The cockpit also brings back the oldest problem in this guide. World coordinates are 32-bit, and with the origin re-anchoring every 10 km a millimeter of rounding at that distance is invisible on a tile hundreds of meters away, but the instrument panel is under a meter from the pilot's eye, where a millimeter is a whole pixel, so the dials would jitter more the farther you flew. While flying, the origin therefore follows within 250 m in the cockpit view (2 km in the chase view), and the ground colliders are slid along with it instead of being rebuilt.

Rain falls only below the clouds: full strength under the cloud base, thinning through the lower third of the cloud, none above, and none in space. The drops fall straight down around the camera and know nothing about the aircraft, so a collider sphere around the cabin stops them from falling through the roof. In the cockpit view a screen-space pass adds drops to the glass. It needs no glass geometry: "the glass" is every pixel whose depth is beyond the cabin, so the drops bend the world outside and leave the dashboard alone. Slow, they run down; at flying speed the airflow pushes them up.

The windows themselves are a small forward pass over the lit image. The model's panes are alpha-blended and the airframe is drawn deferred, which has no blended stage, so the panes are drawn afterward and tested against the scene depth by hand. Each pane adds a reflection by Fresnel (the sky from outside, the dark top of the instrument panel from the pilot's seat), a glint of the sun, a slight tint, and a film of smudges and scratches that brightens when you look toward the sun. The reflected sky is a two-color gradient scaled from the sun, not the rendered sky.

The explorer opens on a start screen: choose the mode (flight, the default; training, which lists the lessons and starts the one picked at its own airfield; free navigation; or a ride on the space station), where to start (a runway found by searching the airport table, the runway last used, or one of the places), open the settings or go fullscreen if wanted, and press the play button. Nothing moves until then. The start screen is a page of its own over a still aerial picture of Happy Camp, California, with none of the flight's HUD; in flight the menu button at the top left (and Esc) brings up a pause menu instead (Resume, Restart, Settings, Main Menu), and Main Menu goes back to the start screen. Beside the menu button are the aircraft toggle and, with the free camera only, the run toggle and the rocket to the Moon and Mars. A link that names the mode skips the screen: ?plane=1 flies at once, ?plane=0 opens on the free camera, and ?start=0 skips it with the default mode.

The aircraft is chosen on the start screen. Two of them are the Caravan and an F9F-5 Panther, a straight-wing jet fighter of about 1950. Each is an entry in explorer/lib/aircraft/aircraft.ts: where its center of gravity, pilot's eye, lamps and strike points are on the model, and the numbers its flight model runs on. The jet weighs twice as much on a smaller wing, so it leaves the runway near 115–130 kt and tops 500 kt; its engine is a thrust that barely changes with speed (and never quite reaches zero at idle) instead of a propeller, and it sounds like one. Its model has no moving control surfaces and its instruments are the Caravan's, but its landing gear retracts, folding into the wings and the nose in four seconds. Training on the start screen flies the Caravan unless another aircraft that has lessons is picked; a lesson flown in the Panther is given that aircraft's speeds and more room. The Panther model is licensed CC BY-NC 3.0 (non-commercial, attribution), unlike the rest of the repository; see explorer/assets/models/f9f5_panther_LICENSE.txt.

Instruments and aids

A second line under the flight readout shows vertical speed, angle of attack, load factor, the wind and, when relevant, airframe ice, the destination and the autopilot's targets. A horn sounds a little before the wing stalls.

  • Approach guidance. When the aircraft is lined up with a runway end, a small instrument shows two needles: the vertical one is the runway's centerline, the horizontal one the 3° glide path. Centered cross means on the approach. Beside each runway's touchdown zone stand four approach lights that show white from above their angle and red from below: two of each is on the path, more white is too high. At night the end you would land over is lit as a real one is: approach lights along the extended centerline (900 m out on a long runway, 420 m on a shorter one) with a crossbar 300 m out and a strobe running toward the runway twice a second; on a runway too short for those, a pair of flashing end lights. Long runways have centerline lights (red and white over the last 900 m, red over the last 300) and the touchdown-zone bars either side of the centerline.
  • ATIS. The ATIS button of the Autopilot / Radios panel plays the nearest airport's information broadcast, spoken: the information letter, the wind, visibility, sky, temperature and dew point, the altimeter setting (inches in the United States, QNH elsewhere) and the runway in use (the one most into the wind). With live weather on and a station at the airport it is the real report; otherwise it is the weather being simulated.
  • Landing score. Each landing is graded out of 100 on how hard it touched down, how far from the centerline, where along the runway, and how often it bounced.
  • Wind. A steady wind with gusts, set by the weather: a couple of knots when clear, about 30 with gusts in a thunderstorm. The flight model works on velocity through the air, so a headwind slows the aircraft over the ground and a crosswind carries it sideways.
  • Turbulence. Rough air inside the wind: quick, in all three directions, and the only part with an up and a down, which is what bumps the aircraft. Calm in clear air and fog, a bumpy ride in heavy rain, rough in a thunderstorm; stronger inside cloud and, with a wind blowing, close to the ground. The Turbulence slider under Weather scales it (0 is smooth air).
  • The ground. Wheels roll freely on a runway; anywhere else counts as grass or rough ground, with nearly three times the rolling resistance, so a takeoff from a field is longer and a landing roll on one shorter.
  • Icing. In cloud or rain below freezing (the air cools 6.5 °C per kilometer of height), ice builds on the airframe: less lift, more drag, an earlier stall. It clears in warmer or dry air.
  • Flight plan. In the airport selector, dest marks an airport as the destination: the readout shows its distance, bearing and time to go, a column of light stands over it, and the map draws a line to it.
  • Autopilot (H, on or off). Holds the heading, altitude and speed it was engaged at; A / D turn it, W / S change the altitude, Q / E the speed. The Autopilot / Radios button opens its panel (Tab frees the mouse to use it): the lateral modes HDG (the heading), NAV (the VOR course set on the OBS: it cuts in toward it and tracks it), APR (the runway ahead: the localizer, then down the glideslope once lined up) and DEST (straight to the destination), the vertical modes ALT and VS (a climb or descent at the rate set, leveling off at the altitude), and their targets. The same panel tunes the NAV radio and the ADF (or leaves them following the nearest stations) and shows the course needle, the TO / FROM flag, the DME distance and the ADF's bearing.
  • Map (B). A north-up moving map with nearby runways, the destination and the wind. The mouse wheel over it changes its range.
  • Views (V). Behind the aircraft, the pilot's seat, and a camera that stands ahead and watches the aircraft fly past.
  • Replay (L). Plays back the last 20 seconds, then hands the aircraft back where it was.
  • Location and time bar (Y). The bar at the top is collapsed to the clock; Y opens it and lets go of the captured mouse so it can be used (the flight carries on), and Y again closes it and takes the mouse back.
  • Gamepad. Left stick is pitch and roll, right stick the rudder (or the aim ring), the triggers the throttle, and the bottom face button the brakes.

Flight training

Training (T) lists nine lessons. Each is a sequence of steps: a sentence saying what to do, and a test for when it has been done, some of which must be held for a few seconds. A panel shows the current step; a crash ends the lesson. Lessons use the runway last started from, or the nearest airport.

Each lesson except the stall draws its ideal flight path ahead of the aircraft: a blue rectangular gate across the path every 240 m, with a dotted line through their middles, so the path's direction and slope read at a glance (a bare line flown along is seen end-on, as a dot). The gate just ahead is brighter. Takeoff climbs at the aircraft's best rate to 1,000 ft; the landings come down the approach to the touchdown point; the circuit is the full rectangle; the turns are 30° banked circles; and a ring course's path runs through the middle of every ring. A checkbox under the lesson list turns it off.

  • Takeoff: from a standstill to level flight at 1,000 ft.
  • Straight and level, and turns: hold a height and heading, then turn onto given headings.
  • Landing: from a few miles out on final approach to a stop, scored.
  • A circuit of the airfield: take off, fly a rectangle, land.
  • Stall and recovery, and Engine failure: glide to the runway with the throttle held closed and the flaps held down. It starts with height to spare, so the way in is to point at the runway, not to hold the best glide speed.
  • Carrier landing: from a mile and a half astern onto the deck of an aircraft carrier at sea (see below). It is flown at the ship, wherever the lesson was started from.
  • Ring slalom and Ring roller coaster: fly through a course of rings; the green one is next. The courses are spaced for an aircraft that takes about a kilometer to change direction.

The speeds a lesson asks for, the speed it starts at and the room it allows are those of the aircraft being flown: the jet rotates at 95 kt where the Caravan does at 65, starts its approaches farther out, and gets ring courses twice as long. A unit test (tests/explorer/training_flyable.test.ts) flies every lesson in every aircraft with a stand-in for a person: the real flight model and lesson runner, and a pilot who sees the flight a fraction of a second late, decides four times a second, moves the aim at a hand's pace and otherwise only holds keys down.

The aircraft carrier

A carrier lies 3 km off Coronado, San Diego, bow to the north-west. It is one more airport in the table (CVN68): it can be searched for and started from, it shows on the map and the readout, and its landing area, the angled deck, is its one runway (222 m by 30 m), with the approach lights and needles of any other. explorer/lib/airports/carrier.ts holds the ship's frame and everything solid about it, as plain math in Earth-fixed coordinates:

  • The deck. A 1 m grid of where there is flight deck, and its height above the waterline, both measured from the model when it is built. Wheels stand on the deck anywhere on it, not only on the landing area.
  • The island and the hull. A box around the island and its masts, and everything under the deck: flying into either is a crash.
  • The wires. Four arresting wires cross the landing area 51 to 90 m from the stern. Wheels that come down short of the last one catch the next wire ahead, which stops the aircraft within 80 m whatever its speed. Down past the last wire is a bolter: nothing holds the aircraft, and the thing to do is go around.
  • The waterline. The scanned world has no sea surface offshore: what is drawn there is the sea bed, colored as water, 13 m under true sea level at this spot and 150 m under it 20 km out. A ship at true sea level would hang in the air over it, so the waterline is set on the surface that is drawn, measured at this spot (chosen for being shallow and nearly level).

The ship steams at 15 knots round a racetrack about that spot, its recovery leg turned into the wind: the bow 8 degrees to the right of where the wind comes from, so the wind blows straight down the angled deck (to the nearest 10 degrees; the ship turns only while no one is within 8 km of it, or at a start on or at it). In a multiplayer room the host's heading is shared and the ship's place round the racetrack follows the server's clock, so it is in the same place for everyone.

Flying from it and back (explorer/lib/airports/carrier_ops.ts):

  • The catapult. An airplane started on the ship is hooked to the starboard bow catapult. Full power held for a second and a half fires it, and the shuttle pulls it down the 95 m track at a steady pull to 75 knots over the deck (more for a faster aircraft), the wind over the deck on top of that. A helicopter starts on the landing area.
  • The lens. Approaching from astern, a lens appears beside the needles: an amber ball between green datum bars, set to a 3.5-degree glide path to the third wire. Each cell is a quarter of a degree; the ball turns red at the bottom.
  • The LSO. The landing signal officer answers the ball at three quarters of a mile, then calls what needs fixing ("you're low", "power", "right for lineup", "you're fast"), waves off an approach far too low or off the line close in, and grades the pass when a wire stops the aircraft: OK, fair or no grade, from how steady the ball and the lineup were over the last 1,200 m (the one wire is never better than fair), or a bolter.

The model is licensed CC BY 3.0 (attribution), unlike the rest of the repository; see explorer/assets/models/uss_nimitz_LICENSE.txt.

Multiplayer

The Multiplayer row of the start screen puts the explorer online: a name, the server's address (empty for the default: this machine's when the page is served from it, else the public one), a room, a group and the Connect button. Connected, everyone else in the same room is drawn where they are. Someone flying is their aircraft, with its control surfaces, propeller and lights moving as theirs do; someone on the free camera is a ball in their color with a cone for where they look, never drawn smaller than about 20 pixels so that it can be found; someone riding the station is a name beside it. Each has a name and distance over it, and shows on the moving map.

Rooms and groups. A room is a code: everyone who types the same one is together, and nobody else sees or hears them; no code is the public room. A room exists while someone is in it. Its host is whoever has been in it longest, and the room takes its time of day and weather from the host: for everyone else the time slider, the weather selector and the N key are locked while they follow (the ☀ button of the multiplayer panel opts out, for a sky of your own, and unlocks them). A group is a tag within a room, for a flight of several aircraft: it shows beside the name and has a chat channel of its own. Set it on the start screen, or with /group NAME in the chat.

Fire training additions. The library has three more rural tanker exercises at real tanker bases: rangeland out of Boise, oak woodland above homes near Medford, chaparral west of Prescott. A scenario can be shared by link (the panel's Copy link: its JSON base64url-encoded in a ?scenario= query; the page opens on fire training with it first in the list). Buildings count: their footprints come from OpenStreetMap through OpenFreeMap's vector tiles (the building layer at zoom 14, each outer ring one building), loaded 1.5 km round the fire as it grows; a building is lost once its fire cell has burned 60% through, and threatened while a burning cell is within 200 m; the HUD shows both (explorer/lib/fire/fire_structures.ts). In review, Compare… draws a second run's fire edge at the same scenario time, found by searching that run's clock (explorer/lib/training/run_compare.ts).

Transponder, lights, tow. Each aircraft's report carries its transponder code (/squawk 4521; 1200 to start), ident while it is sent (/ident: 18 seconds, the target flashing on the scope), and its lights as its own browser draws them (nav, beacon, strobe, landing, taxi), so the others see the same. The scope shows the code after the name, and 7500, 7600 and 7700 as words in red. Game data the room need not understand goes over a typed channel (a kind and a short payload, to one player or all, rate-limited). The first use is an aerotow between players (explorer/lib/multiplayer/mp_tow.ts): a glider types /tow NAME behind another player's aircraft; its browser runs the 60 m rope between its hook and the tug's (as the room reports it), with the same stiffness, damping and weak link as the AI tow, and sends the pull to the tug five times a second, whose browser applies it as drag toward the glider. R or /release lets go.

Formation. /formation in the chat flies formation in the group (/formation off stops). The lead is the member with the lowest number flying an aircraft; the others take slots on it in the order they joined: number two 25 m back and 25 m to the right, three the same to the left, four and five twice as far out, and so on (explorer/lib/multiplayer/formation.ts). Each wingman's readout shows the miss from the slot (its largest part: behind, left, low…) and the share of the time spent within 12 m of it, measured in the lead's level frame from where the room sees the lead; stopping posts the score to the group's chat.

Chat. While online a panel on the left lists who is here (what each is doing, how far away, and their radio frequency) and holds the chat. Enter starts a line and sends it. In flight the mouse is captured for aiming, and Esc (which the browser uses to release it) brings up the pause menu, so the panel has its own way to the pointer: Tab frees the mouse for the panel and the scope while the flight carries on, and Tab again, or a click on the view, takes it back; Enter and J free it too, and return it when the line is sent or the scope closed. Next to the field, the button picks who gets it: the room, your group, or one person (click their name in the list). While the mouse flies the aircraft the panel is compact: its header, the radio and the last three lines of chat, which go after half a minute; it opens out when the mouse is free or a line is being typed. The ▴ button keeps it compact regardless.

Names. Each of the others has their name and distance over them, smaller and fainter the farther off they are. The 🏷 button of the panel steps through names over everyone, over your group only, and none.

Radio. Voice goes over a radio that behaves like one. Everyone has a frequency in the aviation band (118.000 to 136.975 MHz, 25 kHz apart) and hears only those on the same one. Like an aircraft's radio it has two: the active frequency, which is the one in use, and a standby one beside it. Comma and period tune the standby (with Shift, a megahertz at a time) and semicolon or the ⇄ button swaps the two, so the next frequency can be set up without leaving the current one; click either to type a frequency in. Hold U to talk; the first press turns voice on, and the browser asks for the microphone. Reception follows the line of sight between the two antennas: clear out to most of the radio horizon for their heights, fading into static beyond it, so two aircraft at altitude hear each other across hundreds of kilometers and two people on the ground lose each other within a few tens. A voice comes through a narrow band, as from a radio; while you transmit you hear nothing; two stations transmitting at once block each other with a squeal. Whoever is transmitting on your frequency is named in a strip near the top of the view, with bars for how well they come through (or "out of range" when they do not). The sound goes directly between the browsers (WebRTC); the game server only introduces them.

Radar. J opens a radar scope: a north-up plan of everyone in the room with range rings, the runways around, and a data block per aircraft (name, then altitude in hundreds of feet, an arrow when it climbs or descends, and ground speed in knots), a line for where it will be in a minute and a trail of where it has been. Beside it is a strip per player; selecting one offers a direct message. A data block can be dragged away from its target, to keep blocks from overlapping (a leader line joins them). A right click on a target opens a menu: message, tune to its frequency (yours goes to standby), keep the scope centered on it, and put a moved data block back. Someone with the scope open and no aircraft is a controller: the others see a tower mark where the camera is parked, which is also where that controller's radio antenna is.

The server is the /flight module of the repository's game server (npm run server): rooms by code, nothing saved. It is a relay, not a simulator. Each client flies its own aircraft and reports its position, attitude, velocity and controls 15 times a second; the server checks each report field by field, keeps the latest per player and sends on the ones that changed: 30 times a second to the players within 60 km of each other (twice the rate they are made at, so that none waits long or is overtaken by the next), once a second to the rest, which is enough for a map or a scope. Positions are Earth-centered, Earth-fixed meters, which mean the same to every client whatever its rendering origin.

Reports 67 ms apart would jump if drawn as they arrive, so each player is drawn a moment in the past, between the two reports on either side of that moment (explorer/lib/multiplayer/flight_net.ts). What keeps that smooth is knowing when each report was true: at 250 m/s a report placed 30 ms wrong is 7 m out of place. So each report carries its sender's own clock, and the others place it by that, not by when it reached them; the sender's frame rate, the relay and the network then delay a report without moving it. Each player's track learns how that sender's clock maps to its own (the least delayed report sets it), how late reports come and how far apart, and draws the player just far enough back for that: about 100 ms on a good connection, up to 400 ms on a poor one, changed slowly and left alone while it is near enough. Between two reports the path is a curve through both positions with their velocities. When a report is late the motion is carried on along the last velocity (and, briefly, the turn and a vehicle's acceleration) for a little longer than the reports have been coming apart, and when the late report shows the guess was off, the difference is eased out over a tenth of a second instead of jumped; a move of more than 1.5 km between reports is taken as a relocation and not swept through. A connection that cannot keep up is not sent states to queue, in either direction: only the next it can take. A connection that cannot be made says why on the start screen; one that is lost after it was made is retried until the player disconnects. What there is not yet: collisions between players, radar coverage (the scope sees everyone in the room wherever they are), terrain in the way of a radio, and a relay for voice (each browser connects to every other on its frequency, which suits a handful of people per frequency, and a strict firewall can stop a connection being made).

Radios and warnings

The radios know the world's 11 000 navigation beacons (OurAirports, public domain): the second HUD line shows the nearest VOR that is in range (its frequency, ident, the radial you are on and the DME distance) and the nearest NDB (its relative bearing, what an ADF needle points at). Reception is line of sight, out to each station's published service range. Beside them, the slip-skid ball: keep it in the middle.

A ground proximity warning system watches the height above the ground and calls out, aloud through the browser's speech: "sink rate" and "pull up" when descending too fast for the height, "terrain" closing on rising ground, "don't sink" after takeoff, "too low, gear" and "too low, flaps" near the ground unready to land, "glideslope" below the approach path, and the heights on the way down to land ("five hundred", "minimums"…). The 777 has the full set; the small aircraft the basic modes. It is silent with the sound off.

Airports and runways

A table of 4,380 airports and 5,914 hard-surfaced runways (from OurAirports, public domain) loads the first time you fly: each runway's two ends, its width and its elevation. The nearest airport's identifier, distance and bearing are on the flight readout. Go to… (a button under the readout) opens a dialog: the nearest airports while the search box is empty, or any airport in the world by code, name or city. Click an airport to start on its longest runway, stopped and lined up, or one of its runway ends to start from that end. The last runway used is remembered, and the Last button returns to it (before any is chosen, it reads Nearest airport). The start screen does all of this too. There is no wait after a jump: the aircraft stands on the runway's strip at once, at its published height, while the scenery streams in around it. The dialog's second tab lists the app's places (they are also on the start screen; the bar at the top holds only the time controls).

The Go to dialog, the training list and the settings dialog (the Settings button of the start screen: settings, effects and audio as three tabs) are modal. While one is open the mouse is released, no key reaches the aircraft and the flight is paused; Esc, the close button or a click outside closes it and hands the mouse back.

The streamed city is a scan, and a scanned runway is lumpy: bumps of a few decimeters, plus whatever was parked on it that day. So each runway near the aircraft gets a smooth strip of its own for the wheels. Its height along the runway starts from the published elevation of the two ends (converted from sea level to the ellipsoid with the geoid) and is then corrected from the real ground: rays sample it at stations every 20 m within 160 m of the aircraft, three across the strip, keeping the median, and each station is read again every second or two. The corrections are median-filtered along the runway, which removes a scanned airliner, and then smoothed. A reading is believed only when it comes from the detailed scan (a tile under about 2.5 km across): after a jump the scenery arrives level by level, and the coarse levels are wrong by 5 to 150 m in either direction. The strip also moves toward a new reading at no more than 1.5 m a second, so an aircraft standing or rolling on it is lifted gently, never thrown. The strip is not drawn; you still see the real runway. It only replaces what the wheels touch. Runways within 15 km also get lights: white along the edges, a green bar across the nearer end and a red one across the far end.

The lights go on around the field too. Taxiways get blue edge lights every 60 m (none where another taxiway crosses) and, at airports with a runway of 2,400 m or more, green centerline lights, laid out from the map's taxiway lines; yellow runway guard lights flash in pairs at every hold line; floodlight masts stand along the aprons' edges (from the map's apron outlines), and at night the nearest of them light the ground under them. The rotating beacon flashes white and green from a tower beside the field. The last 600 m of a long runway's edge lights are yellow, and in fog or under a low deck all the lights are run up to full by day. A setting swaps the PAPI for a two-bar VASI. Where the photo shows paving past a runway's end, a blast pad is drawn there, with yellow chevrons.

A runway threshold with a blast pad beyond it, marked with yellow chevrons.A blast pad, found in the photo
Medford airport at night: blue taxiway edge lights, green centerline lights and lit aprons.Taxiway and apron lights at night
A town at night from low altitude: streetlights, lit windows and car lights on the roads.Cars and lit windows in town

Towns near the camera come alive at night: the cars that drive the mapped roads by day have their lamps on, small glows at each car's corners, white seen from ahead and red from behind (both from overhead, so from the air a road is a string of dots); and the walls of the buildings have windows, a share of them lit, warm or cool, floor by floor. (The windows are off on phones, where the wall search would cost too much.)

The sound is synthesized, with no audio files: a sawtooth pair at the propeller's blade-pass frequency (50 to 95 Hz with throttle) and filtered noise that rises with airspeed. No engine holds a high whine or whistle: a turbine's is left out, and recorded engines that whistle play through a low-pass.


Credits

Credits & references

Data

Earth: Google Photorealistic 3D Tiles; Cesium World Terrain; AWS Terrain Tiles (Mapzen; SRTM, GMTED2010, ETOPO1 and others); the sea's depths from the GEBCO Bathymetric Compilation Group's GEBCO_2026 Grid; Cesium OSM Buildings (OpenStreetMap contributors); Esri World Imagery (Esri, Maxar, Earthstar Geographics and the GIS User Community); Esri World Topographic Map and World Street Map; OpenStreetMap tiles; Google Maps 2D tiles through Cesium ion. Moon and Mars: Explorer's own tilesets from NASA LRO (LOLA, LROC), MOLA, ESA/DLR HRSC, Viking MDIM 2.1, HiRISE and USGS Astrogeology data, and Cesium ion's assets built from NASA, USGS and ESA data. The solar system: JPL Solar System Dynamics (planetary elements, satellite mean elements, the Small-Body Database); Jupiter's map from Hubble's OPAL program (NASA, ESA, STScI); moon maps from USGS, JPL and Caltech (NASA 3D Resources); Phobos and Deimos shapes from Ernst et al. 2023 (JHU/APL). Constellation figures: d3-celestial (Olaf Frohn). Stars: the Yale Bright Star Catalog, 5th revised edition. Satellites: CelesTrak general perturbations elements. Weather: station reports from aviationweather.gov (NOAA); winds aloft from Open-Meteo; snow cover from NASA's MODIS Terra daily snow cover through NASA GIBS; land cover from Esri's Sentinel-2 10 m Land Cover (Impact Observatory, Microsoft, Esri; CC BY 4.0). Roads, taxiways, aprons and water for the lights, markings and lakes: OpenStreetMap contributors, through OpenFreeMap's vector tiles. Earth texture for the distant-body sphere: a NASA Blue Marble image. Airports, runways and radio beacons: OurAirports (public domain). Towns the AI copilot knows by name: GeoNames (CC BY 4.0). Aircraft: "Cessna 208 Caravan" by Emmanuel Baranger (Helijah), Creative Commons Zero. The mouse-aim control scheme follows Brian Hernandez's MouseFlight (MIT license).

Papers, specifications and articles

  1. Open Geospatial Consortium. 3D Tiles Specification, versions 1.0 and 1.1. Tile trees, bounding volumes, geometric error, refinement, implicit tiling.
  2. Cesium. quantized-mesh-1.0 terrain format specification. Zig-zag delta vertices, high-water-mark indices, extensions.
  3. National Imagery and Mapping Agency. Department of Defense World Geodetic System 1984, TR8350.2. The WGS84 ellipsoid.
  4. B. R. Bowring. “Transformation from spatial to geographical coordinates.” Survey Review 23(181), 1976.
  5. T. Nishita, T. Sirai, K. Tadamura, E. Nakamae. “Display of the Earth Taking into Account Atmospheric Scattering.” SIGGRAPH 1993. The single-scattering sky model.
  6. E. Bruneton, F. Neyret. “Precomputed Atmospheric Scattering.” Computer Graphics Forum 27(4), 2008.
  7. S. Hillaire. “A Scalable and Production Ready Sky and Atmosphere Rendering Technique.” Computer Graphics Forum 39(4), 2020. Sky-view and aerial-perspective lookup tables, the multiple-scattering LUT.
  8. W. M. Cornette, J. G. Shanks. “Physically reasonable analytic expression for the single-scattering phase function.” Applied Optics 31(16), 1992.
  9. L. G. Henyey, J. L. Greenstein. “Diffuse radiation in the Galaxy.” Astrophysical Journal 93, 1941.
  10. J. Jendersie, E. d'Eon. “An Approximate Mie Scattering Function for Fog and Cloud Rendering.” SIGGRAPH 2023 Talks.
  11. A. Schneider, N. Vos. “The Real-time Volumetric Cloudscapes of Horizon: Zero Dawn.” SIGGRAPH 2015, Advances in Real-Time Rendering. Perlin–Worley noise, the coverage remap, powder.
  12. M. Wrenninge, C. Kulla, V. Lundqvist. “Oz: The Great and Volumetric.” SIGGRAPH 2013 Talks. The multiple-scattering octave approximation.
  13. M. Salvi. “An Excursion in Temporal Supersampling.” GDC 2016. Variance clipping of history.
  14. M. Oren, S. K. Nayar. “Generalization of Lambert's Reflectance Model.” SIGGRAPH 1994.
  15. D. A. Vallado, P. Crawford, R. Hujsak, T. S. Kelso. “Revisiting Spacetrack Report #3.” AIAA 2006-6753. SGP4.
  16. D. Hoffleit, W. H. Warren Jr. The Bright Star Catalog, 5th revised ed., 1991.
  17. T. Helland. “How to Convert Temperature (K) to RGB.” 2012.
  18. K. Narkowicz. “ACES Filmic Tone Mapping Curve.” 2016.
  19. N. Reed. “Depth Precision Visualized.” 2015. Why reversed-Z with floating-point depth works.