MILA tip and trick – Dispersion *updated with Phenomenon*

One of the features artists have asked for is the ability to do dispersion inside mental ray without needing a custom shader.

The Material Definition Language contains such an effect but before this is available in mental ray, you can use MILA to create a reasonable approximation.

Unexposed in the main UI is an option for “weight tint” that is a luminance you can control inside a mila_mix or mila_layer node to get the effect. Slightly offsetting the ior of the transmission nodes is what controls the spread of the dispersion effect.

I will update this post again when I have a useful phenomenon to provide to make this simpler, but in the meantime you might come up with your own experiments. Updated below.

MILA Dispersion Phenomenon (3 Bands)

MILA Dispersion Phenomenon (6 color)

MILA Dispersion Phenomenon (6 bands)

You can find the three band (color) phenomenon here. (Copy and paste if your browser doesn’t download the file. Place in your “include” folder for mental ray shaders)

The phenomenon exposes the following controls for the user as a transmission-only component. You can layer this with other components manually by connecting it through the hypershade. The incarnation of MILA in Maya right now isn’t setup to use custom phenomenon flexibly just yet. By altering the phenomenon you can include other controls. For example you can add a tint control instead of having only colorless transmission. Or for nicer looking dispersion you can create six bands instead of the three in this version (Think ROYGBIV).

You can see the power here of Phenomenon and MILA. You can create and store constructs and expose the controls you want for yourself or others. Using the conventions outlined in the MILA documents you can continue to build complex materials with all the benefits of importance sampling and light sharing.

MILA Dispersion Phenomenon, simple 3 band transmission

MILA Dispersion Phenomenon, simple 3 band transmission

Happy exploring!

MILA Dispersion using Specular Transmission

MILA Dispersion using Specular Transmission

*hint: if you find the result is a little “green” (assuming you have connected this as RGB) then you can reduce the ray cutoff to solve it. It’s not always necessary and is based on the model. The link to the string options for MILA are HERE. Eventually such controls will be exposed in the UI natively.

MILA Material - mixed specular transmission

MILA Material – mixed specular transmission

MILA Mix node for simple transmissive dispersion

MILA Mix node for simple transmissive dispersion


About David

I am a VFX artist that specializes in Lighting and Rendering. I spend a fair amount of my time supplying clients with artistic solutions as well as technology solutions. With a background in fine art and technical animation training, I strive to bridge the divide between the artist and technologist.

Posted on May 9, 2014, in Example, shaders and tagged , , . Bookmark the permalink. 29 Comments.

  1. this is excellent, very important. thanks:)

  2. So easy. Thanks.

  3. Me again! 🙂
    Just wandering if you could maybe showcase how to, and how would one benefit from creating phenomenons (phenomena?!) for mental ray.

    • Or, more plainly – I should perhaps ask if you’ve ever, or are you now using them and find any advantages?!

      • There are lots of advantages including the ability to share software agnostic mental ray creations.

      • I’ve updated with a phenomenon for you. You can de-construct it. It’s pretty simple and you can use this as a template for others. You can also find more phenomenon in the include folder of the mental ray installation for Maya 2015

    • This was a planned post but requires some work because there are a lot of underlying things to understand. Hopefully in the near future. MILA works best through phenomenon you can source easily for frequently used looks. This is a reason the base contains multiple default phenomenon. You can look at them in the installation.

  4. David, can you mix the MILA shaders with a SSS shader on one object ? Mask out parts of an object that you want only SSS to be applied.

  5. thank you David its very useful

  6. Re-arranging the layers in the MILA within Maya is beautifully intelligent, makes it more of a Joy to use, now that I’m phasing out Lambert / Phong shaders out of my Mental Ray material workflow !

  7. I’m guilty of using Lambert and Phong up until the past 2.5 years. 😦

  8. hey david, thank you for this amazing stuff. i have just 2 questions: how do i add the mila_layer_dispersion to the mila material? and why do you have 2 times the same 3 specular transmission layers? i’m totally confused about your screens 😀 thanks

    • You can add it to an empty layer using the hypershade or node editor. The main AE UI doesn’t allow for manual or custom nodes yet.

      Using the main UI to get the three bands I need to create 3 transmission nodes and shift their ior slightly from one another. This shifting of ior is what spreads out the bands to create the dispersion effect. Same with the phenomenon. By changing their ior from one another you can control how wide the effect is.

  9. Is there a way to get transparent shadows with the MILA shaders?
    And also caustics. Have tried quite a few different combinations but am getting no joy with transparent shadows or caustic effects.

    • Both of those work. Are you manually making a shader for some reason? Make sure the shadow shader slot is correctly connected in the shader group node and that shadows are set to segment mode.

  10. Hi David, Great Article. I’m trying to use the phenomenon and I made a couple of empty layers to add it to. However there are some empty layers left and I don’t see anyway to remove them. I’m getting python error that: # Error: TypeError: ‘NoneType’ object is not iterable.
    I assume it is raised because of the empty layers. Do you know how to remove the empty layers?

    • You might try removing them manually by graphing in the hypershade but be aware that is a possible problem area. You can also forego the phenomenon and do it manually as shown above that. Eventually MILA workflow will extend to cover custom assets and creation. Beware not to replace the base for now, that’s where most problems happen (it expects a base) If you accidentally removed a base then that might be the issue.

  11. Ok, the empty layers actually don’t show up in the hypershade since they don’t exist. But I finally saw a small delete button at the bottom of their fields in the Attribute Editor. I must say it is poor design to put the buttons down there but it is a fairly new shader and I bet its interface is gonna change a lot. Thanks for the help though.

  12. Hi David, is there any control for reducing the noise other than bumping up the glossiness? If I render the dispersion with glossy=0 and Render Quality=1 I get pixels that are super saturated green, blue or red mainly at some sharp edges of the model. But if I bump up glossiness, the model looks blurry.
    Also I have noticed that the final result will be different if I use different bases eventhough the bases’ weight is set to 0.
    Thanks a lot!!

  13. Hey David. I’m going crazy trying to find the mila_mix node so I can clamp my shaders. Is it a node I need to create? Thanks!

  14. Thanks, really looked for this effect all over.
    However, I cant get it to work even though I plugged the RGB in the tint weight. Im not seeing any change.

  1. Pingback: Maya Tips 4 | CGNCollect

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: