Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I implemented SSAO in my game based on the tutorial at But the results I get are disappointing. Instead of a smooth effect as seen in the nvidia demos, my implementation causes either squashy dark noise or results in a huge performance hit for all the blurring.

This is my scene without SSAO applied.

scene simply without SSAO

And this is how the result looks.

scene with ugly SSAO

For now I use the same code as provided in the example I linked above. How can I improve the result of the ambient occlusion shader? A lot of blurring seems to be very slow on the GPU. I would like to get a result similar to this by Nvidia. How do they do that?

share|improve this question
Hard to answer anything more than "follow the tutorial". If you are having trouble following the tutorial, there's not much we can answer here without more details. – Byte56 Mar 22 '13 at 17:26
I think I followed the tutorial correctly. After that I tweaked the parameters to improve the result. But it's far away from the results I've seen all over the web. My question isn't about the tutorial, it's about a way I can improve the implementation. – danijar Mar 22 '13 at 17:31
up vote 4 down vote accepted

SSAO is frequently implemented with noisy sampling, plus a bilateral filter to smooth things out while preserving sharp edges. The tutorial only mentions this in passing in the second paragraph, so perhaps you missed it:

This SSAO term is saved to the red channel to the texture. This result must be blurred before combined with the original scene render. The blur can for example be a bilateral blur.

From your screenshots, it appears you've implemented the base SSAO effect, but without the bilateral filter. There was a SIGGRAPH course on bilateral filtering in graphics that you might want to check out for additional information.

share|improve this answer
I use filtering but it might be a naive approach. I just average over all pixels in a given distance. With a distance of ten or more pixels, the results are nice but the framerate drops from 60 to around 15 frame per second. – danijar Mar 22 '13 at 17:38
@sharethis There are definitely better ways to do filtering. First off, you can do a 1D horizontal blur followed by a 1D vertical blur. For a box filter or Gaussian filter this is mathematically equivalent to a 2D blur, but much cheaper. For other types of filters it's a useful approach as well, but may introduce artifacts. Second, you can generate SSAO at a lower resolution, like 1/2 or 1/4 of screen resolution, and blur it at that size. That will also make the blur much cheaper. – Nathan Reed Mar 22 '13 at 17:45
Thanks for your explanation. I like the idea of lower resolution sampling. Unfortunately I have no clue how to do that yet. But maybe this is another question. – danijar Mar 22 '13 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.