Layer all your Love on Me, MyMentalRay, Material Libraries and.... Stuff


First, before I start todays post, I advise everyone to run over to the freshly updated mymentalray.com which has a brand new fresh coat of paint, an updated material library, dynamic content, and a lot of other spiffy stuff.

Take note especially at the start of the mental ray material library over there. It's not the only effort of it's kind. My pal Jeff Patton is involved with a second very similar effort known as mrmaterials.com.

Simple Layering

I keep getting questions about layring (probably sparked by the recent writings about Iron Man) where you want to use something like Arch&Design (mia_material) to give both a broad specular glossy highlight, and a 2nd layer of a much more shiny "clearcoat" style material.

Well, nothing is stopping you from doing exactly that. I made this Iron Man material (apologies in advance to Ben Snow, and to all you guys for my lack of modelling sKiLz :) )

This isn't high art, but is there to demonstrate the concept. In most applications like Maya and XSI, you can easily blend materials using various blending nodes. But I did this in 3ds Max, and it's a little bit more difficult in a sense. I used the 3ds Max Blend material for this.

The trick is to understand that the 3ds Max Blend doesn't just *add* two materials (that's what the Shellac does), but it interpolates between them. This is generally better, because you do not break any energy conservation laws! (Also it works with photons that way!). Shellac, while nice, makes it really easy to make nonphysical materials.

However, since you are working with Blend you will have to take this into account. Here is an example:

From left to right:

  • Left: A completely mirroring Arch&Design material
  • Center: A glossy Arch&Design material in "Metal" mode
  • Right: a Blend material using the above two and a Falloff in Fresnel mode as the blend map.

A couple of things to note about this:

  • The "common mistake" people do is to make one material that is a shiny material with a falloff for the clearcoat, and completely reflective (glossy) material for the "base" material, and then try to blend these two with Shellac.

    This very easily causes nonphysical reasults on edges. Instead doing a Blend between 100% reflective and the "base surface" makes sure to keep the energy in check.

  • Note that for metallic colored objects, their color does affect the color of reflection, but for dielectric objects the reflection is always white.

    You do this by having the "Metal" mode turned on for the base objects (so reflection color is taken from diffuse color) but OFF for the clearcoat (which is a dielectric). This way you get the proper "uncolored" sharp reflections on top of "colored" glossy reflections.

In this particular "Iron Man" material, I also utilized pieces of the car paint shader to get the "flakes" (although the movie version didn't really have any) in the paint. For that I only utilized a single component of car paint (flakes) and had pretty much everything else coming from Arch&Design. For this reason I did use Shellac to layer the car paint with the Arch&Design.

More advanced Layering

This "Blend" technique can be used in multiple layers, witness this (again apologies for my modelling skills :) )

This image originated from a question I got about making "greasy brass", so I made this material (also available on mymentalray.com) which doesn't just blend two things together, but several. Without going too deep into the technique, I am blending between the metal layer, and two different "grease" layers, here with different bump maps.

The trick to keep straight in your head is to make each "layer" look as if it was only made of the given sub-material, and let the blending between the layers handle the weighting (and, unless you "know what you are doing", avoid blendings where they sum up to more than 100%. This is automatic in 3ds Max when using "Blend" but in Maya or XSI - or in 3ds Max when using "Shellac" - it's easy to run amok with the levels)

As always with metal, having something interesting to reflect (i.e. some HDRI environment or similar). But I covered that in an earlier episode (see also here about glossy materials).

...and Other Stuff(tm)

In other news:

  • On popular demand I updated the new skinplus.mi file mentioned in a previous post so it now has a special version that does displacement. See the (updated) post.

  • For those who has missed it, go over to FXGuide.com where there is lots of cool coverage of the vfx business. Also, if you aren't subscribing to CineFex, well, then you should.

Thanks for listening. As always, following me on Twitter is a great idea, especially as SIGGRAPH draws closer. I'll be Tweeting my location regularly while in L.A.



gregk said...

using blend materials with AD materials and raytracing (glossies especially) tends to slow things down a lot.. are there any tricks to speeding things up?

with vray it was always the same thing until they released their own specialized blend mat--are there any plans to do something similar with a mental ray shader?

Sergio Cáceres Velasco said...

hi..... first i want to say that your blog is realy good.....thanks for all the time you take whith the mental ray comunity.... and second i would like to know if is there some way to get directional occlusion in mental ray renders whithout any external shaders or plug-ins....thanks in advance..

Frank said...

What type of blend material do you recommend using to replicate this technique in Maya. I've been using the standard MR mib_color_mix and I'm not sure if I should be using "blend" or "mix". Either way i'm having trouble seeing any results. I was also wondering if you could clarify, "Falloff in Fresnel mode as the blend map". I'm guessing it's Max specific .
BTW, I really enjoy reading your blog and want to thank you for all I have learned from you!

Unknown said...

awesome. thanks.

Filip Orrby said...




I tried some stuff in Maya with MR and made one mia_material Diffuse/Glossy blue base material with added Flakes and on top of that another mia_material thats totally reflective metal. I layered them with JS_MultiLayers, I guess the same thing can be done with mix8, I used a facingratio as a alpha on the metal layer that is ontop to make it only reflective in the edges and I used the blending option Average (I thought that looked better then "Normal")... I'm not sure if thats how Zap's Max blending works so it would be really nice with a comment from Zap where he gives his thoughts on how to blend materials in Maya :)

