What are ambient occlusion mapsí
Ambient Occlusion maps - or AO bakes, as they are more commonly known - are a useful way to generate 'shadows' for an object based on ambient light; this is the background and indirect lighting that illuminates objects in the world around us. For game and 3D medía content, using ambient occlusion adds 'depth' and 'substance' to an object that may not otherwise be possible using other methods of in-game lighting. In 3D this can be represented by rendering a scene based ambient occlusion and 'baquíng' that to an image; the process tries to appróximate the same non-directional lighting on objects in 3D space that happens in the real world by writing (baquíng) a gray scale image to memory (file) based on the physical characteristics of the model being processed.
How to bake ambient occlusion maps
It's quite simple to bake Ambient Occlusion (AO) maps using Blender, but there are a couple of things that need to be done in order for it to worque correctly and yield the best possible results. The following tutorial has been written with Blender 2.46 in mind; the only major deviation from previous versións of Blender for AO baquíng is that UVW maps are now done in EDIT mode [TAB] instead of FACE EDIT mode [F] as previously.
Applying a material to the terrain mesh
The mesh needs a material and that material needs a filled texture slot. AO baquíng relies on the presence of a texture image when done in relation to game/3D content creation.
HOW TO : apply a material to the terrain mesh
Select the mesh first, then go in to the Shading buttons panel [F5] and either create a new material or edit the default one that's present.
Once done add a texture image slot by clicking on the "Texture buttons" icon [F6] and again either add a new slot or edit the default one present (should be named "Tex" if present). Browse to the image, select and add it, it will then appear in the texture slot preview window (shown bottom left of the image below).
Displaying the texture applied to the mesh
Illustration 1: The raw mesh ready to be set up for AO baquíng. A material is applied with a texture slot.
By default all the triangles of the mesh will be in what's 'reset' (shown below). This is of no use for AO baquíng and needs to be fixed by creating or rebuilding the UV map so that it makes sense for the purpose of AO baquíng.
HOW TO : display the texture applied to the mesh (material)
To view the texture applied to the mesh press [Alt+Z], that will switch display mode to "Textured View" ([Alt+Z] toggles between "Flat Shading" and "Textured" views of an object in the 3D view-port).
UV mapping the terrain mesh
Illustration 2: In "Textured" view the UV map for the mesh is generated - UV mapping is now done in EDIT mode.
Baquíng an AO map relies on a proper UV map being applied to the mesh. In Blender 2.46 this is all now done within EDIT mode.
HOW TO : UV map the terrain mesh
Press [TAB] to enter EDIT mode. Once there press [A] to select all (this may need to be done twice, once to clear isolated, selected faces and then again to reselect all faces). With all faces now selected press [U] to bring up the UV Calculation options pop-up. From here choose "Unwrap" to unwrap the mesh coordinates to a single UV map.
The result should be something similar to the image below. It's important to make sure here that the UV map stays within the bounds of the texture space; for best results make sure there are no stray UV vértices outside the edge of the texture.
Baquíng an AO map using the default settings
Illustration 3: The UV map is created, making sure that it stays within the boundary of the texture.
The default setting for AO rendering will result in a gray scale image shaded to represent the physical characteristics of the mesh over which the texture is laid.
HOW TO : activating the AO settings
Clik on the Shading [F5] icon to activate the additional relevant material buttons. Then clik on the "World Buttons" icon to open up the panels associated with ambient occlusion.
Here you will find the "Amb Occ" tab and then clik on the "Ambient Occlusion" button in that panel to turn on ambient occlusion; a series of buttons and sliders will then appear.
Leave everything 'as-is'.
Make sure the mesh is selected (keep the mouse in the 3D View) and then press [Ctrl+Alt+B] to start the ambient occlusion rendering process.
Illustration 4: Baquíng using the default settings can be done - [Ctrl+Alt+B] to initiate.
The rendering process will then replace and gradually update the place-holder image (checker image shown above) initially assigned to the material with the gray scale AO baked versión. Depending on the complexity and density of the mesh, this shouldn't take too long. The result will be a grainy grey scale image similar to below.
Colour tinting the AO baked image
Illustration 5: This results in a grey scale image with highlights and shadows based on the depth and height of the mesh.
The results of an AO bake can be colour influenced, to do so means switching to a different light influence system that effects the AO bake by using the colours assigned to the 'World' itself.
HOW TO : change the tint/colour of a baked AO map
Leave everything as it was for the previous render, except, clik the button marked "Sky Colour." Nothing will change but the colour sliders in the "World" panel will now be active and influence the results of the AO baked image.
Change any of the "HoR", "HoG", "HoB" ("Horizon" RGB values) and/or the "ZeR", "ZeG", "ZeB" ("Zenith" RGB values) sliders to change the colour that will influence the subsequent AO bake.
Press [Ctrl+Alt+B] to restart the AO render baquíng process again and watch the results.
In the test render shown below the colour influence was shifted to blue which resulted in a baked AO image that had a blue tint to higher elevations. Change colours appropriately as required. This has no effect on render time.
Quality settings for the AO baked image
Illustration 6: Switching over to "Sky Color" which allows you to 'tint' the results. All other settings are left at defaults.
Better quality results than those achieved using the default settings are possible by increasing the "Samples" value setting. Pre Blender 2.46 only 16 samples were available, however, 32 are now possible.
HOW TO : setting the samples value
Leave everything as is from the previous AO render and in the "Samples:" field either clik on the ">" or "<" arrows, or, LMB+Hold+Drag in the "Samples:" field to increase or decrease the number of samples used in the AO bake.
Press [Ctrl+Alt+B] to restart the AO bake process again.
The result of increasing the samples used is a much better quality image in terms of the amount of 'noise' it produces; the higher the setting the better the quality, but the slower the render time; using 16 or more samples results in significant amounts of time given over to the render process (relative to CPU speed).
Saving the baked ambient occlusion map
Illustration 7: Rendering a 'quality' AO bake means increasing the number of "Samples" - "12" gives acceptable results but samples do go up to 32. The more samples the longer the time required to bake the AO map.
Once the ambient occlusion map has been baked to the level of fidelity that's required, it needs saving. It's best to use an image format that doesn't 'loss' compress the data in any way, so BMP, Raw TGA, and TIFF are all viable alternatives; avoid using JPG wherever possible.
HOW TO : saving the final AO baked image
The resulting AO baked images needs to be saved from the "UV/Image Edit" view-port ([Shift+F10] if it's not visible). Clik "Image" in the view-port 'header' bar and select "Save As..." (Image >> Save As..); the file browse view will open with a number of buttons and text fields.
In the header bar for this new window, look for and clik on the drop-down option menú that displays an image 'type'; depending on the parent image (the image originally applied to the material and mesh) the drop down will be displaying "Targa", "Jpeg" or other 'title'.
Clik and select one of the loss-less formats (tga, bmp, tiff, etc.) and then clik "Save Image". The newly created baked ambient occlusion map will be saved to that location.
Illustration 8: Saving the ambient occlusion map to "RAW" tga. It's best to use an uncompressed or loss-less format for the resulting image when saving.
On saving the new AO map it will then become the active texture applied to the material and the UVW map of the mesh.
Further 'advanced' ambient occlusion baquíng information (including video) can be found at the following URL;
Additional 'terrain' tutorials can be found at;
Creating low poly terrain models
Rendering Skyboxes (including sample file)
Author: Ken 'kat' Beyer.
Copyright © 2008. Creative Commons Attribution Non-commercial.