david | mentalray,rendering,tutorials | Monday, March 30th, 2009

Most of the time its ok to mix maya base shaders with mentalray shaders in the same shader network but sometimes things don't work as you would hope. An example of this is when you layer something like a blinn and a mia_material_x using mib_color_mix. At first glance the render looks correct, but you will find the blinn is missing in the alpha channel. A quick fix is p_color_plus_alpha.

Maya and mentalray handle transparancy and alpha differently. Maya materials output color as 3 components (R,G,B) and they also output transparancy as a color in 3 components. In the render the resulting alpha value is derrived from the transparancy. Mentalray materials, on the other hand, just output R,G,B and A.

If you use a mentalray layering shader like mib_color_mix, and if you look in the connection editor (with Show Hidden enabled) you will see the inputs are for color and alpha, not transparancy. So if you connect a blinn to mib_color_mix you can hook up the color, but there is nowhere to plug the transparancy and there is no blinn outAlpha. And that's the problem.

To illustrate this I have built a simple shader network where I'm layering a red blinn over a yellow mia_material_x using a checker as a mask. In my example I have used my dj_mix_colors phenomenon (which is based on mib_color_mix).

click for larger image (opens in new window)

Here's the resulting image and its alpha channel.

The solution is to plug the blinn into a p_color_plus_alpha node before connecting it to dj_mix_colors. This is a handy material which is part of an extensive suite of shaders created by Pavel Ledin (aka puppet). (Pavel is a genius has been generously sharing his knowlege and his work for many years. Thanks Puppet!)

So now my shader network looks like this.

click for larger image (opens in new window)

And now the alpha channel renders correctly.


  1. As always david nice tutorial, there is also a node called color_compose from ctrl.studio witch do the same thing! you may look here http://forums.cgsociety.org/showthread.php?f=87&t=747345
    but the question I've is why the mib_color_alpha that come with Maya can't output the Alpha?! it's supposed to do the job no?!

    Comment by rachid — March 31, 2009 @ 3:04 am

  2. Thanks rachid. Its nice to see we have more than one option.
    Good question about mib_color_alpha. No answer from me though.

    Comment by david — March 31, 2009 @ 11:21 pm

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck