# Noise in SSAO

This topic is 2600 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone:

I implemented a SSAO described in "Simple and Practical SSAO" on gamedev.net. The result is good but very noisy. I tried adding a simple blur pass but the noise was still there. Does anyone know a good way to eliminate the noise?

##### Share on other sites
Pretty much every SSAO technique is going to produce noisy results Your results there actually don't look too bad compared to other implementations I've seen.

You can:

What kind of blur are you performing at the moment?

##### Share on other sites

Pretty much every SSAO technique is going to produce noisy results Your results there actually don't look too bad compared to other implementations I've seen.

You can:

What kind of blur are you performing at the moment?

I use a very simple 3x3 blur with following weight:

16 26 16
26 41 26
16 26 16

By the way I also want to know what is the best way to integrate SSAO with other lighting models? Say if I know the ao and light intensity at a given pixel how can I determine the color of the pixel?

##### Share on other sites
Make sure not to blur onto pixels with a z value that's too far away or you'll get occlusion bleeding. As far as using the AO, you should probably make sure it only applies to the ambient term.

##### Share on other sites

Make sure not to blur onto pixels with a z value that's too far away or you'll get occlusion bleeding. As far as using the AO, you should probably make sure it only applies to the ambient term.

Thank you.

It seems to me that the contribution of AO to the whole scene is very small when there are a lot of lights in the scene.

##### Share on other sites
Like all real-time graphics, there's no right way to incorporate your screen-space AO results
Technically, since it's ambient occlusion, you should only multiply the ambient light against this texture - but that means you simply won't see the effect in well lit areas.
You could multiply all light contributions against the AO texture, but then well-lit areas will look way too shadowed sometimes.

You can apply different weightings to different contributions, e.g. full occlusion factor on ambient light, and half occlusion for direct light:float ao = /*sample ssao texture*/ float halfAo = ao * 0.5 + 0.5; ambientLight *= ao; diffuseLight *= halfAo;There's lots of other ways too, for example, naughty dog use their cascaded-shadow-map to mask out the AO effect, so it is only applied to shadowed areas.

Also as Locater says, to avoid 'bleeding' artifacts in the blur step, you need to use a depth-aware bilateral blur filter that ignores samples that cross a depth discontinuity.

##### Share on other sites

Like all real-time graphics, there's no right way to incorporate your screen-space AO results
Technically, since it's ambient occlusion, you should only multiply the ambient light against this texture - but that means you simply won't see the effect in well lit areas.
You could multiply all light contributions against the AO texture, but then well-lit areas will look way too shadowed sometimes.

You can apply different weightings to different contributions, e.g. full occlusion factor on ambient light, and half occlusion for direct light:float ao = /*sample ssao texture*/ float halfAo = ao * 0.5 + 0.5; ambientLight *= ao; diffuseLight *= halfAo;There's lots of other ways too, for example, naughty dog use their cascaded-shadow-map to mask out the AO effect, so it is only applied to shadowed areas.

Also as Locater says, to avoid 'bleeding' artifacts in the blur step, you need to use a depth-aware bilateral blur filter that ignores samples that cross a depth discontinuity.

##### Share on other sites
Technically there is no ambient occlusion in real world (as well as in physically based rendering)... Although we have to somehow fake GI (well actually we don't, but ... well then it wouldn't be realtime anymore).

##### Share on other sites
Scalar ambient occlusion is just your visibility about the hemisphere, which makes it a pretty good approximation for sky lighting and other IBL sources. Where it doesn't really work is direct lighting, or any lighting contribution where the visibility is already accounted for (such as indirect lighting from radiosity). Not that it'll necessarily look bad if you apply it to those lighting terms...you'll just be over-darkening things a bit. For some games (like Gears of War 2) this fits in perfectly with the look they're trying to achieve.

##### Share on other sites

[quote name='Locater16' timestamp='1302332903' post='4796237']
Make sure not to blur onto pixels with a z value that's too far away or you'll get occlusion bleeding. As far as using the AO, you should probably make sure it only applies to the ambient term.

Thank you.

It seems to me that the contribution of AO to the whole scene is very small when there are a lot of lights in the scene.
[/quote]
The typical way to remove the noise is to apply a bilateral filter to the results, where discontinuities in the depth and/or normal vector are used to determine how similar two values are. This should minimize the amount of bleeding, but still produce a smoothed version of your occlusion.

• 36
• 15
• 9
• 23
• 10