The Layering shader library (MILA) in mental ray 3.12 provides a flexible, component-based set of shaders designed to work with each other to accommodate most look development needs. It is more optimized for modern rendering usage of unified sampling, and quality control. It is more efficient with light sampling, and built to take advantage of light importance sampling. It also provides a lightmap-less subsurface scattering component.
In this post, we show how to use the Layering (MILA) shaders in the UI for Maya 2015. This is a first step, but the main concepts will be carried through further steps and across DCC applications. We are looking into providing a similar workflow for 3ds max.
Components – base and layers
The first concept is that of a base component with layer components placed over the top of the base. We provide elemental components for layers, and base combination components for the base layer. You may hear us use the term Phenomenon for a pre-combined network of shader nodes. The base components, except for pure Diffuse are these combination components called Phenomena.
A newly created mila_material always starts with a Diffuse base component by default. Here is what you would see in the Attribute Editior (AE) for the mila_material if you wish to select a different base component.
On the left below, we show a head (courtesy of 3D Scan Store, http://www.3dscanstore.com ), using only Diffuse, and on the right, the Diffuse (Scatter) base component.
As mentioned, we have a set of elemental components for layering over the base. These provide for elemental material characteristics such as diffuse, glossy, specular reflection and transmission. We have a diagram below left that we typically show so you can see the light path representation of these elemental components. On the right, we render each of these components isolated on each sphere to correlate with that diagram.
On the left below, we show the Diffuse (Scatter) to compare with the right, where we have layered two glossy reflection components on top of that base.
On the right, we show the elemental components you may select in the UI currently, categorized by Reflection, Transmission, Subsurface Scattering and Emission. All of these can be layered on top of the base or other layers.
To add a new layer on top of the current layers, a user clicks on the +layer tab/button on top of the UI in the AE for the mila_material, before being presented this elemental component selection menu.
There are three different types of layers, for which we need to explain weight.
What is weight?
For a given layer, the weight represents a percentage of the incoming energy. A layer can be weighted simply, or can have some directional dependency. For example, a Fresnel weighted curve derived from an Index of Refraction can be used to multiply by the weight, so that the layer has higher weight at grazing angles.
A Weighted layer is simple, as the weight represents the incoming light energy used.
A Fresnel layer uses an index of refraction input for directional dependency.
A Custom layer uses a Schlick approximation for directional dependency. Those familiar with the mia_material may recognize the controls for weight at facing and grazing angles and a curve exponent.
The mila_material AE UI presents layers in a top-down fashion, so one could imagine how the energy comes in at 100% from the top, while each layer takes away a percentage of that energy. It gives you a notion of the material as if looking at a cross-section. The base on the bottom is always considered as 100% of whatever is leftover, and therefore we don’t expose the weight for the base layer in the UI.
Above, the top layer receives 20% of the incoming light energy. The middle layer receives 25% of the 80% leftover energy from the top layer. One quarter of 80% makes another 20% of the overall incoming energy, and the base receives the leftover energy from the middle layer, which is now 60% of the initial incoming energy.
The UI also provides for mixing components in a given layer. One can think of a mix like a blend of two paints. This diagram depicts three layers, with the middle layer containing a mix of two components. The mix is built as the layer components are placed on top of each other.
In the Maya AE UI for mila_material, when there is a layer on top of the base component, a user can click on the +mix tab/button to mix a component into the top layer. The weight of the mix will take energy away within that layer. There will still be an overall layer weight for the mixed components. In the example below, this is actually a Fresnel layer mixing two different roughness variations of glossy reflection in a 50-50 mix.
The weight may also be considered conceptually like a masking function, for a material placed on top of another material, as can be shown with the following image on top of the head we’ve already shown above. Now he’s ready for paintball.
So what does this mean for look development in terms of how to approach layering for something you want to match?
In our GTC presentation, David Hackett from The Mill used the following example, from a Norfolk Southern commercial (assets used for demonstration here are courtesy of Norfolk Southern Copr., “City of Possiblities”).
Here we see the final layered material rendered with a background plate and reference mirror and gray balls.
To start, we can now think about the look of the original object based on its material properties, rather than which shader node attributes to tweak. We examine a variety of references. This one obviously has bright light hitting it.
How shiny is it? How shiny are the various layers? Is it a blend of shiny characteristics?
Where do other properties like rust or dust show up as potential layers?
Note the rust is not as shiny, and has more noisy color variation.
This translates into various component layers for the mila_material, including masks for weighting. These masks can be generated in Mudbox or Mari using UV tiles.
We think about the individual parts starting with the base paint layer which is primarily diffuse below left. Then, add a glossy reflection layer using the Fresnel layer. The roughness has a texture mapped to it below right.
Now we use a mask to weight a Grime layer. On the left below, we show it more obviously with a red color, and on the right we use the diffuse reflection component we intend.
At this point we have three layers in the UI. A base diffuse with a glossy layer, and then on top of that, the masked diffuse layer for the rust. That is what we see on the left below. For further detail, we add a more subtle dust component and mix it in with the rust. On the right below, we see the resulting mila_material AE UI, noting slight gray color shift for each level down in the shader network heirarchy. Note also that we’ve collapsed the original rust diffuse reflection component displayed underneath the new dust diffuse reflection.
With more subtle additions, we again make the dust component red, in order to spot it, on the left below. Then the final look development image with extra tweaks, we see on the right.
This workflow will continue to be developed, as there are already plans for enabling more complex components, while making the selection of those components easier. For a simple example, we could have created the dust layer first on a separate material; then later, choose that material from a menu of existing mila_materials, as a component to be layered.
The layering shaders provide a glimpse into NVIDIA’s Material Definition Language (MDL), which is designed to provide material sharing across rendering platforms. For better compatiblity with MDL, many of the optimizing shader controls of the past have been moved out of the MILA shaders and into string option controls. This also allows better ability to optimize more automatically in the renderer, and the ability to provide sweeping quality control changes over a large scene full of many materials.
More to come
This post provides a brief glimpse into what the layering shaders provide, and there will be more posts to discuss the global string options available for quality control, the base Phenomena in more detail, and the render passes provided as emulation of Light Path Expressions (LPE), another forward looking technology coupled with MDL.
16 thoughts on “Layering in Maya2015”
[…] You can find other details on the Official mental ray blog with Bart’s first post on MILA. […]
Great first detailed description on the new Milas, I haven’t installed Maya 2015 yet and as mentioned won’t be exposed until the script is posted, I wonder however about the great features of the Mia shader if they are built into the Milas as well….like AO and interpolation ( reflection) features.
Not sure what you are talking about regarding scripts being posted. The above documented functionality is all there. Maybe a misunderstanding of the extra Material Quality controls which will be exposed in a script later. Note that AO detail and interpolation are renderer based optimizations, and therefore have been moved to string options. In fact AO detail, is really a GI (FG) technique trick. As rendering tech progresses, these kind of shader-specific options will disappear. The control at the renderer level is easier-to-use, and makes for easier optmization in the renderer. A win-win situation, once fully adopted.
“We are looking into providing a similar workflow for 3ds max.”
Thank you very much!
[…] while also making the selection of the components easier. Be sure to check out the complete post MILA Layering in Maya 2015 […]
Excellent Guys I have use the mila shaders and I love it! for workflow specially for effect as dispersion on refraction for diamant
easy to setup. This Mila shader give easy way for workflow, I just wondering to have a bit more deep explanation about LPE how to link to make some customs passes I try with ID’s…maybe????
More on LPE, and mila LPE emulation, is definitely planned for an upcoming blog post.
[…] Part 1 can be found here and the Inside mental ray blog post can be found here. […]
Love these shaders! Quick question though I think it’s been partially addressed in the above comments. With MIA materials I often create a custom diffuse pass for each light to tweak in comp. But if I try to render multiple diffuse passes using contribution maps it doesn’t work. I get one pass with all the lights and the others come up black. Am I doing something wrong or is this a pending feature?
You are right. This is a known problem. Hopefully, we’ll have a fix some time soon.
I’m making a rusted iron helmet and I’d like to use a mask technique similar to your green face paint example. Unfortunately, when I try using a custom greyscale, black and white image, plugged into the weight attribute, it defaults to a value of 1 for the weight instead of using the greyscale info to inform the values. It does work when I use a maya’s default checkerboard texture or fractal texture. I’ve tried using pngs and jpgs. Any thoughts?
So procedurally it works for you, but not when you use and image, right? Using maya_file? Are you using the alpha as luminance to ensure your greyscale is being provided as a single weight scaling factor? Ie, weight is not a color input, but rather a float/scalar.
Ah! I always forget the alpha as luminance! Rookie mistake. Thanks:)
That is a very good tip especially to those fresh to the blogosphere.
Brief but very precise information… Many thanks for sharing this one.
A must read article!
[…] Mental Ray Shader doc: http://help.autodesk.com/view/MAYAUL/… MILA Mental Ray Blog Post: https://blog.mentalray.com/2014/04/18/… RGB Texture Mask Workflow […]
The UV’s on the Train are well done, what was the technique used, if it’s anything fancy to begin with ?