Pages

Wednesday 22 September 2010

Light Volumes – Sponza Attrium

In previous months I've posted several simple volume lighting tests. The screen shots were taken in my global illumination lightmap renderer so the results were fairly basic. I wanted to try using light volumes on a more complicated scene so I blew the dust off an old deferred render testbed and modified it to work with light volumes. I was about to build my own environment but remembered that Crytek had released their cracking version of the Sponza model so that's the model you see here. The model is largely unchanged although I've left out a few objects. The plants for one, mainly due to no alpha support in my render engine. I've also added some paper lanterns and a second UV channel for the ambient occlusion maps (see previous post).



Light volume generation

As before, a rough GI solution was first generated for the scene. This solution was then sampled to create the light volume textures. The rough solution, consisting of about 15 512x512 light maps and the light volumes took about 4 minutes to compute.

Screenshots taken from my GI light-map / light-volume renderer

Placing the light volumes was tricky, care needs to be taken that no sample point falls outside the scene or can “see” through to areas it shouldn't. The mid level floor and vaulted ceilings in particular took a few tries to get right. I used two volumes in this scene. It may have been possible to use just one but I wanted to attempt a scene with multiple volumes.

The smaller volume is 8x8x32 and the larger is 32x17x64

Scene rendering with light volumes




The deferred renderer I'm using renders in the following stages.

1. Render compressed view space normals, material roughness and depth to G-Buffer.

2. Render dynamic scene lights to light buffer.

3. Render volume lighting to light buffer.

4. Render final geometry using light buffer.

It wasn't hard to add an extra lighting stage to incorporate light volumes. The extra stage functions much like the existing light buffer stage. Geometry representing the light volume is drawn to the screen and the relevant area of the volume can then be sampled. Below is a breakdown of the lighting stages.

Static ambient occlusion (rendered offline in my lightmap renderer)

Dynamic direct light

Light volume ambient diffuse and specular

Final light buffer

As mentioned in the original paper (see references section) the light volume can also provide local environment specular. I initially underestimated this effect but it certainly makes a difference, especially in areas untouched by direct light. The images below show the effect well. A fresnel term also makes a big difference here, note the increased reflections on the wall in the second image.


In addition, a couple of images showing ambient specular and ambient diffuse in isolation.


Finally, two videos of the scene under seperate lighting conditions.



References / Links


Gamefest 2010, Lighting Volumes

HDR the Bungie way

Engel's Prepass Renderer (SIGGRAPH 2009)

Updated Crytek sponza model

4 comments:

Josh said...

It is nice to see this technology in use in a practical games scene. Thanks for showing multiple shots of the scene with different lighting conditions. In particular, I liked getting to see the specular contribution, and how it makes a difference.

However, I did have some questions for you:
1.) Did the manual placement of the volumes solve the "streaking" problem you previously mentioned?
2.) Did you find a specular power for your dynamic lights that produced highlights consistent with the volume's contribution?
3.) For the night lantern video, are the lanterns just emissive objects contributing to radiosity, or are you using point lights?

Stefan Kamoda said...

Cheers Josh,

To answer your questions:

1) I think I kind of got lucky with this scene to be honest. There aren't any sloping or crazy curved surfaces which seem to cause most of the streaks. I'm anticipating having to pre process the volume sample positions to move them into better positions, ie, not behind geometry, but I don't think it will be easy.

2) I imagine it would be possible to soften all the direct specular lighting to match. I didn't see that as being a problem though.

3) Both :) Initially a radiosity scene was calculated using point lights as the lanterns. The light volume was then built by sampling this radiosity scene (so it sampled bounce light but not direct light). Then, at run time, there are 8 or so deferred point lights providing direct lighting on top of the light volume.

Data said...

i just can't figure it out how you render volume texture ?

Stefan Kamoda said...

The lighting volumes are rendered in Bluestone, which is a separate lightmap/volume renderer I'm working on. The posts tagged 'Bluestone' and 'light volume' might give you a better idea but in general it's just a case of sampling illumination at fixed points throughout the scene and writing that data into the slices of a volume texture.

The volume texture can then be sampled at runtime to provide lighting data for any object at any point within the volume.

Post a Comment