Baking Ambient Occlusion Using Mental Ray E-mail
Written by Dzordz   
Saturday, 10 February 2007
Article Index
Baking Ambient Occlusion Using Mental Ray
Page 2

Ambient occlusion can be very useful for adding details to shadows of your images.

But also it can be extremely expensive to calculate for every frame of your animation.


 

Ambient occlusion can be very useful for adding details to shadows of your images.

But also it can be extremely expensive to calculate for every frame of your animation.

If you have scene that is very static (camera flying trough environment), you can render ambient occlusion to texture and assign that texture to ambient attribute of your shaders. That way the scene will render very fast.

Before entering this tutorial I recommend you to read my tutorial for making lava shader, to get basic knowledge about hypershade and texturing in Maya.

 

 

Image

 

 

In our example I modeled simple terrain using poly plane and one bridge going across. I also added one directional light (sunlight).

 

 

Image

 

 

For texturing I used Photoshop. Here’s one very useful tip if you are going to use Photoshop for texturing. Assign lambert to plane (ground plane) and go to hypershade. Select plane and lambert you just assigned to it. Then in hypershade menu go to edit/convert to file texture (Maya software). Set bake shading group lighting. This will bake illumination to texture. Also surface shader is created and assigned to object. Delete that surface shader, and assign lambert to plane. Baked texture is located in sourceimages subfolder of your project.

 

 

Image

 

 

That baked texture should look like this

 

 

Image

 

 

Then I used it in Photoshop, for reference. When done texture for plane looks like this.

 

 

Image

 

 An internet phone company does detailed research into the domain registration of the site before offering its software. This is because in order to set up ip phones, it is important to have wireless internet service. Also, having a backup software is equally important in order to have something to fall back on. There are quite a few wireless internet hotspots so hosting heavy sites is not a problem entirely.

 

Then assign that texture to the shader of ground surface.

 

 

Image

 

 

I also textured bridge. There I used some UV mapping tools such as Cylindrical mapping, and Planar mapping.

 

 

Image

 

 

Sunlight has little overbright (1.5), and uses depth map shadows with 2k resolution and filter size of 2.

 

 

Image

 

 

Now, to start preparation for Ambient Occlusion. First we need to create one UV set for all objects that will use Ambient Occlusion. So all objects in the scene will use single AO texture. To generate that UV’s we will use automatic mapping. Select geometry and go to create UV’s/automatic mapping option box (Maya 8 menus). Set planes to 6, and spacing to 1024. Also enable create new UV set, and set name to BakeSet. This will generate new UV’s in new uv set. By default all textures use default UV set (map1).

 

 

Image

 

 

If you look at UV’s you will get something like this. If you want you can keep uv’s for ground plane, and just copy them from map1 set to BakeSet. Notice that uv’s overlap. This is bad.

 

 

Image

 

 

To fix this select all uv’s and go to layout uv’s set non overlapping. This will arrange all uv’s in 0 to 1 uv space.

 

 

Image

 

 

 

Image

 

 

Notice that those uv’s stand in new UV set called BakeSet. We’ll use that set for AO texture.

 

 

Image

 

 

For baking we’ll use Mental Ray, so make sure that MR is loaded. You can do that in window/settings preferences/plug-in manger. Scroll down to Mayatomr.mll, enable it if disabled.

 

 

Image

 

 

Now if you hold right mouse button on any geometry in scene, in the bottom of the menu you can see baking submenu. In that menu choose assign new bake set / texture. This will create set of parameters for baking that relates to that object.

Name the set AmbOCC, and set mode to Occlusion.

Set rays to 64 or more, I used 256 and baking took hours. Higher this number smaller amount of noise you get, and greater render time.

Set resolution to 1k or 2k. These maps should be very big, since they will be applied to all objects.

Bake to one map means that all objects will use same map.

In the bottom enable override mesh UV assignments, and enter BakeSet for UV set name.

So AO will be rendered to 2k image using BakeSet UV’s.

 

 

Image


 
< Prev   Next >