Incident / refracted rays Water surface h(x,t) Caustic brightness on floor

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

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.