"All it takes to fly is to hurl yourself at the ground... and miss."
- Douglas Adams

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)
Volumetric fogging
Saturday, October 26, 2002 | Permalink

Executable
Source code
VolumetricFogging.zip (1.9 MB)

Required:
GL_ARB_texture_env_combine
GL_EXT_texture3D
GL_EXT_texture_edge_clamp
GL_EXT_blend_subtract

Recommended:
GL_ARB_texture_compression
GL_EXT_texture_compression_s3tc
This is a demo showing how to render volumetric fogging, which it does in some kind of heaven and hell theme. I've based my work on the NaliLord Unreal level and another Unreal level I've designed myself. To get the right ambience I've added some suitable music made by the very talented group The sins of thy beloved who are able to seamlessly mix metal with moody violins. The full song is available from their website.
The volumetric fogging works by rendering the radial distance of the scene into destination alpha. The same is then done with the fog volume with front face culling. Then the fog volume is drawn again with back face culling and doing a reverse subtract with the destination alpha. The destination alpha will then contain the distance through the fog. With the 8 bit alpha of most todays cards it might take a little tweaking to get it to look good, but I was surprised I could even get this good results. I plan to make a better implementation once I get my Radeon 9700.
Don't mind the "lighting" in this demo, I didn't care to write a whole per pixel lighting engine for this demo, instead I've done some ugly tricks with primary color. But the lighting isn't what I've focused on in this demo and not what I wanted to show. There are some other dirty aspects of my code you might find if you decide to inspect the source.
I have added some particle systems for some fires and smoke too, which might be interesting for some. It's basically the same particle system implementation I've shown earlier.

It should run on Radeon 8500/GF3/Parhelia and up.

2002-12-15:
Changed the Bass audio library to OpenAL + libvorbis. There's now sound support for both Windows and Linux.