Feature Library

Realistic Earth with flows

0.64 GPU · 0.19 CPU ms
A still of the Realistic Earth with flows demo
Still
The live demo starts when it’s in view.Drag to turn · scroll or pinch to zoom · click a country to light it · arrows, +/−, Enter

A planet to put a story on: land and sea from Natural Earth, the sun rising over the edge through an atmosphere, its glint on the water, city lights on the…

What it costs a frame

0.64 ms
0.19 ms
GPU
0.64 ms
CPU, median
0.19 ms
CPU, 95th pct
0.28 ms
Draw calls
10
Weight
Moderate

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.52–0.65, CPU 0.19–0.29 ms). What ran: Measured turning by itself at the globe’s resting distance, the sun on the edge, seven flows with two comets each, clouds and stars on: drawn every frame. The coast tier is loaded and blended in the same shader, off screen. Left alone for 30 s (and not measured) it rests: nothing is drawn. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool0.640.190.28
apple · Apple A19 Proin a browser tab · 16 November 20263.210.240.38
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20263.540.580.79

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
three.js 0.187.0No other packages

What it’s for

  1. A hero globe for a product or a talk
  2. Flows between places (trade, travel, messages)
  3. Highlighting countries on a world view
  4. Flying from the whole planet to one coast
  5. A sunrise over the edge for a title

Pitfalls, in brief

  1. The country channel (blue) must never be filtered: a sampler blends two countries’ numbers into a third.
  2. Draw a lit country’s outline as a contour of a soft field (the blended lit levels, cut by the land’s own soft edge), not of the sharpened fill: a field that changes within one pixel gives fwidth ≈ 1 and a line that stair-steps pixel by pixel.
  3. Decode the maps with createImageBitmap(…, { colorSpaceConversion: "none", premultiplyAlpha: "none" }): a browser that colour-manages the PNG shifts every byte, and the country numbers with it.
  4. The coast is a contour, not a stroke: the land’s half-way line (and a tier’s zero height) drawn over fwidth, so it stays as fine on screen at any distance.
  5. Flows are as wide on screen at any distance only because each segment is extruded in clip space (pixels ÷ half the drawing buffer × w).
10 more in brief
  1. A great circle between antipodes is undefined: add() refuses it (and a flow to itself) and returns -1.
  2. The comets’ positions come from the clock you pass to flows.frame: hold the clock still (reduced motion, rest) and they hold still.
  3. The sun is placed for each camera (just behind or over the edge as that camera sees it), so call earth.frame(camera, …) for the camera that draws, every frame something moves. sunAt runs from behind the planet (< 1) through the edge (1) to behind the camera (2, the day side full on).
  4. Close to the ground the camera is inside the air’s shell, where its edge-on glow would fill the view: earth.frame fades the air out below about a fifth of a radius, and thins the clouds.
  5. Ice goes by latitude, not by the map: sea ice past about 78°, land ice past about 72° north and 64° south.
  6. Heads and beacons are hidden by a ray test against the sphere, not the depth buffer: sprites at the surface would sink half into it.
  7. Close to the ground, move the camera’s near plane with its height (the demo uses 0.3 × altitude): a fixed near plane either clips the ground or loses depth precision to the arcs.
  8. A tier must stay within the map’s land: its land comes from heights, the map’s from outlines, and the blend at its edge fades between them.
  9. The map is 4096 × 2048 (about 45 MB with mips on the GPU); a tier at 2048² about 22 MB.
  10. Global relief needs a global height grid: the shipped tier covers one coast. bake-earth.mjs bakes a tier for any box, the whole world included, from an ETOPO grid you download yourself (CC0).
15 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Also as

Where it comes from

From My other apps. Fully custom code.

Natural Earth (public domain): Country outlines (1:50m, through world-atlas) and, in the coast tier, roads and lakes (1:10m). Made with Natural Earth.

world-atlas by Mike Bostock (ISC): The TopoJSON packaging of Natural Earth’s countries the map was baked from; its notice is in NOTICE.md.

NOAA National Centers for Environmental Information, ETOPO 2022 15 Arc-Second Global Relief Model (CC0-1.0): The coast tier’s heights (a 30 arc-second subset), bicubic between cells.

Jarzynski & Olano, Hash Functions for GPU Rendering (2020): PCG, as three’s TSL `hash`, places the stars.

Ken Shoemake, Animating rotation with quaternion curves (1985): Spherical linear interpolation: the arcs follow great circles.

Hillshading (Yoëli 1967; the cartographer’s north-west light): The tier’s relief, baked from the height’s slope.

Third-party terms ship with it in NOTICE.md.

globeearthplanetatmospherenight lightsflowsarcscometsgreat circleconstant screen widthreliefcoastlinenatural earthetopotslwebgpudraw on demandno dependencies

Near it in the frame