Setting Up Linear Workflow
Maya, Mental Ray: Lighting
MENTAL RAY 32bit LINEAR WORKFLOW
In this lesson we’ll learn about 32 bit linear workflow in Mental Ray for Maya. I’ll also talk a little bit about viewport 2.0 and the difference between depth map shadows and raytracing.
Depth Map Shadows Vs Raytracing
For starters it’s important for us to know the difference between a raytrace renderer and a depth map shadow renderer.
Viewport 2.0 is a depth map shadow renderer. The Maya Software renderer is mostly a depth map shadow renderer… although it supports raytracing it is not that good at it.
Mental Ray is a raytrace renderer. The “Ray” in Mental “Ray” stands for raytracing. Mental Ray also supports depth map shadows but it is not good at it.
Interestingly Renderman the famous renderer by Pixar is a depth map shadow renderer that has recently been converted so that it supports advanced raytracing that is more physically correct and up to modern standards.
Arnold and VRay are Raytracers and adhere to the physically correct rendering model. These days it is common to render using only a physically correct raytracer.
Simply…
Maya Software and Viewport 2.0 = Depth Map Shadows
Mental Ray, Arnold, Vray = Raytracing
Renderman = both
Viewport 2.0 (a depth map shadow renderer)
Here’s a video on viewport 2.0 settings, notice the use of depth map shadows which are essential a fake and good for fast renders like real time games engines.
Advantages/Disadvantages: Depth Map Shadows Vs Raytracing
Raytracing = More physically accurate but slower, used on most films these days
Depth Map Shadows = A fake but very fast to render, used in games and old movies like Toy Story 1 and 2.
Linear Workflow from 2015 extension onwards (not available for students will be in 2016)
32 bit Linear Workflow in Maya (new videos)
1. Comparing sRGB and Linear Workflow
2. What is 32 bit Linear Workflow?
3. Setting Up 32 Bit Linear Workflow in Maya
4. Correcting Swatch Colours
5. Fixing Bump Maps
6. Viewing and Saving Linear .exr Files
7. Viewing in After Effects
To Come…
– Fixing Physical Sun And Sky
– Fixing Image Planes
– Linear Workflow in Photoshop
– Linear Workflow in Nuke
OLD SECTION
32 bit Linear Workflow in Maya (old videos)
Setting Up a 32bit Linear Lighting Workflow is a headache in Maya. But if we follow the following step by step checklist we can manage to use linear workflow effectively in Maya.
Why use Linear workflow?
The following video although for Cinema 4d is a great explanation of Linear Workflow. Unlike in Cinema 4d in Maya Linear workflow is not on by default! So we have to set it up manually which is what this page is about.
This video gives a great insight into Linear Workflow for 3d. And is worth watching even though we are in Maya, the video is not about software it’s about the principles…
Here’s a good podcast all about linear workflow in compositing…
http://www.fxguide.com/fxpodcasts/Compositing_in_Linear/
And a great PDF by Ingo Clemmens over at Brave Rabbit
http://www.braverabbit.de/pdf/linearWorkflow_eng.pdf
Advantages of Linear workflow:
Much more realistic adding of light which means that lights react much more like they would in the real world. Math is all correct as per the real world meaning much more realistic images.
Downside of Linear Images:
Our monitors are all gamma’d to non linear sRGB, and it’s not realistic. We must convert back to sRGB to view on our monitors. And this is a little confusing and annoying to setup in maya (well worth the trouble). So long as we convert back to sRGB at the end of the grading process, say in After Effects or Nuke, everything will work out just fine and look much better.
8 Bit Images and 32 Bit Images
8 bit images are the default on our computers. Each channel red green and blue is made of 256 value steps.
This is fine as our monitors cannot show more than 8 bit images, however when it comes to grading it causes big problems, because
1. We’ll get banding on gradients
2. We can’t recover area’s that are blown out or under lit.
32 Bit images on the other hand can store a lot of data, way more than 8 bit.
8 bit = 256 per channel
32 bit = 16,777,216 per channel
In a 32 bit image colours can be stored above white and below black. There can also be decimal places in the colours we can see, so as we grade the image we get much more realistic results, avoiding terrible banding problems.
Advantages of 32 Bit Images
Much better quality images that we can grade till our hearts are content. We can recover under lit and blown out areas in our compositing software.
Downside of 32 bit images
Bigger filesizes, annoying setup in Maya (but well worth it!!).
MR LINEAR 32Bit WORKFLOW – 7 Steps
The following is a 7 step hecklist for linear Workflow in Maya.
1. Have Maya Render at 32 Bit Color
1. Change the Renderer to Mental Ray in the Render Globals Window
2. Change rendering to 32 Bit
Render Globals > Quality Tab (Scroll Down)
FrameBuffer Menu
Change to…
Data Type: RGBA (Float) 4 x 32 bit
3. Image type to .exr for full 32 bit images
Render Globals > Common
Image Format: OpenEXR (exr)
EXR’s are the industry standard for 32 bit images. We can render out passes that appear like layers in Photoshop etc.
2. Maya Render View Settings
Now we need maya to preview our images properly. This is a two step process and requires a restart. Save your file first.
These settings only affect the way your images look inside of Maya previews. Rendered images will be fine if viewed in other packages… however you will need to tell the other programs that your images are linear color. See the section at the bottom of this page for viewing images in other packages.
1. Change the way maya deals with images to linear and keep the display profile to sRGB
Render View Window > Display > Color Management
Image Color Profile: Linear sRGB
Display Color Profile: sRGB
This shows our images in maya accounting for our monitor settings.
2. Switch On 32 bit floating point (HDR)
Render View (window) > Display > 32 bit floating point (HDR)
And restart Maya, that will remove any banding in previews in Maya.
3. Procedural Colors/Swatches Linear Workflow
For shaders with no textures, eg a grey lambert the colours are not colour managed!!
1. store the swatch color by changing it slightly and then back
2. Create a Gamma Correct node (type gamma above the “favorites”)
3. Change the color of the gamma to that of the stroed swatch
4. Map the gamma’s “outvalue” into your shaders original “color” (drag and drop)
5. In the gamma node make all the gamma values .4545 for each colour
Or just use the following script*. I will have to update my prefs to include it too.
Gamma Adjust Color Swatches
Once downloaded view the .mel file for install instructions.
*Note the script will only work on certain shaders. Otherwise just build the nodes manually.
What to Gamma Correct?
Now we obviously have to gamma correct the diffuse color of our shader, but how about other swatches? Luckily a guy called Royterr over at CGNetworks made an image with the swatches for mia_materialX and car paint, but we should be able to figure out other shaders such as SSS shaders from this list.
Out of interest there is no need to correct 1 or 0 values for colour say 100% Red or Blue or Green, white or black.
It’s a good idea to try and use Mental Ray Shaders instead of the Maya shaders. Try to use mia material x is usually a good start and comes with a lot of presets. Mental Ray shaders are physically correct which means they’ll react to light in a realistic way. Maya shaders may not react realistically!
4. Adjust Texture Linear Workflow
Our textures files will usually be normal 8 bit images created in Photoshop or Mudbox etc, so we need to tell maya this to correct for the differences in Gamma, between
regular images (sRGB)
and
The Linear way that maya renders (Linear sRGB)
Turning on Color Management with the following settings will ensure our textures are rendered with the proper color correction.*
Render Globals > Common > Enable Color management (on)
Default Input Profile sRGB
Default Output Profile Linear sRGB
Does this Apply to all Texture Images?
In short No. Not all texture images are cool now. In particular bump/displace and normal maps should all be
Color Profile: Linear sRGB
See the next section for more.
This from the Autodesk Help Files….
“Scalar or single channel texture images intended for bump, normal, displacement or other non-color applications should select Linear sRGB as their Color Profile under the File node Attribute Editor.”
Again we can look at this image, anything with a cross on it should have it’s color profile set to…
Color Profile: Linear sRGB
5. Check Bump/Normal/Displace Linear Workflow
Bump, normal and displacement maps (and some other) file types need to be changed to “linear srgb” in the file node for each file texture.
So for each bump/displace/normal texture we need to change their default type to linear srgb.
This is found in the file node of your textures. Change “Use Default Input Profile” to…
Color Profile: Linear sRGB
We need to remember this for all Bump/Normal/Displace file textures!!
This from the Autodesk Help Files….
Scalar or single channel texture images intended for bump, normal, displacement or other non-color applications should select Linear sRGB as their Color Profile under the File node Attribute Editor.)
Again we can look at this image, anything with a cross on it should have it’s color profile set to…
Color Profile: Linear sRGB
6. HDRI Environment Workflow
For Maya default sun and sky, the HDRI range automatically gets gamma corrected as though we are working in 8 bit. We need to change this by finding the “Mia_Exposure” node and correcting the gamma from 2.2 back to 1.
7. Image Planes and Linear Workflow
By default Image Planes are not color corrected for linear workflow.
To Fix
1. Create an Image Plane under the camera attributes as per usual (environment)
2. Instead of mapping the image into the “Image Name” attribute. Change
Type: Image File
to
Type: Texture
Add the image to the “Texture” Attribute.
Now our image will be color managed as per the Render Globals (step 3).*
*Note I have noticed some slight color variation and differences from the original image. Use just for preview purposes.
Digital Tutors MR Linear Workflow
A good video to watch is this one…
http://www.digitaltutors.com/lesson/12534-Linear-color-space-workflow-with-textures-and-physical-sky
CHECK LINEAR IMAGES OUTSIDE MAYA
To check a linear image outside of Maya the easiest program to use is
imf_disp
32 bit images are also supported by almost all major compositing programs including Photoshop, After Effects and Nuke etc. Each program has it’s own way of dealing with 32 bit images and linear color management.
imf_disp
This program comes with Maya and is a Mental Ray Tool to check renders.
1. Load imf_disp (on mac you can open through the spotlight)
2. Open your rendered image by browsing to it. Never save an image from Maya’s Render View “File > Save Image” Do not use this!
Images in the Render View are automatically saved to
images/tmp
So get the images from there, or render with Batch render like you would rendering an animation.
4. Change the gamma
If we are using linear 32 bit workflow our images will come in too dark. Adjust the gamma to 2 in the upper right of the image window. Now we’ll be seeing the image correctly outside of Maya.
5. Render Layers in imf_disp
imf_disp also supports viewing the render layers of an .exr file. To view layers go
Layer > (select the layer you’ll wish to preview)
After Effects Notes
We’ll be wanting to work with Linear workflow. This is very easy to setup in After Effects.
Click the number at the bottom of the project tab. should be something like 8 bpc. We’ll want to change that to 32 bpc, if using .exr images and linear workflow in maya. (see here for the maya linear workflow settings)
We also want to check the box “Blend Colors Using 1.0 Gamma” So we can view our images in normal sRGB color which our monitors are.
Viewing .exr Layers in After Effects
Unlike in Nuke .exrs are not supported well in After Effects.
It’s best to download a free plugin which helps us manage .exrs in After Effects.
The following tutorial show’s how to use exr’s in After Effects. I’ve also noticed that when extracting using proEXR you must also convert each extracted comp to linear color…
Effect > Utility > Color Profile Converter (check “Linearize Input Profile”)
MR LIGHT SETTINGS – BASICS
1. Make our scene is at correct scale, 1 unit = cms
2. Directional Lights are mimicking sun or moonlight, so these lights won’t have any falloff because they are so far away we’ll never notice the drop off.
3. For lights other than sun/moon will have a light falloff, just like in the real world. The physically correct setting in Mental Ray is in the light settings…
Decay Rate to “Quadratic”
These lights will need much bigger numbers as values, up to 5000 or more. These are lumen values I believe, mimicking the real world.
4. Mental Ray is a Raytrace Engine
MR is a Raytracer, depth map shadows don’t work well with MR. Depth map shadows are for Viewport 2.0 or the maya software renderer. Raytracing is much more physically accurate anyway.
Switch all lights to raytrace shadows, no depth maps.
5. Blury Shadows
If we want blurry raytraced shadows on lights, usually spotlights or point lights (sometimes directionals) we change…
Raytrace shadow attributes “Light Radius” to a larger angle
Light Radius = Blur Amount as an Angle Value
Shadow Rays = make the shadow less grainy. Can be values of up to 50 or more.