Maya Linear Workflow In Two Steps

david | mentalray,rendering,tutorials | Sunday, March 7th, 2010

If the emails I get are any indication, then I'd say there is a fair amount of confusion around the subject of linear workflow in mentalray for maya. And over the past few years in my search for answers I have contributed my share of half truths and misinformation to the discussion. So, in the next few paragraphs I'm going to state simply and without detailed explanation how to achieve a linear workflow in mentalray for maya by doing two things. Simple!

Step 1. Before you set up any materials, do any texturing or add lights, create a mia_exposure_simple node and connect it to your camera as a mentalray lens shader. In mia_exposure_simple set the following values: Pedestal=0, Gain=1, Knee=1, Compression=0, Gamma=2.2

Step 2. If you map a color value with an 8-bit image then connect either a mip_gamma_gain (preferred) or a gammaCorrect node between the fileTexture and the material. In mip_gamma_gain or gammaCorrect set Gamma=0.455

Thats it. You have set up a linear workflow.

A few extra things to remember:

Lights: Use Decay Rate=quadratic or physically correct lights like the womArchlight shader.

Color Swatches: If they represent a material color, then like 8-bit images, they also need gamma correction=0.455, so either connect a mip_gamma_gain to the swatch or just guess and darken the color manually.

Non-color attributes: Things like diffuse weight, bump values, reflectivity etc are not colors. They do not need any gamma correction.

Floating point images: These are already linear.  gamma=0.455 is NOT required.

Frame Buffer Gamma: Forget you ever heard about it and leave it set to 1.

Final output: Use the renderview window to adjust your lighting and texturing. Then for final renders that require no post processing, batch render and your done. For renders that will be processed further in a compositing application where you will also use a linear workflow, then before batch rendering, disconnect the lens shader.

Summary: For linear workflow make sure input colors are linear by applying a 0.455 gamma correction to 8-bit images and color swatches. Do all preview renders with a lens shader gamma=2.2

Update 18 July 2010: Fredrik Averpil has written an excellent article that covers this subject in more detail. Check it out here.


  1. Yeah,

    That pretty much sums it up!

    Too bad LWF is a such a pain in Maya and not very production friendly - manually correcting 8 bit images and colour swatches is tedious to say the least. Its quite incredible that in a high end app like MAYA (and several versions after this concept was introduced) that a seamlessly integrated LWF pipe does not exist!

    You don't do very much speculating on this blog, but I am curious to know what your take is:
    Why is it so hard for Autodesk to make MAYA LWF friendly? Even a simple gamma correction feature on file nodes would be nice.

    Can anything be done on a MEL level to automate correcting colour swatches and incoming 8 bit images?

    Comment by medooch — March 8, 2010 @ 12:25 am

  2. medooch, it's not the fault of Maya itself. V-Ray accomplishes this extremely well. In fact it is simply a matter of selecting your Gamma and ticking a Linear Workflow ticbox.

    This to me says that the fault lies entierly with the integration of mental ray into Maya which as we all know is very bad. The only way to make sure this gets fixed is for you and anyone you know is to by submitting a feature request and bug settings to Autodesk directly though the Maya help link.

    Autodesk works like this so the more people asking for it the more likely this will end up in Maya 2012 or more likely 2013.

    Comment by Kiernan — March 8, 2010 @ 9:42 am

  3. medooch, speculation is not really my thing. I attribute the messy mentalray integration to a lack of priority and misguided attempt to maintain full backward compatibility for the sake of old scenes.

    There are some scripts here that you can use to insert gamma nodes, but I've yet to see something that would be considered fully automated.

    Kieman, that "Linear Workflow" box has me confused. The manual states "Note that this option is intended to be used only for quickly converting old scenes which are not set up with proper linear workflow in mind. This option is not a replacement for proper linear workflow."
    I will be spending more time learning vray in the near future, but if you care to elaborate on this it would be great.

    Comment by david — March 8, 2010 @ 3:59 pm

  4. David, very simple, very clear, and very understandable explanation of linear workflow. Well done!

    Comment by smokedogg — March 12, 2010 @ 4:00 pm

  5. Thanks for the kind words smokedogg.

    I've just been reading about the soon to be released maya 2011 and it seems that linear workflow is going to be a whole lot easier. Finally.

    Comment by david — March 12, 2010 @ 9:11 pm

  6. Yeah, well I will just wait to see that happen. I thought that has been mentioned a ton of times saying that Maya will soon implement linear workflow. I really hope so...

    Comment by smokedogg — March 18, 2010 @ 6:04 am

  7. Support for color profiles in Maya 2011 - - Maya 2011 Screenshots + Videos

    Comment by rasto — April 1, 2010 @ 6:03 am

  8. Daivid, I am so confused about this process .. I have a couple of questions regarding your 2-step workflow
    You say that if I want to take the rendersand process them further in compositing, I should disconnect the lens shader. Why is that? isn't it the point fo the lens shader to bring up the lost detail and lighting back to the image?
    Also, you say that for floating point (32bpc) images I am not supposed to add the gamma node of 0.455 to the textures.. Does this mean that if I want to batch render a sequence of floating point images I shouldn't add gamma nodes and I shouldnt add lens shader? I should just work as if this workflow doesnt' exist?
    please enlighten me if you care to!

    Comment by AlexMGD — June 11, 2010 @ 2:11 pm

  9. oh sorry David I didn't realize you meant 32 bit images for textures! now I understand that.
    Im still confused about disconnecting the lense shader when batch rendering

    Comment by AlexMGD — June 11, 2010 @ 2:44 pm

  10. Say you will be compositing in Nuke, then you would render to a float format, like openEXR. To continue your linear workflow you need to remove the gamma from the lens shader so that the rendered images are still linear. The idea is that you only add the gamma=2.2 at the end of all processing, which includes most things you would do in Nuke.

    And to correct your terminology slightly, the lens shader does not return any lost detail since nothing gets lost, it adds a gamma correction curve so that the image looks right on an sRGB monitor. If you render to float, all the details are preserved.

    Comment by david — June 11, 2010 @ 9:44 pm

  11. Hey David.

    I'm curious how you arrived at your final value of "1" for your Gain setting...
    Using 1 gives me a completely blown out (white) sky when using physical_sun_sky.

    thanks man

    Comment by n8skow — July 16, 2010 @ 3:21 am

  12. n8skow, my post is about the basic steps required to get a linear result from your render. To do that you need to set gain=1.

    Your render appears blown out when you use physical_sun_sky because of the huge dynamic range that this illumination system uses. If you render to float exr (recommended) then you can adjust the exposure in post and bring those over-brights back into a viewable range. The idea of using linear workflow is that you keep things linear for you render, and for some of your compositing. At some point, if you are going to output those images in an 8 bit format (tv broadcast for example) then you need to do exposure and tone mapping adjustments.

    There is nothing wrong with making those adjustments in the mia_exposure node if that is how you want to do it, but you need to understand that the images that you get will no longer be linear.

    Comment by david — July 17, 2010 @ 2:58 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