Monday, 6 December 2010

SSAO

I recently decided it was time to take another look at SSAO as it's a technique that should complement lighting volumes quite well. Due to their sparse nature lighting volumes don't provide mid/high frequency lighting detail so SSAO should help add some of that lost lighting detail back into the scene.

There's already been a heck of a lot written about SSAO and I don't have much more to add so my plan is to keep this post fairly brief. My first implementation attempts were several years ago now and although the results were okay the shaders were pretty complicated. They often involved sampling both normal and depth buffers, reconstructing 3D positions and also required lots of per pixel matrix multiplications. The technique shown here only requires a depth buffer and is quite straight forward to implement. You can read all about it in Rendering techniques in Toy Story III on the Advances in Real-Time Rendering in 3D Graphics and Games  SIGGRAPH 2010 page.

For these shots I'm using a total of 32 SSAO samples per pixel. If that gets to be too much of a frame rate killer I can dial it back but for now it's looking pretty good. The SSAO only affects the ambient light provided by the light volume, direct light remains unaffected.

Isolated SSAO



SSAO with light volumes




Full lighting with textures



The original museum model, complete with some awesome dinosaur skeletons which aren't featured here, was built by Alvaro Luna Bautista and Joel Anderson and can be found at http://www.3drender.com/challenges/. I also used some textures from the crytek sponza scene which you can grab here http://www.crytek.com/cryengine/cryengine3/downloads.

2 comments:

Glutinous said...

Nice! Been contemplating adding SSAO for my own project lately... thanks for sharing!

jarkko said...

Looks great. :)
Have you thought about using directional occlusion?

You already have the directional component for ambient, so it might give nice additional quality improvement. (occlusion doesn't always go to the black and desaturate ambient color.)

Here's one implementation which might give some nice ideas. ;)
https://mpi-inf.mpg.de/~ritschel/SSDO/

Post a Comment