I'm aware of glFog, which blends between the fog and surface colour based on distance to the camera, like this:
The equations are even given in the docs. But the fog is applied immediately in front of the camera. I'm trying to render a water surface and want it to have some depth, for example:
At the moment I'm just rendering the water surface with alpha blending, as below. What I need is to have the fog based on the distance from the water surface to the bottom of the water. How can I get this distance? For the moment I'm assuming the camera will always be above the water.