The following screenshots show a demonstration of sharp-edged convex volumetric fog, implemented using unextended OpenGL.
Handling transparent objects is significantly more complicated and not currently handled.
Non-convex fog must be split into convex pieces.
In these screenshots , there are three cubes of volumetric fog. The green one and the red ones are normal. The blue-white one has no opacity; it is a "saturating fog", e.g. a light halo (although an oddly shaped one).
In these first pictures, any "ray" passing through volumetric fog has at least 25% of the max opacity; this lets you see the visible edges where the fog is and see that the algorithm renders them precisely and sharply. (One could imagine using technique to create semi-opaque objects, or even to turn an opaque object transparent while making it still seem solid, instead of seeming to be a front face and a back face.)
This would look better if the framebuffer didn't
clamp at 1 (the saturated color should show through the opaque green more)
Inside the fog volume
The backface is near-plane clipped, but you can't see it
In the following images, the fog is normal, trailing to 0 intensity at the borders. The "sharp edge" rendering is still there--there is high-frequency content at both the near and far borders of the fog, although the near is hard to see).
The backface is near-plane clipped
In the following images, the camera moves sideways across the plane of one face of the green volumetric fog, causing the fog to produce a very sharp border. This is a correct appearance for a simulation of convex polygonal fog with constant density; the use of texgen precludes using non-constant density. This may well imply nobody would really ever want to use this.
In the following images, the world texturing is disabled to allow you to see the fog without the high-frequency textures hiding details. The lighting model in the scene is a hack, and the last few images run through full ambient and no ambient. I also increased the opacity of the fog so the green fog goes fullly opaque.
description of algorithm
home : sean at nothings dot org