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:

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