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. :)
2 comments:
Stefan, it would be cool to get some more details about those problems and how you fixed them.
Sure thing, the biggest problem I've had so far has been with light leaks. These typically show up in the corners of rooms in scenes with exterior lighting, like an environment map for instance.
I've tried a few things but in a nutshell I just increased the size of the depth peel buffer to match that of the lightmap being generated. Simple but it seems to have had the biggest overall effect, although with some cost to render times.
The other problem which I'm yet to encounter (but am anticipating) is that of rendering very large scenes containing small objects. I have a few ideas about how to work around this but I'm holding off until it becomes an issue.
Have you switched over from hemicubes? Send me an email, it'd be great to swap notes :)
Post a Comment