top of page

Ambient Occlusion

It makes wrinkles dark

Have you ever observed a corner in real life and wanted saw that it was darker than the walls around it? This is caused by ambient occlusion and we can generate ambient occlusion maps in real time. First one must render the geometry to the depth buffer, then they must use textures containing both the depth and position of the nearby geometry. It then performs a calculation to determine the occlusion for each pixel upon the geometry.

This calculation requires a constant psuedo random distribution of nearby pixels. It is constant as otherwise the occlusion would change even if one didn't change anything about the scene. The pixels are compared with the present one's depth and position, and if the nearby pixels are within a range of influence then the current pixel becomes more and more occluded. The range of influence is determined by the application and is not set in stone, but it should be about 1 meter for human scale. These values are then written to an occlusion map for eventual use in a fragment shader. 

But one cannot solely create a good occlusion map like that. It's not blurry enough, yeah you heard me. So we also have to blur the occlusion map about it's x and y axis allowing it to be smudgey enough to appear to be actual self occlusion, as that would be cause relatively soft shadows. This blurring is still a gaussian blur but it's weights are determined by the pixel being blurred and the pixel being blurred with's depth and positions. This can be relatively simply done in a compute shader. 

Occlusion Map Blurring

Occlusion Showcase

bottom of page