This doesn’t make much sense that’s what shadow maps are for!Īs a final note, don’t just judge the result of AO by looking at the black-and-white occlusion map. If you use the calculated AO to modulate direct lighting, you’re changing the light intensity based on occluders that aren’t even between the surface and the light. It’s been a while since I’ve seen this violated, but I’ll mention it anyway. Use it on the ambient lighting contribution only! Look at the real world, and you’ll be hard pressed to see such precise occlusions over a similar distance. Big darkening halos emanating from your game character.Wall corners and ceilings have odd emphasized dark corners.SSAO has been around for some time, but these things still bother me in new titles. My biggest problem with most SSAO-implementations are that they are too strong, have noticeable artefacts and are simply distracting. I will skip over these as they are already well known. There have been plenty of articles on SSAO dealing with the implementation details and the problems inherent from it operating in screen-space. If your scene’s ambient contribution only consist of a single ambient colour, this point is moot but if you start using light probes it’s good to be aware of what AO really does. Makes sense, but if we’d simulate this with AO-like formula, the reflected light would simply be a darker purple! The example is using direct light instead of ambient, but the idea is the same (and the direct/ambient distinction is just a computer thing anyway ) ). Place a box over the red light and the light on the wall will be blue. The light reflecting off the wall is then of course purple.
To illustrate the problem at its most basic, imagine aiming a red and a blue spot light at the wall. This is not the same as grabbing the total colour of the incoming light – disregarding occlusion – and then multiplying it with an average occlusion factor. Whether it will actually reach the surface depends on any occluders in the neighbourhood. In reality, an infinite amount of ambient light rays approach the surface across the hemisphere surrounding it. At least not in the way that it’s implemented. In reality ambient occlusion does not exist. Screenshots are made in Helix (using HBAO) using Crytek’s Sponza model as modified by Morgan McGuire, found here.
First, however, I’d like to write down a few things learned about using AO rather than implementing it, as a way to flex my fingers after such blog absence and – who knows – maybe convincing people so I’ll stop getting so annoyed! I won’t be talking code this time, so this post assumes you either have your own implementation already or you’re using a renderer that does. Having been playing around building Helix whilst desperately trying not to fall into the same trap myself, I was hoping to make a post about my HBAO implementation. Sadly, I have the feeling the latter is still the most common case in the games I get to play. They can be great if done right, but really horrible when done wrong. Screen-space ambient occlusion and its siblings like Image-Space Horizon-Based AO are some of those techniques that I have a hard time loving.