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

Friday, 17 September 2010

Thin UV charts...

Been awhile but despite appearances I have had my nose to the pixelated grindstone. I'm hoping to have a nice light volume demo ready soon so I'm looking forward to showing that off. Until then I thought I'd share the solution to a niggling problem that's been bugging me for quite some time.

The problem occured when attempting to pack a lot of very thin UV charts into a lightmap. Sections of these thin charts would often fail to render leading to black splinters on the final lightmap. Figure 1 below demonstrates this. The pillar shown is one of 12 packed into a single 512x512 lightmap.

Figure 1. Thin UV charts fail to render and cause black splinters in the resulting lightmap.


The solution is very straight forward thankfully. All that needs to be done is to check the length of every UV edge and stretch any that are too close. Initially I checked each edge length and moved UV vertices whenever they were too close together. This lead to vertices sometimes being moved more than once and often in very different directions, leading to some pretty messed up UV's. Instead,  I found it was better to determine the average of these potential new vert positions, and then move the vert to that average position. Figure 2 shows the improvement.

Figure 2. Thin charts have been expanded, no more splinters.

The lightmap remains the same size and large UV charts are unneffected. I thought I'd post in case anyone else out there was having the same problem. This might only be a problem with Microsofts UVAtlas but I seem to recall it happens with Max's built in unwrap tool as well. If anyone is interested in the script let me know and I'll make it available.

Wednesday, 14 July 2010

The SSV Work In Progress

Some more development renders for the project I'm working on. 

Thursday, 8 July 2010

Volumetric lighting

I think the aspect of light volumes that most caught my attention was the ability to perform volumetric lighting across an entire scene. Because lighting information is available for the space between objects it's possible to imitate the effect of light interacting with very fine, free floating particles such as dust, smoke or pollution. This is done simply by sampling the light volume texture multiple times along the space between the camera and the surface being rendered. The technique is known as volume ray marching and you can read about it here and here. All screenshots were taken from my light map renderer. I'll post a video soon as the effect is even nicer in motion.






Friday, 2 July 2010

Light volume video

I've finally made a video showing the light volumes in action. The video shows a dynamic object being moved around a scene with large emissive surfaces. In this video, the light volumes are only applied to the dynamic object, static surfaces are lit via light maps. The video was captured directly in the lightmap tool and total time to bake the light map and light volume was about 30 seconds.

BugBackToad model by SonK, which can be found at http://ompf.org/forum/viewtopic.php?f=7&t=752