"He who knows not, and knows not that he knows not, is a fool...shun him.
He who knows not, and knows that he knows not, is willing...teach him.
He who knows, and knows not that he knows, is asleep...awaken him.
He who knows, and knows that he knows, is wise...follow him."
- Chinese Probverb

Framework 4 (Last updated: October 25, 2019)
Framework 3 (Last updated: February 6, 2017)
Framework 2 (Last updated: October 8, 2006)
Framework (Last updated: October 8, 2006)
Libraries (Last updated: September 16, 2004)
Really old framework (Last updated: September 16, 2004)
Refractions and reflections
Thursday, April 11, 2002 | Permalink

Source code
Refraction2.zip (990 KB)

GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4

This is a demo of a pretty realistic water surface. The waves are created dynamically by generating a texture with some perlin noise. The refraction is done by rendering the scene to a texture and then the wave texture is used to perturb the texture coordinates on a per pixel level in a fragment shader. Similarily for the reflections, except that they are rendered to the texture with y inverted. Finally, it's combining the refraction and reflection by interpolating between them depending on the view angle.

It'll only run on Radeon 8500 card right now.

Updated to run on drivers later than 6071. A driver bug was fixed that exposed a bug in this application, which I have now fixed. It won't run on older drivers anymore though.