I have a model and I need to bake ambient occlusion for it. How do I bake an AO texture?
First you need to UV unwrap the model so the texture can be baked
You should do this manually if you plan to need to create a real texture and you want a clean unwrapping. If you only need an AO map, Blender can do it for you automatically.
First, split the viewport by clicking and dragging the grip found in the top right corner of the 3D viewport out from the left to the center of the window. Set the new viewport to the UV/Image Editor:
Now Hit Tab to enter Edit Mode.
With your cursor over the 3D Viewport, hit A once or twice so that the whole model is selected (orange).
With your cursor still over the 3D Viewport, hit U and click Lightmap Pack. Enable New Image and set the resolution to a power of two that you want the lightmap's image to be.
You should now have a UV unwrapping in the UV/Image Editor viewport.
Next, set the material to pure white if desired
If you plan to use this ambient occlusion map as an overlay in an actual diffuse texture that you create, you want the flat parts of the surface to appear pure white so that they are pure transparent when overlaid with a multiply blend mode. By default, the ambient occlusion texture bake will include the color of the surface which is the default gray. To fix this, go to the Material tab and drag the color up to pure white and the intensity up to 1.000.
Upper box: drag the circle all the way up to pure white
Lower box: drag the intensity box to the right until it reaches 1.000
Now you can set up the actual texture baking
Under the World tab, enable Ambient Occlusion and then set the Samples under the Gather section to a number that you like. The higher the number, the higher the lightmap quality but consequently the higher the bake time. You may want to set it to something lower such as 20 for test bakes before you create a final bake at a higher setting such as 128.
Next, go to the Render tab and under the Bake section, set the Bake Mode to Ambient Occlusion. Then hit the Bake button and wait as the ambient occlusion map is baked for you.
You can watch the progress as the texture is created in the UV/Image Editor and the progress bar at the top of Blender.
When it is done baking, leave Edit Mode by hitting Tab and setting the Viewport Shading to Texture.
You can now see your model with ambient occlusion!
Note the gray: this will occur if you do not set the material to white prior to baking as described above
You can now export this texture from the UV/Image Editor by clicking Image > Save As Image.
Then just name the file, choose a format, select a file location, and hit Save As Image.