Motion Graphics by Jeremy Clark

Custom Shaders in Mental Ray and Maya

My “Survival Horror” interior project is quickly becoming an exercise in new lighting techniques in Maya.

I have moved on to experiment with utilizing the Mental Ray renderer’s full funtionality within Maya – not just using it for the final renders of my scenes, but now also using Mental Ray specific Materials, Shaders and Over-rides in the attributes of the objects within my scene.

My first foray into increased Mental Ray implimentation was through using Custom Light and Lens shaders on the lights and cameras in my scene.

Mental Ray Light Shaders

It’s possible to replace the the standard Maya light shaders in a scene with Mental Ray ones. Mental Ray light shaders control light in a way that mimics real world lighting more closely than standard Maya lights.

(Left) A light with standard Maya light shader & (Right) A light source with a Mental Ray custom shader applied. Note the difference in dropoff around the light source.

In order to replace a standard light with a mental ray one:

1.) Open the attributes for any Maya light, and under the Mental Ray > Custom Shaders panels, select to input a new node in the “Light Shaders” box.

2.) With the “Create New Render Node” window open , select Mental Ray Lights > Physical Light.

3.) The original light’s attributes are now overridden by the newly created Mental Ray Light Shader. It is still possible to change the type of light (Spot, Point, Area etc) within the original light’s shape node. To make adjustments to the Mental Ray light’s intensity, dropoff etc, locate the “Physical_Light1” node’s attribute tab.

“Colour” controls both the colour and Intensity of the Mental Ray light. (Intensity set by altering the colour’s “Value” setting.) Increasing the “Threshold” value tightenes the area of darkness surrounding the Mental Ray light. If, for a large scene, an intensity of 1000 is till too dark, you can apply a Mib_Color_Cie_D node into the Colour input of your physical light. This will allow you to overdrive the intensity of the Physical light further.

Mental Ray Lens Shaders

Custom Mental Shaders can also be applied to Cameras to add greater contol to how your Maya scene’s virtual camera interprets light information. To apply a custom Lense Shader:

1.) Select your camera, and in it’s attribues tab go Mental Ray > Custom Shaders. Select to create a new render node next to the “Lesnse Shaders’ box.

2.) From the “Create Render Nodes” window, go Mental Ray Lenses > (Select desired MR Lense Shader).

An example of a useful Mental Ray Lense shader is the Mia_Exposure_Simple node. This node attaches to the camera and offers greater control over exposure, gamma, knee and other settings.

Another is the Mental Ray Bokeh Lens Shader. This is an alternative way to created depth of field in your renders.

This illustrates use of Mental Ray "Bokeh" custom lens shader. The Bokeh shader is a great way of achieving Depth of Field in a render.

 

Combining Custom Mental RayShaders

It’s also possible to combine custom shaders within a scene. That is, have a custom shader attached to a lens (Lens Shader), and another attached to a Material’s Surface Shader.

For example, by adding a Mental Ray Phsical Light node to a light source, and shine it through a volume that has a Mental Ray Material and Custom Shader Applied, we can achieve the appearance of light passing through “Participating Media”, or airborne particles.

An example of using both custom Mental Ray Light and Material Shaders to render "Participating Media" with a lightsource

One thing worth noting is that volumetric light effects take allot of time to render. For that reason it’s a good idea to utilize render layers, and separate the volumentric effects onto it’s own layer. This way you can isolate it and gain better control, without having to do lots of time consuming renders.

Another example of Volumetric Lighting through the use of Mental Ray Light and Material shaders. Here I rendered the volumetric effects on their own render layer and composited them back into the final image afterwards.

Advertisements

3 responses

  1. Simply Brilliant! Cheers! 🙂

    March 15, 2012 at 10:58 am

    • Hey, no problem! Thanks for the kind words. Next step: Mental Ray Materials! (There’s always more to learn eh?)

      March 19, 2012 at 7:59 am

      • Definitely! With Maya, you cant stop learning 😉

        March 19, 2012 at 9:37 am

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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