Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.
In this tutorial you'll learn how to bake an Ambient Occlusion map, as well as a Color & Light map inside Maya using Mentalray. Ranjit will first guide you through the process of setting up and rendering the AO map using a character model for demonstration. In the second half of the tutorial, we'll switch over to an interior scene to generate our Light & Color map, also using Mentalray.
This is the model which I'm going to be using for baking the "Ambient Occlusion" map.
Now before we start anything make sure you have a proper UV Layout for your model, and the file you are working with is saved and has a project set properly for it. The image below shows the Uvlayout for the model I'll be using.
Now go to Window>Rendering Editors>Hypershade and assign a new lambert material to the surface, and then rename it.
Since texture baking is done through Mentalray, make sure the Mentalray plugin is loaded in your version of Maya. If it’s not, then go to Window>Settings/Preferences>Plugin manager and check the "Mayatomr.mll" "Loaded" and "Autoload" options.
Now select your Polygon mesh, right click and go to Baking>Assign New Bake Set>Texture Bake Set. From the options rename the bake set, set the color mode to ‘Occlusion’, the Occlusion rays to 256, X and Y resolution to 1024, and the File format to whatever you want. You can of course change these values according to your requirements.
Now go to the Rendering module of Maya (shown below.)
And from the "Lighting/Shading" menu, select the "Batch Bake (metal ray)" options.
From the Batch Bake options, set the options as shown in the image below, and then click on the "Convert and Close" button. By clicking on the "Use bake set override" checkbox option, the "Texture Bake Set Override" options below will be enabled. Here you can override the options that have been set in Step 5. And then click on the "Convert and Close" button.
This is what you’ll get, just make sure you’ve smoothed the mesh before you hit "Convert and Close" in step 7.
In the rendered map you'll notice a thick dark line along all the seams.
So go back to the "Texture Bake Set" options and set the "Fill Texture Seams" value to 10, and from the render globals window, set the quality to "Production".
Generated maps are saved in the renderData/mentalray/lightmap folder of your currently set project. You can also access the location of map from script editor window.
And this is the resulting Ambient Occlusion map you’ll get.
Now I'm going to show you how to generate a "Light and Color" map, using the small interior scene shown below.
Again make sure you have created a proper UV Layout for everything in your scene. If you don't have it, you can use the "Automatic Mapping" option to create the UV layout. To do so, select the object in the scene and then in the polygon module, go to Create UV's>Automatic UV.
Now check the Uvlayout from the "UV Texture Editor" window.
Do the same for the rest of the objects, including the room. Then select all the objects and "Combine" them.
Now open the "UV Texture Editor" window and adjust the UV shells (UV layout) in such a way, that you don’t have any overlapping UV shells.
Take the snapshot of the UVLayout, you can use this to create a texture in Photoshop (or any other image editing program). In my case I made a 2k (2048x2048) map.
Now open up "Hypershade", and create a New "Lambert" shader. Assign it to every object in the scene.
Now "Double Click" on the "Lambert" Material you just created, and then Click on the Channel Button next to the color input.
And from the window that opens, click on the "File" node.
Now specify the location of the color map we created in Step 18.
And now we assign" the material to the objects in our scene using "Assign Material To Selection".
This is what you should get after Assigning the Color Map to the objects.
Now create a very basic Light setup as shown in the image below, or you can set one up according to your particular requirements.
Now select the entire model and "Shift+Right Click", go to Baking > Assign New Bake Set > Texture Bake Set.
From the Options box, change the "Color Mode" to "Light and Color". The "X" and "Y" Resolution to 2048, and then select the desired image format.
Now from the Rendering module, "Lighting/Shading" menu select the "Batch Bake (mental ray)" option.
Change the options highlighted below, and hit "Convert and Close".
Open the "Script Editor" and from here you can see where the baked light and color map is saved.
This concludes the tutorial. Below you can see the final result of our "Color and Light" map.
- Occlusion Shading Opacity Mapped Geometry In Maya
- Quick Tip: Ambient Occlusion In xNormal
- Model, UV, and Texture a Mac-10 Submachine Gun, Day 3- CG Premium Tutorial
- Next-Gen Weapon Creation – Day 3: Unwrapping and Texture Baking
- Creating a Next-Gen Video Game Hot Rod: the Complete Workflow – Day 8