Ocean

This browser seems not to support canvas. :(

How it works

Wave surface is generated by summing multiple sine waves on the GPU and stored in a 16-bit float render texture. Each frame, the height map is re-evaluated.

The duck's buoyancy is computed by sampling the height map around its position, then accumulating a rolling average of height and surface normal. It's not physically correct, but gives plausible result.

Ocean surface uses screen-space reflection with a configurable max reflection distance, blended with a scattering term for underwater color.

Render pipeline
  1. Wave height map pass (256×256 R16F)
  2. Buoy / object pass (separate framebuffer)
  3. Ocean surface pass (samples both above)
  4. Overlay composite
  5. ACES tone mapping