Ready to execute
Hardware Heritage
The "Water Effect" was a viral algorithm in the late 90s (DOS/Java era). It simulated 2D wave equation dampening using two simple height buffers.
The Algorithm
It uses neighbor averaging: `Buffer2[x,y] = ((Buffer1[x-1] + Buffer1[x+1] + ...) / 2) - Buffer2[x,y]`.
Refraction
The height map is used to displace pixels from a background image, creating a convincing illusion of refraction.
Interaction
Move your mouse over the canvas to disturb the water surface.
Water Ripples
2D Wave equation simulation.
Legacy Algorithm
// Calculate new height
newH = ( prev[x-1][y] + prev[x+1][y] +
prev[x][y-1] + prev[x][y+1] ) / 2
- curr[x][y];
// Dampening
newH = newH - (newH >> 5);