I implemented SSAO in the game engine I'm working on and the results were good, but not as spectacular as I expected. I used 2 color attachments (2 render targets for those more familiar with directX) for the initial rendering of the scene. The second color attachment I used for storing ModelView transformed direction vectors to each pixel on the screen (Eye space normalized eye vectors) and in the alpha component I stored the ModelView distance. Now whats to note here is, SSAO is not only dynamic but also is applied as a post process to the scene. So you can probably add it to your HDR/DOF pass. Just recover the 3D point at that pixel and then compare it with some 3D points around that point in a hemisphere. Then apply noise.
Inigo of RGBA demoscene group explains in this page: http://rgba.scenesp.org/iq/computer/articles/ssao/ssao.htm
But for some reason his method didn't work directly for me. For example the projection he performs in his loop for the 32 hemisphere 3D points a multiplication with
vec2(.75,1.0); but I found that (.78,1.0); works precisely. Well for me atleast.
You can always try using a gaussian blurred scene texture as a replacement for the 32
iterations. It worked as well as the SSAO in Crysis but with thick white borders.
Anyway, onto screens,
Without SSAO:
With SSAO:
SSAO Contribution to the scene looks like this:
Hope this was useful, I'll probably put some screens and details about my uber
per pixel lighting shader next time, or may be some OMNI directional light sources
that cast shadows. Its pretty old, and even my implementation was done a long time
ago.
Apart from the above algorithm, I did implement SSAO with extremely good results
(similar to Crysis and twice as fast) with a gaussian texture obtained from my
bloom pass. But unfortunately I got some ugly artifacts on the border (Outlines).
If anybody manages to fix this, please tell me!
Here are some images of SSAO which uses the Gaussian texture.
I used this equation:
AmbientOcclusion(x,y) = 255 + GaussianAverage(x,y,sigma) - PixelValue(x,y)