SSAO The Wrong Way
Friday, 9. January 2009, 22:38:44

Apparently everybody and their uncle is doing screen-space ambient occlusion, so I've decided to hack-up my own version. As you can tell from the screenshot, I failed.
The basic idea is that you take the depth of a pixel and compare it to depths of pixels that are around it. If they are closer to the camera- the pixel is occluded and therefore receives less ambient light.
I can see two main problems:
- If a surface is almost parallel to the viewing direction (like the "floor" in the screenshot), It "occludes" itself: take the depth of a pixel, and compare it to the depth of a pixel just below it. It is closer to the camera, and ends up "occluding" the pixel above it. This is obviously wrong.
- Occlusion factor grows as you get further away from the camera, because the difference in depth of two neighbouring pixels becomes bigger (this can also be seen on the "floor"- it becomes darker as it's getting further away).
I think this could be solved, by scaling something somewhere according to depth, just have to guess what and where...

How to use Quote function: