Water ripples

Version 1 of 4

Refracting ripples.

PC · VGA · 320×200 · late '90s

This version

Rain and a wandering stirrer disturb two integer buffers; the slopes bend a tiled floor with an inlay, quantised to the VGA's 18-bit colour.

How this version works

At 320 pixels wide, two signed 16-bit height buffers carry waves disturbed by random rain and a wandering stirrer. Each update halves the sum of four neighbouring heights, subtracts the previous height, applies roughly 3% damping and swaps the buffers. Height differences offset lookups into a wrapping 512×256 tiled floor with a DEMO / LEGACY inlay, while the horizontal slope controls brightness. The resulting colours pass through the VGA quantiser.

The trick in this version

Bit shifts implement the halving, damping adjustment and refraction offsets, while power-of-two masks wrap the floor coordinates. The colour conversion emulates VGA channel precision rather than an indexed screen buffer; the simulation advances once per rendered frame.

Historical context · PC

  1. late '90s · Hugo Elias

    ‘2D Water’

    Elias explains a ripple program he had seen with its source included, two integer arrays and a filter, inventor unknown. A reader later recalled finding the page around 1998.

  2. 1999 · Alex Champandard · flipCode

    The flipCode water contest

    A contest entry already calls the blur-sharpen filter ‘famous’, and picks a sum of sines instead because the filter's result depends on frame rate.

  3. 2008 · Nikola · Microsoft developer blog

    Ripples in Silverlight

    Credits Elias and implements integer height buffers, damping and fast image generation inside a browser plug-in.

Platform
PC · VGA · 320×200
Era
PC
Rendered on
CPU
Tags
two buffers · refraction
Sources
‘2D Water’ (late '90s)The flipCode water contest (1999)Ripples in Silverlight (2008)