Attached is an example file for rendering a scene using ambient occlusion in combination with the -u option on the mantra output node to create an ambient occlusion texture map.
This can be useful for multiplying with texture maps on geometry that takes a long time to render like buildings and landscapes where you can get away with doing it a single time rather than for every frame. It can also be extremely useful for adding depth to texture maps on fur, though you would want to do an image sequence as opposed to just a single still.
All nodes in the file are commented to help with readability.
How it works:
* The output drivers use the unwrapping parameters. These allow you to specify an object (and vertex attribute to use).
* Each object has a vertex uv texture attribute. The texture attribute must be a vertex attribute, and fit in the (0-1) space.
* The geometry which is used for rendering must be made of polygons. However, the map can be applied to any geometry after that.
* There is a custom shader enclosed in the file. This shader doesn't use frontface() to orient normals. Instead, it only shades one side of the geometry. This is so that the front/back faces of the geometry will be shaded consistently.
* You will notice that there are seams when texturing. If you examine the texture map, you'll see that the uv coordinates do not quite map around the full object. When MIP Maps are created by the texturing engines, these black edges are blended in at the edge of the maps. You can improve the quality by expanding edges of the map. This is reason that we pass our textures to compositing rops immediately after creation.
* Also, the maps can be post-processed. For example, you might decide to blur the map, or run the map through a despeckle filter, or paint it by hand.