An Interactive Explainer

Gerstner Waves:
The Secret Circles
Inside Every Ocean

A wave is one of the most familiar shapes in nature. But how does it actually work? The answer is stranger — and more beautiful — than you probably think.

Act IThe Shape That Isn't There

Look out at the ocean and you see something unmistakable: a wave. A hump of water, cresting white, rolling toward shore. Your eyes track its shape moving forward, and your brain files it under "a thing that travels through space."

That intuition is worth examining. Because when you think about it — what exactly is travelling?

Here's a simple wave. Watch what happens to the red dot as it passes.

Demo 1 · The Travelling Wave
Speed 1.0×
Particle
Wave surface
Notice The wave's shape moves to the right — but the red dot doesn't go anywhere. It traces a perfect vertical line. The wave is a pattern that propagates; the water itself stays local.

The red dot bobs up, then back down, tracing a perfect vertical line. The wave's shape moves to the right, but the water itself stays put — rising and falling in place.

This is the first surprise. The wave is not a thing travelling through water. It is a pattern — a shape that propagates while the material itself stays local. Like a crowd doing the wave in a stadium: each person just stands up and sits down, but the ripple races around the whole arena.

So our sine wave is a start. Each point on the surface moves in one dimension only: straight up, straight down. Vertical. That's it. There is zero horizontal movement.

But spend some time watching a real ocean, and something starts to nag at you. Real waves don't look quite like this. The crests are sharp and peaked; the troughs are broad and flat. Real floating objects — a buoy, a duck — don't just bob up and down. They trace a gentle, rolling circular path: forward at the crest, backward at the trough.

That tells us something important is missing. Our sine wave only pushes water up and down. A real ocean pushes it forward and back too. To fix this, we need to look inside the wave.

Act IIThe Circle Inside the Wave

Here's the key insight, and once you see it you can't unsee it.

Each water particle in a Gerstner wave doesn't just move vertically. It moves in a circle. Not just up and down — it traces a full two-dimensional orbit, forward and back as well as up and down.

Demo 2 · Single Particle Orbit
Orbit radius 65
Horizontal (x)
Vertical (y)

At the very top of its orbit — the crest of the wave — the particle is moving forward, in the direction the wave is travelling. At the very bottom — the trough — it's moving backward. On the sides, it's moving purely up or down.

This is fundamentally different from the sine wave in Act I, which only displaced particles vertically. Here, the motion is two-dimensional: a full circular orbit in the vertical plane. And it is this circular motion that creates the sensation of a wave travelling past you.

Now here's where it gets beautiful. A single particle tracing a circle is just... a particle tracing a circle. To make a wave, we need many particles. The trick is phase — each particle is on the same circular orbit, but shifted in time relative to its neighbours.

Demo 3 · Phase Makes the Wave
Phase spread 0
Try it Drag the Phase spread slider from 0 to 2π. Watch how the flat surface organises itself into a travelling wave — purely from staggering identical circular orbits in time.

With all particles in phase — all moving together — the surface stays flat. As you spread the phase across the row, a wave shape appears. Crank it to $2\pi$ and you get a crisp, rolling swell.

The wave "travels" because the phase advances from left to right. There's no water rushing forward. Just circles, phased together, giving the illusion of movement.

This is a Gerstner wave. We can write down its exact geometry with two equations:

$$x(\theta) = X - A\sin\theta \qquad y(\theta) = A\cos\theta$$

Where $X$ is the particle's rest position, $A$ is the amplitude (the radius of the circle), and $\theta = kX - \omega t$ is the phase — a combination of position and time. That's it. Two lines of math, and you have a rolling ocean.

Notice something: the horizontal displacement $-A\sin\theta$ is exactly 90° out of phase with the vertical $A\cos\theta$. They are a sine and a cosine. That 90° offset is precisely what makes a circle. The wave is literally encoded in the relationship between those two functions.

Act IIIThe Wave That Breaks

So far we've been talking about amplitude — how tall the circles are. But there's a more useful way to describe a wave's shape, and it reveals something fascinating about what happens when a wave gets too steep.

