BakeAir is a variation of the Air renderer used to create a texture map for a surface from information computed in a shader. MayaMan knows how to drive BakeAir and then incorporate the results back into a regular render.
To tell MayaMan what you want to bake and how you want to use the results you need to attach a MayaManMaterialAttributes node to the materials on the objects of interest. Once configured you do a render with the BakeAir renderer and then switch back to your regular renderer.
Baking requires that the objects being baked have U/V information and MayaMan uses the first defined uvmap for each surface being baked.
The common options apply to both the bake phase and render phase.
Where to store the baked maps.
Should this material do baking when BakeAir is executing?
Usually used to capture output of displacement shader. Result is a 3-channel tiff file of xyz information so opportunities exist to construct a mesh from this data.
What parts of the surface shader to capture/regurgitate. None disables baking of surface shader , rgb only surface color, rgba surface color and simple transparency. Ci and Oi surface color and complex transparency. Illumination lighting information so that materials can be tweaked without having to reevaluate lighting, note some parts of the illumination equation currently can't be captured and still allow total flexibility for material tweaking.
Tells MayaMan that the information captured will not change over time so it doesn't have to happen per frame.
Tells MayaMan that each instance of each model requires a seperate map.
Tells MayaMan that the information being baked can be used in pretty much any context.
Tells MayaMan that your custom shaders are going to output data for baking.
The format for this value is very simple, just a comma seperated list of type/name pairs. ie:
color myCol, vector myVec, normal myNorm, point myPos, float myScalar
The types listed above are the only ones recognized.
Arrays may be specified by appending the array size to the variable
name, ie: float myScalar[4].
Quantization will default to floating point but 8/16 bit quantazation
can be selected by adding the 8/16 as a suffix to the type, ie:
color8 foo.
Vector/normal/point data will be output in object space... your shader should produce them in 'current' space and the output mechanism will take care of the transformation. If you copy vector/normal/point data into a float array inside the shader you'll need to take care of space transformation yourself (inside the shader before it goes into the array).
Should the maps be re-baked even if they exist?
If the maps have been baked... should they be used? The magic shaders know how to look for and use the standard baked channels.
User attributes are placed in the rib to indicate the existence of baked maps and are specified like this in the rib:
Attribute "user" "string bakemap_foo" [".....']
Custom shaders that are using arbitrary bake channels should detect
the presense of baked data like this:
uniform string foo_map = "";
attribute("bakemap_foo", foo_map);
if(foo_map == "") {
/* compute foo */
} else {
/* lookup foo from foo_map */
}