So a few days back a bunch of Gamefest 2010 presentations went online and amongst them was a talk by Monolith on lighting volumes. I had been using cube maps to light dynamic objects but this approach seems much nicer. As a bonus, the lighting volume can also be used to light static geometry and provide volumetric lighting effects, enabling you to light the space between objects as well as the objects themselves (Think the heavily light polluted city of Blade Runner).
Blade Runner. Copyright © 1982, 1991 by the Blade Runner Partnership.
So first I had to generate the volume samples. The paper and talk mention rendering cube maps to generate the lighting volume data but I've opted to use my lightmap tool to gather lighting information. Older versions of the lightmap tool used hemicube rendering (which was very slow) and volume sample counts quickly add up. For example, a 128*128*128 light volume requires 2,097,152 separate samples, multiply that by 6 individually rendered cube map faces and you've got a lot of draw calls. Add the cost of frequently dragging that data off the graphics card and onto regular memory and you're left with a lot of time to practice your knitting.
So here's the result so far. I've used the street scene again and sampled a 32*16*16 volume. In this case there are a lot of wasted samples and I'm sure I'd be better off custom fitting smaller sampling volumes. To clarify, the building surfaces are still being lit with lightmaps in these screenshots. I haven't gotten around to outputting the light volume textures and rendering with them yet.
In other news, I've decided to put my attempt at GPU ray-tracing aside for now. It's no quick task and it seemed unproductive to go marching down another avenue to replace a method that is actually performing quite well. On the plus side, I've since revisited the problems I was having with the depth peeling method and have managed to solve the one which was bothering me most. :)