Baking Ambient Occlusion
Ambient Occlusion: a somewhat resource intensive way to make things just look better. If you’ve ever visited the Blender Artist forums, you’ll see people posting models that they have put their hearts and souls into for weeks, months, even years! Often you will see multiple comments below the first pictures blasting something along the lines of “TURN ON AO”!
Ambient Occlusion simulates the way light travels and bounces off of objects, especially objects that aren’t meant to be reflective. Describing it would be well and good, but I am a firm believer in visual learning. So instead, here are some video examples.
The first video shows a basic cube, with the inner faces extruded inward to give it some depth, as well as an interesting little ‘nub’ on top. Ambient Occlusion has not been activated, it is a simple render with simple lighting.
Get the Flash Player to see this player.
This next video is of the same cube, but with a well lit Ambient Occlusion pass. Notice how much more realistic it looks?
Get the Flash Player to see this player.
Here’s the only problem with Ambient Occlusion. Real time AO is extremely resource intensive. Running the spinning cube animation with real time Ambient Occlusion in the Blender game engine is impossible for all intents and purposes. So does that mean we are stuck with unrealistic boxes in our games? No! If they can make it look good in commercial games, we can do it too.
Baking. Not cookies or cakes, come on now. We are talking about Ambient Occlusion baking. We take the cube, and break it down into a flat image made up of it’s faces. We then tell Blender to render the Ambient Occlusion not onto the cube, but onto the flat picture we just made. THEN we re-apply that picture to the cube, so that the faces in the picture match back up to the faces on the cube. Next thing we know, we’ve taken the look and visual qualities of Ambient Occlusion and, in a sense, painted it on to the cube just like we would colors or other images.
Baking the AO onto the cube let’s us do real time animations that look practically as good as the original, resource intensive AO. This video shows a baked form of AO that has been tweaked for even better lighting and shading.
Get the Flash Player to see this player.
That lets us do cool things like this in the game engine!
Get the Flash Player to see this player.
To see for yourself that the cube animation really does run in the game engine (in real time), go ahead and download the blend file used for this post here. When it opens just hit ‘p’ and watch that cube spin it’s heart out!
For more info on Ambient Occlusions, just check out it’s Wikipedia entry.
Blend on!
–Lace





