Island Demo

An experiment to simulate water refraction. The code is compiled using java 1.1, to run it simpily double click
island.html.

My attempt to simulate water refraction is quite simple:

  1. render the water surface just like a normal polygon.

  2. I perform a “nearest polygon first” drawing routine, so each pixel is filled only once.

  3. instead of drawing the polygon which represents the water surface, I store the postions of the pixels that the polygon covers.

  4. after all the solid polygons are drawn, fill the pixels which were covered by water surface with the colors of neigbour pixels.
    (the distance change is determined by a precalculated Sin table)

Here is a shot of it:

http://www.freewebs.com/phu004/island.jpg

You can grab the file here:
www.freewebs.com/phu004/island.zip
(you have to manually save the file due to hotlink protection)

Ooo pretty. Not bad for a software implementation. Much better than I could do right now anyway (I’d be lucky to get the box that is that room being drawn actually).

This can be described as an animated perturbation filter across the texture. Pretty simple to do in GLSL with 4d noise but gives astonishingly good looks :slight_smile:

Very well done, love it

DP