------------------------------------------------------------
"Baking Ambient Occlusion Maps (WIP)"
------------------------------------------------------------
This tutorial is a request from my good buddy Lowell, this will give you an overview of what I do to set-up my AO maps & applying them onto my textures~ I'll be using my -unfinished- T-34 for this tutorial. This tutorial is still a work in progress, mainly because I havn't textured my tank yet and thus, won't be able to fully show you how I use my AO maps in my textures...

We begin by UV mapping our model. Overlaying UVs on top of each other will cause baking problems, mainly, black blotches. Mirroring may work, though, I've had problems once in a while. I usually just paint out problem areas in Photoshop. Another thing, If you do have mirroring problems, Just bake one side of your geometry, then mirror that geometry over after baking...

Tank geometry. And below, UVs. Some items are overlapped and thus, caused some black blotches as pointed out by the red arrows in the following image.




On a side note, You may have certain large areas of blackness, This is due to how the mesh occludes itself. Mainly, this depends on how your model is layed out.

If an object is covering another, but both have their own unique UV space, It'll bake fine, the big area of black is the 'shadow' of that object... Where as, if you overlay an objects' UVs over each other, you'll get black blotches.... This is kind of confusing and hard to explain properly... Trial & error is the best way to get a better understanding on what's going on I believe... Moving on.

We start by creating a 'Surface shader' node. What this node does is basically output whatever you input. So in this case, we'll be connecting a 'mib_amb_occlusion' to the 'Surface Shader' (default). This'll give us only shadows where an object 'Occludes' itself, or self shadowing. (Also reffered to as a 'contact shadow').





In the image above, I've set the mib_amb_occlusion's samples to '64' Simply put, the higher the number, the better the AO map will be, this also means longer bakes and render times. Make sure you got Mental Ray loaded up & hit render to make sure everything's alright. Raise or lower the samples depending on how crisp you want it. Also, your render may look grainy. This is again due to the amount of samples you've set.

If all looks well, It's time to bake the map out~

 

Here we have the settings I've used for the bake. This window is found under your "Rendering Tab" > Lighting/Shading > Batch Bake (mental ray) > options".

+ Settings. You want the "Bake to:" set to "Texture" and make sure the "Bake shadows" tab is checked. I have the "Camera:" set to "persp" Though unsure what this...
+ Color mode: "Light and color".
+ Normal Direction: Face camera (Not quite sure what this does also...).
+ Prefix: Your file name. Remember to set your project's path before baking.
+ X & Y Resolution: The size of the map you're baking.
+ FiIe Format: Duuuuh.
+ Bits per channel: I use the default of 8bit.
+ Number of samples: Ups the AO sampling, meaning more time baking....
+ Bake to one map: Check.
+ Bake Alpha: Yes. This way I can mask out the black, un-mapped areas easier.
+ Alpha mode: Surface Transparency.
+ Final gather quality: 1, default. Again, higher number = more time baking.
+ Final gather reflect: 0, takes into account reflections.
+ UV range: Normal (0 to 1): Bakes to default UV range...
+ Fill texture seams: I usually put 3. The higher the number, the more the AO will bake past a UV's shell... It will not bake into another UV's shell.

When all's right, select your mesh & shift select your Surface shader and convert~


After some time, you should have your AO map. If you've set your directory right, Maya should of spat out the AO map in / renderData / mentalray / lightmap.


And viola~ An ambient occlusion map. I now take this map & overlay it on my diffuse texture maps. That pretty much wraps up my "Baking Ambient Occlusion Maps (WIP)". This shall be updated further as soon as I finish the textures :D

A bit more information on the Surface shader, You may notice that rendering AO takes quite a bit time, especially if your machine isn't as powerful (Mines epic, though it lacks when it comes to rendering ~. ~). Using the surface shader after baking can increase your render times by a ton! Instead of calculating the AO for each render (or animation), you can simply use your baked maps. After a bake, Just take that map & assign it to the shader instead of the mib_amb_occlusion and you're set.

Below are some example tests.








To the top of the page.