SSAO and edge artifacts

Started by
8 comments, last by kalle_h 9 years, 2 months ago

Hey,

I have been looking over my slightly broken SSAO and I have one last problem. I render the normal/depth map at half res, and after that the ambient map at half res. After that I do a bilateral blur on the ambient map, comparing the main pixel normal and depth with the surrounding pixels' normal and depth, to make sure I preserve the edge discontinuities. This results in this nice looking ambient map:

ssao_ambient.png

However, when it comes to using the ambient map I get problems around the edges as the ambient map is half res, resulting in the nasty looking halo-effects seen here:

ssao_final.png

It seems that most people are rendering their SSAO at half res though, for performance reasons, so I would like to know how they deal with the problem of different resolutions in the ambient map and final buffer, and how to combine them nicely.

Thanks!

Advertisement

Try this algorithm. http://graphics.cs.williams.edu/papers/SAOHPG12/

Basically this does ssao in full res but use depth mip chain as input which make it really fast. Another a bit simpler way is to do ssao in fullres but use half res(and precision) depth sample texture.

Thanks for the link but I am not prepared to rewrite the whole thing right now. I was more looking for tips on how to tackle and/or improve the current system. Regarding your second tip, I think the problem with rendering full res SSAO is that the blur pass gets very expensive.

Anyway, I was able to improve my system quite a bit by changing the blur pass shader to not discard pixels across edges completely, but rather include them with a much lower weigth (I am currently using 0.25 of the original). This results in the following:

ssao_final2.png

There are still some halo pixels visible on the right, but overall the result is much nicer, so I think I am going to go with this for now.

How do you down sample the depthbuffer?

I don't? I render a combined view space normal and depth buffer at half resolution as the first thing in the SSAO.

I haven't done ambient occlusion yet but I'm very interested in this since I particularly hate the "bright aura" objects in games tend to have when this isn't fixed properly.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

I don't? I render a combined view space normal and depth buffer at half resolution as the first thing in the SSAO.

Usually second geometry pass is way more expensive than doing full res SSAO.

I don't? I render a combined view space normal and depth buffer at half resolution as the first thing in the SSAO.

Usually second geometry pass is way more expensive than doing full res SSAO.

That may be the case, however since I am working with forward rendering I need to do a geometry pass to get the view space normals. If you are doing deferred then I guess you have a point.

Can't you do a single geometry pass that writes normals too? ie, two outputs, normal forward lighting pass + an additional output for normals. Then you grab that target and use it for SSAO.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Can't you do a single geometry pass that writes normals too? ie, two outputs, normal forward lighting pass + an additional output for normals. Then you grab that target and use it for SSAO.

This would basically turns out full deferred. SSAO should be only applied for indirect illumination which will need more information per pixel than depth and normal.

This topic is closed to new replies.

Advertisement