Sunday, April 15, 2012

How to use Mia material with Maya's ambient light

Mental ray's mia_material is a versatile, physically correct shader which is the right choice for Final Gathering. However, final gathering is not a cheap and easy solution for animation. In many cases,
a traditional "Ambient light" approach for simulating indirect illumination is still a popular solution.
The problem is the mia material doesn't respect Maya's ambient light. They don't interact at all by default.
So, I'm going to show how to make a mia material respect Maya's ambient light.

Here's a simple scene, a plane and the dragon.
A Lamber shader si assign to the floor and a mia material is assign to the dragon.
The only light source in the scene is just a single ambient light.

The below is the render result.

 No wonder all you can see is the floor only which has a Lamber shader assigned to it.Any objects has mia_material will appear completely black since it cannot see the ambient light.
Alright, in order to be able to pick up the illumination from the ambient light and transfer that to the mia_material, we need a help from an additional shader.
For this, I'll create a new Lamber shader and name it "ambient_picker".
Make it fully white and 0% diffuse. ( the image below indicates diffuse of 1.0 but ignore it.)

Now, open the attribute editor of mia_material and turn on Use Ambient Occlusion.
This will activate Ambent Light Color so now you can make a connection between Ambient Picker and
Ambient Light Color. Drag Ambient Picker shader and with middle mouse button and drop it on Ambient Light Color.

Here's the hypershade view.

Render now and you can see the dragon which is illuminated by the ambient light.
Not only just illumination, ambient occlusion is added on top of the ambient light that's coming from the ambient picker shader. This could be a cheap but still very effective alternative solution for indirect illumination.

Click the image to see the changing illumination. I'm simply moving around the ambient light. 


  1. Thanks for the quick and simple example/demonstration. It was exactly what I was looking for!

  2. I searched high and low for this solution and you provided it wonderfully, THANK YOU

  3. I thought Maya was broken and it was such an easy fix in the end. Thanks.

  4. Hi, I just want to clarify: in the text it says set the diffuse on lambert to 0%, but the image shows the diffuse at 1.0. Which one is it? I'm unable to get the AO to render

    1. Jonny, ignore the image. ( I should fix the image )
      Use 0 diffuse.