Home▸Optics & Light▸Water Caustics Refraction Lab (2D): Snell's Law Ray Tracing

Water Caustics Refraction Lab (2D): Snell's Law Ray Tracing

2D water-caustics lab: a real wave-superposition surface refracts parallel light rays by Snell's law (n1 sinθ1 = n2 sinθ2), ray-traced down to a floor line whose brightness map is the actual accumulated caustic pattern.

Optics & Light2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-water-caustics-refraction-lab ↗ Open standalone

This 2D companion strips the pool scene down to a cross-section so the optics is directly legible: a real two-term wave height field h(x,t) sets the water surface, its analytic slope dh/dx gives the surface normal at every point, and each incoming ray is bent through that normal with the exact vector form of Snell's law (n1·sinθ1 = n2·sinθ2) before being ray-traced straight down to a floor line. A live histogram of where those rays land — recomputed every frame from the current wave shape — is drawn as the floor's brightness, so the bright and dark caustic bands you see are the actual accumulated ray density, not a decorative texture.

⚙ Under the hood

2D water-caustics lab with a real wave-superposition surface, exact vector-form Snell's law refraction, and a floor brightness map built from a live ray-landing density histogram.

causticsrefractionsnells lawray tracingopticswater surfaces

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)