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

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)
VolumetricLighting II
Sunday, June 1, 2003 | Permalink

Source code
VolumetricLightingII.zip (453 KB)

This demo shows a way to create volumetric lighting. Unlike my previous volumetric lighting demo, which did it in the vertex shader, this one does it in the fragment shader. This means better quality and no tesselation needed, but at a performance cost. I'm also using a different method to create the effect, which is less complex and gives better results in general. It computes the smallest distance from the light to the ray between the camera and the fragment and lets the light volume brightness decay according to it.

This demo runs fairly slowly, should run fine in 1024x768 or so though. There are plenty of ways to optimize it though had I cared enough, so it's not really that the technique in itself is very slow (though maybe not very fast either), but rather that I draw a full pass of the whole scene for every light.

Should run on Radeon 9500+ and GeForce FX.