Screen space ambient occlusion

In Chapter 1, Forward Lighting, we covered the hemispheric ambient light model where the ambient light is selected based on the vertical component of each pixel normal. You may have noticed that unlike any other light sources we covered, the ambient light does not have a shadow implementation. In fact, our ambient light model doesn't take occlusion into account at all.

In this recipe we will cover a screen space method to calculate the occlusion of each pixel affected by ambient light, and store those occlusion values in what's known as an ambient occlusion map. The ambient occlusion map will later be used during the ambient light calculations to affect the ambient light intensity of each pixel.

Getting ready

All calculations ...

Get HLSL Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.