The catalogue of everything in Earth orbit is public. CelesTrak publishes orbital elements (TLE) for about 18,500 satellites, stations, rocket bodies and debris pieces, updated daily, and from them you can compute where each object is at any moment. I wanted to see all of it at once, so I built Orbivia: a Windows app with a 3D Earth, every tracked object moving in real time, true-scale models, ISS passes over your city and a world map.

Hubble over Australia

It's free and open source (MIT). The whole thing is one index.html with three.js 0.160 and satellite.js 5.0 (an SGP4 implementation) bundled locally, wrapped in Electron. Here are the parts that weren't obvious.

SGP4 for everything, off the main thread

Running propagate 18,500 times on the main thread causes visible frame drops. So a Web Worker, built from a string via a Blob, does it ten times a second and hands back two Float32Arrays (positions and velocities) as transferables, with no copying:

const worker = new Worker(URL.createObjectURL(new Blob([` importScripts('${SATJS}'); let recs = []; onmessage = e => { const m = e.data; if (m.init) { recs = m.init.map(t => { try { return satellite.twoline2satrec(t[0], t[1]); } catch (_) { return null; } }); return; } const d = new Date(m.t), n = recs.length, p = new Float32Array(n * 3), v = new Float32Array(n * 3), R = ${RE}; for (let i = 0; i < n; i++) { const s = recs[i]; let r = null, w = null; if (s) { try { const pv = satellite.propagate(s, d); r = pv.position; w = pv.velocity; } catch (_) {} } if (r && isFinite(r.x)) { p[3*i] = r.x / R; p[3*i+1] = r.z / R; p[3*i+2] = -r.y / R; } // ECI -> scene if (w && isFinite(w.x)) { v[3*i] = w.x / R; v[3*i+1] = w.z / R; v[3*i+2] = -w.y / R; } } postMessage({ t: m.t, p, v, gen: m.gen }, [p.buffer, v.buffer]); };`], { type: 'text/javascript' }))); 

The arrays go straight into BufferGeometry attributes. The axis swap (x, y, z) → (x, z, −y) is there because ECI has north on Z and three.js has up on Y; one scene unit is the Earth's equatorial radius. The Earth mesh itself rotates by Greenwich sidereal time, so the dots stay in the inertial frame. The gen field drops stale answers if a new catalogue arrived while the worker was busy.

I checked the ISS position against api.wheretheiss.at: within 0.1°.

Why the dots lagged at ×3600, and the f-g series fix

At ×3600 time acceleration, a tenth of a real second is six simulated minutes. A low satellite covers almost 3,000 km in that time, so between worker updates the dots froze and then jumped. Running SGP4 for everything more often is too expensive.

The fix came from a celestial mechanics textbook. Since the worker also returns velocity, the vertex shader advances each dot by uDt seconds using the Lagrange f and g series for the two-body problem, truncated at t³:

vec3 p = position; if (uDt != 0.0) { float r2 = dot(p, p), r = sqrt(r2), u = uMu / (r2 * r), sv = dot(p, aVel) / r2, t1 = uDt, t2 = t1 * t1; p = p * (1.0 - 0.5 * u * t2 + 0.5 * u * sv * t2 * t1) // f + aVel * (t1 - u * t2 * t1 / 6.0); // g } 

Here u = μ/r³ and sv = (r·v)/r². Over six minutes the truncation error for a low orbit is a few kilometres, less than a pixel in the global view, and the next worker update snaps the dot back to the exact SGP4 position anyway. The same series is duplicated in JavaScript so mouse picking hits where the dot is drawn, not where the worker last put it.

A 100-metre station next to a 6,378 km planet

If you draw the ISS model in the same scene as the Earth, the depth buffer can't cope: with near and far planes wide enough for both, the model flickers and sinks into the planet. So models are drawn in a second pass: after the main scene, renderer.clearDepth(), then a separate scene with a camera at the same position but with near/far fitted around the object. The main camera's near is recomputed every frame as 0.3 × the altitude, otherwise terrain tears when you zoom down to 100 km.

True-scale Hubble model

"Visible to the naked eye"

For a chosen place the app finds the next passes for the ISS, Tiangong and the selected object over 72 hours: SGP4 every 30 s, rise and set refined by bisection. A pass gets a star when the station is visible to the eye: the observer is in twilight (Sun below −6°), the satellite is not in Earth's shadow, and it climbs at least 10° above the horizon:

function sunlitInDark(rec, obs, ms) { const d = new Date(ms), g = S.gstime(d); let pv; try { pv = S.propagate(rec, d); } catch (_) { return false; } if (!pv.position) return false; const s = sunECI(ms), o = S.ecfToEci(S.geodeticToEcf(obs), g), ol = Math.hypot(o.x, o.y, o.z); if ((o.x * s[0] + o.y * s[1] + o.z * s[2]) / ol > Math.sin(-6 * D2R)) return false; // not dark for the observer const P = pv.position, dp = P.x * s[0] + P.y * s[1] + P.z * s[2]; return !(dp < 0 && Math.hypot(P.x - dp * s[0], P.y - dp * s[1], P.z - dp * s[2]) < RE); // not in Earth's shadow } 

The shadow is a cylinder, not a cone with penumbra. At ISS altitude the difference in shadow entry time is a matter of seconds.

10,000 lines when alpha is below one 8-bit step

"All orbits" draws an ellipse for every visible object: 18,500 of them, or 10,600 for Starlink alone. Each ellipse is built in a second worker from osculating elements, 48 segments, all in one LineSegments with only the vertices updated.

The problem was precision, not speed. For 10,000 lines not to merge into a white blob, each needs an alpha of about 0.005. One step of an 8-bit colour buffer is 1/255 ≈ 0.004, so blending rounds: depending on the background, lines either vanish or suddenly add up to a solid fill, and there's no smooth setting in between.

The fix is stochastic. If the required alpha a is below 0.03, a line is drawn in only a fraction p = a / 0.03 of its pixels, at alpha 0.03, which survives rounding. The average brightness is the same. Which pixels get drawn is decided by noise on gl_FragCoord plus the orbit index, so neighbouring lines don't drop out at the same spots. On top of that, the part of an orbit facing the camera is brighter than the part seen edge-on, otherwise the rim of the Earth turns into a white ring.

All Starlink orbits

Numbers

On my PC (Windows 10, RTX 3070): 60 fps, median JavaScript time per frame 0.4 ms, p95 8.1 ms (frames that redraw the 2D map). All 18,500 orbits add about 1 ms per frame, and rebuilding the ellipses takes about 40 ms in the worker. Cold start from cache without a network: 1.05 s to the first frame. With no GPU at all (SwiftShader in a VM) the app detects the software renderer and drops MSAA and bump mapping, which took it from 11 to 30 fps.

Not verified

The optional Space-Track login is tested only against a stub, because I don't have an account. The object type (debris, rocket body, navigation and so on) comes from the name and orbit, not from SATCAT, so some objects may land in the wrong filter.

Try it

Windows 10/11 (64-bit), a GPU with WebGL 2. Unpack to a folder of your own and run Orbivia.exe. It isn't code-signed, so SmartScreen may warn the first time. It updates itself from GitHub releases.

Download: https://github.com/OlegChe77/sputniki-zemli/releases/latest/download/Orbivia.zip
Source (MIT): https://github.com/OlegChe77/sputniki-zemli

If you've drawn thousands of translucent lines in WebGL, I'd like to hear how you handled it.