Screen Space Ambient Occlusion is a post processing technique for approximating the shading achieved by ambient occlusion. Rather than using scene information such as geometry and lights to calculate shading, SSAO requires only a 2D depth buffer. For each pixel in the depth buffer multiple samples are taken from nearby and used to approximate the level of occlusion, this value can then be used to shade the output pixel.
The example scene above is made entirely of Papervision cubes and spheres and contains no lights and no shader materials. Each object renders it’s bitmap texture as expected but also renders it’s depth to the depth buffer. The depth buffer is filtered using my SSAO Pixel Bender kernel then blurred and brightness/contrast adjusted using standard Flash filters.
For a purely post processed effect the results are remarkably good adding a lot of depth to a flat scene. However there is still lots of room for improvement. The halo around objects could be minimized with a custom blur filter. The self-occluding surface issue is the result of no normal information and I have a few potential solutions for that. Still, not bad for phase 2!
Ralph Hauwert
Looking good. I was working on exactly the same thing for FP10. A tip I might give you is to do the depth sampling using a pseudo random lookup for surrounding pixels….this would remove the static look of the noise, and might help on the overall look of things, when moving.
Great work!
Sep 28, 2009 @ 12:12 pm
Ben
Thanks! Currently I am sampling 8 depths per pixel using pixel index to generate a sine value which then drives the positioning of the depth samples taken (poor mans random generation). I did contemplate using the 2nd PB input as a way of passing in a random LUT and rotating through those values, I’ll have to give that a try!
Sep 28, 2009 @ 12:40 pm
nicoptere
that’s rather impressive.
can’t get really how you find the final value but it works really well both for shading and blooming.
keep on
Sep 29, 2009 @ 6:29 am
Alex
Really amazing!
I would like to try it, so I wonder if you could provide the source code…
Dec 09, 2009 @ 11:30 am
Ben
@Alex thanks! Source is coming soon
Dec 15, 2009 @ 7:57 am
Edan KWAN
I just made one inspired by this.
http://edankwan.amiciforce.com/
I used your Depth Buffer Material, its brilliant! The performance of mine is really bad. I have already low down the 2200 width of the buffer into 256 which mean i just need to take care of the blue channel and i used 4 random points for SSAO detection for each loop.
The performance is still bad and the effect is not as good as yours…
Feb 25, 2010 @ 3:50 am