HomeArticlesSpiral Galaxy

Spiral Galaxies: Why the Arms Never Wind Up

The winding problem, Lin-Shu density waves, and how 80,000 GPU-instanced stars fake real disc-galaxy dynamics.

mysimulator teamUpdated June 2026≈ 8 min read▶ Open the simulation

A disc that should have shredded itself long ago

A spiral galaxy rotates differentially: stars near the centre complete an orbit much faster than stars far out, because orbital speed stays roughly flat while the orbit's circumference grows with radius. If a spiral arm were a fixed clump of the same stars forever, this differential rotation would wind it into a tight, invisible spiral within a few galactic rotations — a few hundred million years, a tiny fraction of a galaxy's age. Real galaxies are billions of years old and still show two or four clean, open arms. That contradiction is the winding problem, unresolved until the 1960s.

live demo · 80,000 stars orbiting a spiral density wave● LIVE

The resolution, from Chia-Chiao Lin and Frank Shu (1964), is that a spiral arm is not a fixed group of stars — it is a density wave: a slowly rotating pattern of gravitational compression that stars pass through, like a traffic jam that holds its shape on a highway while individual cars drive through it. The pattern rotates rigidly at one pattern speed Ω_p, while each star keeps its own faster or slower orbital speed. A star drifts into the arm, is gravitationally compressed and briefly slowed, then drifts back out ahead of the pattern. The arm survives indefinitely because it is a standing wave, not a fixed set of stars.

Why arms light up blue: the gas connection

A stellar density wave alone is a subtle overdensity of a few percent — not the bright arms photographs show. The visible brightness comes from gas. Interstellar clouds, unlike stars, collide and lose orbital energy when compressed, so they pile up sharply at the wave's potential minimum and collapse into new stars. The result is a wave of newborn, short-lived, extremely luminous blue-white O and B stars tracing the arm — they live only a few million years, too briefly to drift far from where they formed, painting the arm a colour that ordinary old stars (which do drift through) never would.

Placing 80,000 stars without 80,000 physics updates

Honestly simulating this with real gravity is an N-body problem: 80,000 mutually attracting points is billions of pairwise interactions per step, far beyond real time in a browser tab. This page instead uses a kinematic density-wave model: each star keeps a fixed guiding radius and birth angle, and its screen position each frame comes from a closed-form spiral function, not an integrated force.

theta = theta0
        + omega(r) * t                 // differential rotation, faster near centre
        + pitch * Math.log(r / r0);    // logarithmic-spiral phase offset
x = r * Math.cos(theta);
z = r * Math.sin(theta);
// colour and brightness biased near the arm's density maximum
armPhase = (theta - pitch * Math.log(r / r0)) % (2 * Math.PI);

A logarithmic spiral — the curve r = r₀·e^(θ/tan α) for a fixed pitch angle α — is what real spiral arms fit best; the Milky Way's arms have pitch angles of roughly 10–15°. Stars near the arm's density maximum are drawn brighter and slightly bluer to mimic ongoing star formation, and the bulge and halo are rendered as separate particle populations with their own radial profiles, since the galaxy is not one disc but three overlapping structures.

GLSL instancing: why 80,000 sprites cost one draw call

Rendering 80,000 independent billboards the naive way — one draw call per star — would collapse frame rate long before the physics does. Instancing uploads each star's attributes (radius, angle, colour, size) once into a single buffer and asks the GPU to draw one base geometry (a small quad) tens of thousands of times in a single call, computing each instance's final position in the vertex shader from its own attribute row. The CPU touches the star data once per frame to update phase; the GPU does the rest in parallel, which is why 80,000 moving points and a bulge glow can hold 60 fps in WebGL where a naive scene graph would not clear a tenth of that.

Frequently asked questions

Why don't galaxy arms wind up over time?

Because an arm is a density wave, not a fixed group of stars. The wave pattern rotates as a rigid spiral at its own pattern speed while individual stars orbit through it at their own, generally different, speed — so the shape persists even though the stars inside it are constantly changing.

Why are spiral arms blue while the rest of the disc looks yellowish?

Gas compresses more sharply than stars at the density wave's minimum and collapses into new stars there. The brightest of those are massive, extremely hot O and B stars that burn out in a few million years — too fast to drift away from the arm — so the arm is disproportionately lit by young, blue, short-lived stars.

Does this simulation use real gravity between the stars?

No. Simulating real mutual gravity for 80,000 bodies is not feasible in real time in a browser, so the stars are placed kinematically from a logarithmic-spiral density-wave formula rather than integrated from forces — visually faithful to how real disc galaxies behave, without an N-body solver underneath.

Try it live

Everything above runs in your browser — open Spiral Galaxy and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Spiral Galaxy simulation

What did you find?

Add reproduction steps (optional)