//Create by Aaron Fang 2009.08.23
//This script can help to bake AO map base on normalmap details. It is a step by step workflow. Just follow the 1,2,3...and you will done.
//Bake AO map
//1, Create Ground Plane: creates a polygen plane with white lembert shader applied on. Normally for ground plane. You can create more for specfiic environment.
//2, Select Main Geometry: Select the geometry you want to bake. select more than one mesh will couse more shader be created.
//3, Select NormalMap File: pick the normalmap you want to apply to the main geometry.
//4, Create Shader with selectd normalmap: create a lembert shader with selected normalmap and adjust color and diffuse parameter.
//5, Set mrRenderGlobal: "Load MentralRay Plugin" button will load Mayatomr plugin if didn't loaded.
// "Set RenderGlobal" button will set mentalray render global ready for final gathering automatically.
//6, Preview Render: preview render if all settings are works before start baking.
//7, Bake to Texture AO: open up the mr batch bake option window. for now you will set parameter manually. you can follow the "Key Settings", and it is ready to bake.
//Bake Spec map
//almost same with bake AO map. Instead of create a polyPlane, it will create 4 direct lights for baking specular.
//1, Copy af_normAOBake.mel to your script directory.
//2, run maya. execute "source af_normAOBake.mel".