Light in layered seawater · A live demo
0 m · The surface
A ripple 1 m long and 8 cm from trough to crest focuses the sun 2.5 metres down.
Each bright sheet in Fig. 1 is sunlight that a ripple has bent toward a focus. Your browser is tracing those photons now: refraction and Fresnel loss at the surface, then scattering and absorption in the water, under physically based rules. Drag the ripple height and the focus moves.
Fig. 1 · Caustic net · Live · One 1 m periodic cell, repeated across
starting engine
Preview until photons arrive: direct sunlight mapped through the surface by this page's script, without scattering. Live photons replace it.
Try: · ·
0 paths traced in this browser · 0/s · seed 20261119
Engine check · this page waiting for photons · harness 7.779 ± 0.076, × the surface sunlight · |z| too early to call
The engine check runs at the checked settings.
What the check compares
The light in the marked 10 cm window 2.5 m down, in the 550 nm band, as a multiple of the sunlight at the surface. That band uses exactly the harness's scene A, so the Python harness can measure the same number: 7.779 ± 0.076 from one 100k-path run.
The top 4.5 m of a 1 m patch of sea, seen from the side and repeated across, because the scene is periodic. The surface is two crossing ripples, 8 cm and 6 cm from trough to crest. Brightness is the light crossing each depth, averaged along the crests; 1 is the sunlight arriving at the surface. Colour comes from three bands (650, 550 and 450 nm) absorbed at the rates measured for pure water (Pope & Fry 1997), plus the scene's grey particle absorption. Coastal water adds dissolved organic matter, which absorbs more at short wavelengths (Bricaud, Morel & Prieur 1981). The 550 nm band uses exactly the harness scene, which is why it can be checked.
The sheets meet about 2.46 m down. The lens formula n/((n−1)ak²), with amplitude a = 4 cm and k = 2π per metre for the 1 m ripple, puts the focus 2.50 m below the crest, which stands 4 cm above mean sea level. Two thirds of the red is gone by 3 m, so the light turns from white to cyan. The faint lines are single photons: each bends where it crosses the surface, and each dot is a scattering.
Two sine waves, not a sea spectrum, and no sky light. Three colour bands stand in for a spectrum, and a Henyey–Greenstein phase function with g = 0.92 stands in for measured particle scattering. The side view averages along the crests, which hides the smaller ripple's focus at 3.30 m; Fig. 3 shows it from above.
Light entering the sea is bent by every ripple, loses a little at the surface, then is scattered by particles and absorbed by the water itself, red first and blue last. These figures trace that light photon by photon in your browser, and check the result against an answer that is known exactly.
An answer we know exactly
Take the particles out of the water so that it only absorbs, and the light 2.5 m down follows from the shape of the surface alone. The harness's ray-map quadrature gives it to five significant digits. The engine you just watched now fires photons through the same ripples and counts where they land.
Fig. 3 · Exact check · Live · Scene A′, absorbing water
paused: offscreen
Preview until photons arrive: rays mapped through the surface by this page's script. In this absorbing water that is the whole answer. Live photons replace it.
Exact values
exact (ray-map quadrature, 128² grid): 1.478649 · 2.175321 · 9.311052 · 2.175321 · 1.478649 · 1.245641 · 1.146295 · 1.117627 · 1.146295 · 1.245641 · trough 0.231380
0 photons · focus window –, exact 9.311052 · trough –, exact 0.231380
No bug planted. The check starts when this figure is on screen.
Direct sunlight under scene A's surface in water that only absorbs (0.09 per metre): a map at the chosen depth, and ten windows along one row of the cell at 2.5 m.
Noise shrinks as photons arrive. A planted bug makes its distance from the ticks grow instead. The engine tests for a catch after every few milliseconds of photons, once the first 30 blocks of 1,000 are in.
Scene A′ has no scattering, which is what makes an exact answer possible. Fig. 1's scene scatters, so its only answers are Monte Carlo ones (harness: 7.7499 ± 0.0033 from 12 M paths). The exact values come from the harness's ray-map quadrature; its 128 and 1024 grids agree to 4 parts in a million at the focus (9.31105 and 9.31101).
The focus window gets 11.9 times the light a flat sea would give it, and the window under the trough gets 0.30 of it (0.23 of the sunlight above the sea), under a third of the flat value. Bars should land on their ticks; at ±2 standard errors one window in twenty misses by chance, so expect the odd near miss, never a gap that grows. Plant a bug and the gap grows with every photon, because bias does not average away. This page waits for 5 standard errors before it says caught, because it checks 11 windows after every batch of photons, hundreds of times a second.