7 days of unlimited AE and Premiere Pro templates & videos - for free!* Unlimited asset downloads! Start 7-Day Free Trial
  1. 3D & Motion Graphics
  2. Maya

Baking Ambient Occlusion, Color And Light Maps In Maya Using Mentalray

Scroll to top
Read Time: 5 mins

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.

Step 1

This is the model which I'm going to be using for baking the "Ambient Occlusion" map.

Step 1 ImageStep 1 ImageStep 1 Image

Step 2

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.

Step 3

Now go to Window>Rendering Editors>Hypershade and assign a new lambert material to the surface, and then rename it.

Step 4

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.

Step 5

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.

Step 6

Now go to the Rendering module of Maya (shown below.)
And from the "Lighting/Shading" menu, select the "Batch Bake (metal ray)" options.

Step 7

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.

Step 8

This is what you’ll get, just make sure you’ve smoothed the mesh before you hit "Convert and Close" in step 7.

Step 9

In the rendered map you'll notice a thick dark line along all the seams.

Step 10

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".

Step 11

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.

Step 12

And this is the resulting Ambient Occlusion map you’ll get.

Step 13

Now I'm going to show you how to generate a "Light and Color" map, using the small interior scene shown below.

Step 14

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.

Step 15

Now check the Uvlayout from the "UV Texture Editor" window.

Step 16

Do the same for the rest of the objects, including the room. Then select all the objects and "Combine" them.

Step 17

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.

Step 18

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.

Step 19

Now open up "Hypershade", and create a New "Lambert" shader. Assign it to every object in the scene.

Step 20

Now "Double Click" on the "Lambert" Material you just created, and then Click on the Channel Button next to the color input.

Step 21

And from the window that opens, click on the "File" node.

Step 22

Now specify the location of the color map we created in Step 18.

Step 23

And now we assign" the material to the objects in our scene using "Assign Material To Selection".

Step 24

This is what you should get after Assigning the Color Map to the objects.

Step 25

Now create a very basic Light setup as shown in the image below, or you can set one up according to your particular requirements.

Step 26

Now select the entire model and "Shift+Right Click", go to Baking > Assign New Bake Set > Texture Bake Set.

Step 27

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.

Step 28

Now from the Rendering module, "Lighting/Shading" menu select the "Batch Bake (mental ray)" option.

Step 29

Change the options highlighted below, and hit "Convert and Close".

Step 30

Open the "Script Editor" and from here you can see where the baked light and color map is saved.

Step 31

This concludes the tutorial. Below you can see the final result of our "Color and Light" map.

Related Tutorials:

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new 3D & Motion Graphics tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.