Oceanographers talk about steepness: the ratio of a wave's height to its wavelength. In the Gerstner model, steepness has a precise definition: $Q = kA$, where $k = 2\pi/\lambda$ is the wavenumber and $A$ is the amplitude. It's a dimensionless number, and it controls the wave's character in a very specific way.

Demo 4 · Wave Steepness
Steepness Q
0.30
⚠ Self-intersection
Try it Drag past Q = 1.0. The math has no built-in stop — the wave eats itself. The surface folds through its own geometry, forming loops that could never exist in real water.

At low steepness, the Gerstner wave looks almost like a sine wave. As steepness increases, watch what happens to the crests: they sharpen into peaks while the troughs spread out flat. This is the trochoidal wave profile — named after the mathematical trochoid curve — and it matches real ocean swells remarkably well.

At $Q = 1$, the orbiting circles of adjacent particles are exactly touching at their edges. The crest sharpens to a mathematical point. This is the theoretical maximum — push a real wave past this, and it breaks.

Drag the slider past 1, though, and the math keeps going. The particle orbits start overlapping, and the surface folds through itself, forming impossible loops. In a fluid simulation, this would be catastrophic. Here, it's just geometry gone wrong — a beautiful reminder of what Gerstner waves actually are.

This model is a geometric displacement trick, not a physical fluid simulation. It is extraordinarily good within its limits, but it has no internal mechanism that prevents a wave from breaking. We are responsible for keeping $Q$ below 1. If we don't, the wave eats itself.

Act IVA Real Ocean

One Gerstner wave is elegant. But one wave is not an ocean.

Look at any open-water photograph and you see complexity: waves from multiple directions crossing, fast-moving ripples on top of slow-moving swells, an ever-shifting, chaotic surface. How do we get from our single circle-wave to all of that? We add. A real ocean is the superposition of many waves — different directions, different frequencies, different amplitudes — all summed together.

There's a catch, though. Try adding a few waves now, but leave the Real Dispersion toggle off.

Demo 5 · Ocean Composer · drag to orbit · scroll to zoom
Try it Add 3–4 waves with different directions. Notice how artificial the ocean looks without dispersion — all waves moving at the same lockstep speed, like turbulent jelly. Then check Real Dispersion. Long swells speed up; short ripples slow down. The ocean snaps into existence.

Something important happens when you enable dispersion. Wave speed is not the same for all waves — longer waves travel faster than shorter ones. The relationship is:

$$\omega = \sqrt{gk}$$

The angular frequency $\omega$ (which determines how fast the phase advances, and thus the wave's speed) is proportional to the square root of the wavenumber $k$. Double the wavelength — halve $k$ — and the wave travels about 40% faster.

This is why ocean footage looks the way it does. Long-period swells generated by distant storms arrive first, producing that slow, rolling surge. Short-period ripples from local wind sit on top, moving more quickly relative to their size. Without dispersion, all waves would move in lockstep — rhythmically uniform in a way that feels instantly fake. Dispersion is what gives a real ocean its sense of depth and age.

And this is exactly what game and film rendering engines do. Assassin's Creed IV, Sea of Thieves, and countless real-time renderers use exactly this technique: a small number of Gerstner waves — sometimes as few as four — summed in a vertex shader running on the GPU. Every water-covered vertex in those games is doing the same math we worked out in Act II.

EpilogueThe Code

Let's look at what that math looks like as actual shader code. This is the function that runs on the GPU — for every vertex on the water mesh, sixty times per second.

GLSL · Gerstner Wave Vertex Displacement

The two orange lines — the disp.x and disp.z displacements — are the heart of everything. They push each vertex horizontally, tracing out the forward-backward component of the circle we met in Act II. Without them, you'd have a sine wave. With them, you have Gerstner.

The GPU runs this function for every vertex on the water mesh. Each vertex just does the math, moves to its new position, and the collective result is an ocean.

The whole technique fits in about twenty lines of code. The ocean has been holding this secret for billions of years. It took a German physicist named Gerstner to write it down in 1802, and it took GPUs a couple more centuries to make it real-time.

The circles were always there.