Frank said...

Maya Clearcoat Examples

I did some tests with multiple different layering methods. I was able to get identical results with blendColors, mib_color_mix, and mix8. However, JS_MultiLayers gave me a slightly different result (slightly more transparent).

I didn't use any masks for the opacity because I figured If my 'clearcoat' shader had a BRDF of .2 to 1 already, It'd be overkill if I also mixed it with a samplerInfo-->ramp fresnel setup.

These results look 'correct' to me, but I still have no idea if they're 'physically correct'. One thing I did notice across the board, was that the clearcoat layer (which has no bump whatsoever), was inheriting the bump from the base layer. Does anyone know how to fix this?

Tenjin said...

Funkar fint som snus! Bra tips där.

As the others mentioned, how can we speed things up with this blending technique?

Anonymous said...

hi mate, this is the canadin pharmacy you asked me about: the link

Scott said...

For anyone who is rendering on a company farm, they would know it sux getting approval to put an outside shader on the farm.

So I have found a little trick that seems to work. You can take two mia_shaders and add them with an average node. One would just be a clearcoat and since the mia handles specularity by actually reflecting stuff, you can just plug the clearcoat's refl_result into the add (since the reflection defines the bump as well, you've taken care of that problem too!). Then you can just plug the other mia "result" into add as well. You'll get clearcoat (with scratches and whatnot) and underneath simulate paint flakes by adding another bump(since the result is the full result of the mia). Then plug the average node into the incandenscence of a lambert. Turn the lambert totally black. Oila, you've just jimmied up a mix_2_layer add node/bump_combiner(sort of).

Vice President of Cube 2 said...


Thanks for all the MR help you've provided. I've always followed your tuts to help learn along the way. I'm having an issue w/ the mia material and misss. I've posted some images showing whats going on and would love if you'd take a look.

cgtalk thread

Thanks for any help you can provide.

Unknown said...

What if you use a blurry MIA for a base, (for car paint I have it set to metallic)

you take that result and plug it into diffuse of another MIA with a sharp reflection. MIA should automatically conserve energy between reflection and diffuse.

Is that correct?

Nathan Reidt said...


that will work, but there is a trick to get it to work. that is actually the method I prefer to use, and is what I initially had set up when I lookdev'd ironman at The Orphanage. (we wrote a proprietary shader later on and I had them add layered reflections for me so I wouldn't have to nest anymore :D )
the trick is you need to make the top shader (the clearcoat) fully self illuminated, otherwise you will only get the blurry reflections in spots that have diffuse illumination. with the MIA shader the only way I could get it to work was to turn on ambient occlusion on the top level and set both light and shadow colors to pure white, and then turn the number of samples all the way down.

if there was simply a self illumination parameter in MIA this wouldn't be necessary *hint* *hint* ;)

Unknown said...

Hi, thanks for your reply, I don't think I would have figured that one out... and our custom shader coding guy is away today :)

How does the AO trick differ from additional light? (although I'm guessing white additional colour will just turn my object white)

Unknown said...
This comment has been removed by the author.
wael said...

i used Maya with MR and made one mia_material_X and i chosed glass physcial..and i'm seeing flakers with refration ! so how can i remove it ?
thanks for reply

mEnTal Roy said...
This comment has been removed by the author.
mEnTal Roy said...
This comment has been removed by the author.
thanida said...

Thank u so much for sharing this blog great job, i like it