Unified Sampling in 3.10 (and other changes)
Autodesk released their 2013 products this last week. This is the first public release of mental ray 3.10.
You will find this release focuses mostly on bug fixes and enhancements to existing features. The “What’s New” section leaves out the details. You can find the details in the Release Notes section. This is the best place to find fixes and enhancements you may need to know about.
The majority of your performance increase will be seen with Unified Sampling. Things to note for Unified Sampling in 3.10:
- Previous scene’s Quality settings will generate fewer eye rays since they are unnecessary
- Unified Sampling will sample dark areas of an image less
- Unified Sampling produces smoother grain in areas with insufficient Quality
- Framebuffers no longer have artifacts
- Edges and thin objects (like hair) have improved sharpness
- Motion Blur is smoother than before
Many of the previous caveats that may have kept you from using Unified Sampling before have been fixed in Maya now. More improvements are to come. We’ve been told from Autodesk that Hotfixes will be more often and hopefully provide more opportunity to upgrade and replace mental ray since it is now a separate plug-in.
For same-scene renders you can expect complex scenes will render 10-15% faster than before.
Below are some examples. I was kindly given a scene from a current intern at Full Sail University in Orlando, Florida. I cannot experiment or release my current work on the blog so it’s great when I have some nice projects to play with and share!
You can find more of Jiayu’s work on: Jayuliu
Previously for this scene it was taking multiple hours a frame using traditional techniques. I have since updated the sampling on the scene to use Unified Sampling and area lights. For a 720HD render it now takes about an hour for the night time scenes you will see shortly. 10 minutes a frame for the close-up Bedroom scene. There could be some more tweaking done to these using advanced lighting (covered later) but one thing at a time.
Daylight Bedroom:
These scenes are rendered following the guides in the Unified Sampling for Artists Post and the Area Light Post.
In mental ray 3.9 I rendered the above scene with these settings:
- samples min 1
- samples max 500
- samples quality 4.
- error cutoff 0.04
- Gaussian filter 2. 2.
For mental ray 3.10 I used the settings that gave me the nearest result without going overboard:
- samples min 1
- samples max 500
- samples quality 2.5
- error cutoff 0.02
- Gaussian filter 2. 2.
The time saved for a quick render are minimal for a trivial scene:
3.9: 0:12:11.04
3.10: 0:11:12.86
What is of note is how Unified Sampling sees the scene. Below are the Sampling Diagnostic Framebuffers, 3.9 first, 3.10 next. Brighter areas are more samples.
Notice how dark areas sample much less than before (in the painting above the bed and the foot of the bed for example). Below is the visual difference from imf_diff utility, somewhat exaggerated to see better.
Things to notice here are:
- Edges are cleaner than in 3.9.1 (this change was introduced in 3.9.2 and improved in 3.10)
- Area Light grain is less noticeable/clumpy than before (overall sampling pattern is smoother)
JOB 0.2 progr: 100.0% rendered on SIAB.2
RC 0.10 info : rendering statistics
RC 0.10 info : type number per eye ray
RC 0.10 info : eye rays 12597442 1.00
RC 0.10 info : transparent rays 278449 0.02
RC 0.10 info : reflection rays 8661007 0.69
RC 0.10 info : refraction rays 643795 0.05
RC 0.10 info : shadow rays 126100094 10.01
RC 0.10 info : environment rays 146106 0.01
RC 0.10 info : probe rays 34008648 2.70
RC 0.10 info : fg points interpolated 20323641 1.61
RC 0.10 info : on average 86.51 finalgather points used per interpolation
RC 0.10 progr: rendering finished
RC 0.10 info : wallclock 0:12:11.04 for rendering
RC 0.10 info : allocated 353 MB, max resident 413 MB
GAPM 0.10 info : triangle count (including retessellation) : 994312
PHEN 0.10 info : Reflection rays skipped by threshold: 4405980
PHEN 0.10 info : Refraction rays skipped by threshold: 22742
mental ray 3.10
JOB 0.7 398 MB progr: 100.0% rendered on SIAB.7
RC 0.3 398 MB info : rendering statistics
RC 0.3 398 MB info : type number per eye ray
RC 0.3 398 MB info : eye rays 9192639 1.00
RC 0.3 398 MB info : transparent rays 275289 0.03
RC 0.3 398 MB info : reflection rays 6560278 0.71
RC 0.3 398 MB info : refraction rays 553186 0.06
RC 0.3 398 MB info : shadow rays 95549199 10.39
RC 0.3 398 MB info : environment rays 142848 0.02
RC 0.3 398 MB info : probe rays 26833006 2.92
RC 0.3 398 MB info : fg points interpolated 14966173 1.63
RC 0.3 398 MB info : on average 87.47 finalgather points used per interpolation
RC 0.3 352 MB info : wallclock 0:11:12.86 for rendering
RC 0.3 352 MB info : current mem usage 352 MB, max mem usage 411 MB
GAPM 0.3 352 MB info : triangle count (including retessellation) : 994312
PHEN 0.3 352 MB info : Reflection rays skipped by threshold: 3560987
PHEN 0.3 352 MB info : Refraction rays skipped by threshold: 19657
Below is the night image. 12 area lights of different sizes/types. As above I am using the ambient occlusion in the mia_material set to 4 samples. The wall behind the bed has the color bleed option turned on to improve the light from the glowing mushroom night light.
The more important diagnostics can be seen here from 3.9 to 3.10. This scene did not have a change in any settings from 3.9 to 3.10. Exactly the same settings were used.
mental ray 3.9
RC 0.10 info : rendering statistics
RC 0.10 info : type number per eye ray
RC 0.10 info : eye rays 18624542 1.00
....
RC 0.10 info : wallclock 1:34:57.79 for rendering
RC 0.10 info : allocated 1132 MB, max resident 1302 MB
GAPM 0.10 info : triangle count (including retessellation) : 1882529
mental ray 3.10
RC 0.3 764 MB info : rendering statistics
RC 0.3 764 MB info : type number per eye ray
RC 0.3 764 MB info : eye rays 11500119 1.00
....
RC 0.3 679 MB info : wallclock 1:09:09.39 for rendering
RC 0.3 679 MB info : current mem usage 679 MB, max mem usage 850 MB
GAPM 0.3 679 MB info : triangle count (including retessellation) : 1882529
The time saved is 23%! A reduction in 7 million eye rays and nearly 500MB for memory consumption for the same image.
Below is a day scene based on the original scene I was given that can now be rendered in a reasonable amount of time as an animation:
Additional Notes:
- Complex scenes will now render faster than before with no changes and consume less memory.
- Greater complexity sees more benefit.
- You should be able to reduce your Quality for Unified Sampling and still see a better quality image than 3.9 with a shorter render time.
- 3.10 now allows you to mix Final Gathering with Irradiance Particles without interpolation artifacts. It also exposes new ways to combine FG + Importons and/or IP, see the Release Notes for the most information.
- Texture caching is improved and will allow you to render more textures at once with much less memory. The mechanism is also faster. In a future post we will show you how to use this with your Maya installation.
- user_ibl shaders increase how quickly and easily you can light using mapped textures. user_ibl_env allows you to light in the same way as you would with the Native IBL, but has simpler controls and preserves texture details better. Both follow the same guidelines for samples as the Area Light post (4-8 for samples in the area light) and must match the samples on the light shader itself for best results. More samples will be necessary for more complex HDR images.
- Raytracing speed was improved but the emphasis was hair and fur. Unified Sampling and better raytrace speed should increase the speed of scenes with hair and fur without needed rasterization.
- New shaders for hair and fur can be written to make brute force sampling for hair and fur a reality with Final Gathering.
- Framebuffers with Unified Sampling no longer produce artifacts.
Area Lights 101
As computers and algorithms become faster and smarter, area lights can be used more often without much performance penalty.
Why would you use an area light?
In the real world, lights of all types are represented in 3-dimensional space, meaning all lights have area from which they emit light.

A tungsten light bulb has a tiny filament, the tube fluorescent light has a cylinder, and the sun has a disc. This means several things for representing light from the real world inside the computer.
- Light from an area source of appropriate size looks more natural. This is because our brains perceive light strength and size based on reflections of the actual light and the relative softness (spread) of the shadow.
- Recreating real-world lighting should be more natural because you should think in terms of the literal source from the set.
- Scenes in correct scale along with their lights should need less tweaking for the correct “quality” of light.
This tutorial will go over the basics of the mental ray area light settings inside Maya. We’ll look at how to control the quality of the light and settings that work well for Brute Force Unified Sampling rendering seen in several places on the blog, starting here: Unified Sampling: Visually for the Artist
In the legacy days of Maya and mental ray, you had to create a light such as a spotlight and ‘turn it into’ or convert it to an area light. This is no longer necessary and is in fact, deprecated. Don’t let anyone see you doing it! Instead you should create an actual area light and use the mental ray rollout to create an area light.
Some things to notice under the attributes:
1. Color: Obviously the color of the light. Sometimes replaced with a utility such as the mib_blackbody. Keep in mind from previous posts that for correct linear workflow you need a Gamma node here if you are simply going to choose a color from the color picker; correct it using gamma 0.4545 since Maya colors are sRGB. This corrects to linear color workflow: sRGB -> Linear Color: Linear Color Workflows in Maya: Part 1
2. Intensity: This is the strength of the light. Incidentally this does not match anything like watts, etc.
3. Decay Rate: To maintain a physically correct light source this should be set to Quadratic. In doing this you will find that your intensity will have to be increased very much depending on your scene scale. High values are perfectly fine.
Lastly, time to turn “on” the mental ray area light shape. Under the mental ray rollout there is: Area Light -> Use Light Shape. Tick this “on”.
Place this in a scene with the quintessential “sphere on a plane” setup and hit render current frame.
It probably looks atrocious (unless you’re savvy enough to have already set up your scene for Unified Sampling, but even now we can probably improve your result.)
Area lights can introduce grain into your render. Why?
In order to correctly see an area light, the point being shaded needs to sample it. In doing this the shader will send rays back to the area light to try and see as much as possible. These points are spread across the surface of the light to avoid a regular pattern in exchange for noise that is more pleasing. Such a pattern might look very similar to that used for QMC sampling.
You can control this locally for the light.
How do you make sample decisions based on the light and the scene?
First lets do a few different things to the light.
Turn on shadows in the light. I cannot for the life of me understand why the default for Maya lights is still no shadow. It is the year 2012, do not fear shadows.
In this section you will see:
1. Color: Leave it black. In the past you would change this to “fake” an indirect light by giving it some color to mimic. We will assume you are using modern illumination techniques like Final Gather in your scene. Leave it black.
(You see I have collapsed the section for Depth Map Shadow Attributes. They are used less often now that raytracing is relatively less expensive. They will be covered later.)
2. Shadow rays: The Autodesk light shader allows you to resolve grain in a shadow by adding more local samples in different lights from the area light to point, spot, etc. We will use a different control for this, leave it at 1 (Simplify your life by reducing the places you go to for settings.)
3. Ray Depth Limit: This is a bit more tricky and also relies on the global raytracing settings found here:
This setting along with the global setting above restricts how may times a ray may bounce for a reflection or refraction and still generate shadow samples (to make them visible in a reflection or refraction.)
Zap explained these settings here: Maya’s Default Shadow Settings
For simplicity I will restate them here with his images and update them a bit.
In order for a shadow to be seen in a reflection or refraction you must allow the shader to call the shadow after the ray has been reflected or refracted. mental ray will count down the number of times this happens and eventually tell it not to sample for shadows (cast shadow rays) You see below this affects even transparent (colored) shadows and can make your scene look incorrect. Notice the red transparent rectangle and the view behind it.

Shadow Depth: 1

Shadow Depth: 3 (both light AND render settings)
This is a useful optimization because shadow rays can be very expensive to propagate everywhere, especially from area lights. The defaults he mentions (2 for ray depth) are generally visibly acceptable for many scenes. Especially those with blurry reflections where such an effect isn’t noticed at all. However, a depth of 3 may provide you with the best quality if you can afford a little extra time. You will notice that the Final Gather preprocess phase will see the shadows at a depth of 3 (this is a Maya specific bug).
Ok, so how do you make the light and shadows look good?
Area lights have a section under the mental ray controls to provide samples. So let’s look at the settings you maybe have typically seen before Unified Sampling appeared.
I have seen this section abused time to time.
1. High Samples: this is the amount of samples to shoot (draw) towards the light when an eye ray strikes an object. This means primarily visible. You want this to be your most important level of quality.
1a. The larger and closer the area light is, the more samples you may need
1b. Inversely, the smaller and further away it is, the fewer samples you need
2. High Sample Limit: Once this number of combined reflections/refractions is exhausted, the sample can draw fewer samples as defined by the Low Samples setting.
3. Low Samples: this is the amount of samples to draw for a sample taken after the number of reflections/refractions in the High Sample Limit have been exhausted.
4. Visible: Will the area light be visible in the render. In the case of the Portal Light shader it must be on to work correctly. The mia_material will also skip generating a specular highlight for a visible area light by default. This is desired because a spec is a fake for a direct reflection of a light with no area. A light with actual area should genuinely reflect in the object. Doing both doubles the energy incorrectly.
In many cases I see the High Sample Limit set to 16 or 32 without any understanding of what it really does. In this case up to a combination of 16 or 32 reflections/refractions will still draw 32 samples. In a scene with a lot of raytracing effects and depth, that’s murder on render time. Or similarly I see the Low Samples set to something obscene like 64!
These examples were rendered with fixed pixel samples of 4 so only the effect of the area light samples is taken into account.
Notice that changing the Area Light Samples locally reduced grain in not only the shadows, but the highlights and directly lit areas as well. This is also why low Quality or samples for the Native (builtin) IBL can show grain on highlights, etc. It is a similar effect. So for your overall quality you can use one set of controls and then allow Unified Sampling to choose more when necessary. Also keep in mind that multiple overlapping lights on the same area can get away with fewer samples individually as these will add up on the area being sampled and show less grain (assuming the lights aren’t creating a high contrast color difference.)
Using Unified Sampling and changing the size of the area light:
Be careful with scaling an area light when you have a custom shader attached. Some shaders will scale the intensity of the light based on size. In many cases this is correct and desired for the shader, but it is not the default behavior.
What about Unified Sampling and Brute Force?
In testing scenes with large and multiple area lights (10+) as well as special area lights like the Native (builtin) IBL, we found low but not single samples are best.
Generally speaking, a range from 4 to 8 is good. And in fact we have set the samples to (High, High Limit, Low) 4 1 4 or 6 1 4 and variations with good results.
Area Light Samples 4 generates more eye rays from Unified Sampling. This means it’s good for Depth of Field or Motion Blur where more eye rays are already useful for the overall effect and multiplying these is less expensive. Area Light Samples 8 produces fewer eye rays but at the cost of more shadow rays; this might be useful for a still frame. Area Light Samples 6 seems to be a good middle ground when used with Brute Force Unified Sampling. (Best of both worlds)
Quick metric: In an unreleased still (hopefully to be added later) I can render a car interior full frame at 6000 x 3376 with 11 area lights and brute force Unified Sampling in 2.5 hours. These area lights were set to 4 1 1 because the majority of reflections were very blurry/soft for leather and cloth.
Additional Notes:
- Some versions of Maya have a bug in mental ray where the Shadow Limits for area lights always reach 3. So setting a lower limit will have no effect. More recent updates may have introduced a fix for the bug. (I am not on SP1 here.)
- Autodesk uses their own way of making light shaders to mimic legacy lighting. In some situations this is not desirable (in the case pointed out by Jeff Patton; where the center of an area light may be brighter on a surface. Although very subtle, it can be annoying.)
- Further optimize your scene by selectively choosing what object may cast or receive shadows. For example: a car window may not need to generate shadow samples or even receive them to look good.
- Understand that “clear” and “colorless” for shadow objects are not the same concept. Windex is clear, but it’s blue and should cast a blue shadow. Clean water is clear and colorless.
- When you have a lot of art directed imagery with lots of lights, you can reduce indirect illumination quality without image quality loss. This is especially helpful with lots of area lights.
- The Native IBL is a giant area light. When using this on exteriors and other images you can greatly reduce Final Gather settings since it will only return secondary lighting information.
- Area Lights generate multiple samples per eye ray sample. When you naively layer shaders this will increase the number of rays linearly. For example: plugging in a shader to the additional color of a mia_material and then assigning it will double the number of rays shot (For this example 2 shaders are run for the light loop: 2 * total lights * samples = a lot of rays) Try to avoid this by keeping networks simple or using mib_interpolate to use importance and weight to run a shader layer.
- Use further optimizing like the threshold for the physical light: Optimizations: Lighting and Thresholds
- In the render settings you will see an option for Sample Lock underneath Jitter. Sample Lock keeps similar sampling patterns across frames. In the case of Area Lights you may see a static noise pattern slide over your animation frame to frame. Disable this feature to randomize the pattern and generate noise which may be acceptable when seen in motion.
- I didn’t use depth map shadows. Mostly because I am using Unified Sampling and want a fast and accurate setup. If I were using the rasterizer, need lots of soft shadows, and want motion blur, then I would possibly use Detail Shadow Maps. Detail Shadow Maps can generate very slowly at first but motion blurring them is inexpensive. I can also save a detail shadow map for certain parts of a scene (or a whole scene) and reuse them from disk at significant time savings. But for now we’re focused on raytracing and simplicity.
“Transformers: Dark of the Moon” Breakdowns
Here’s another look at some of the breakdowns from ILM for “Transformers: Dark of the Moon”, including the Driller sequence.
You can find more of their amazing work here: ILM Visual FX on YouTube
Hope this keeps you warm while we cook up a few things and hope to have some more to coincide with new software releases.

Unified Sampling Redux
As a simplified look at using Unified Sampling as a more “brute force” method that was outlined here; the below example outlines the differences in time and sampling on a visually trivial scene. This should make some things very easy to understand and quick to read before moving on to lights.
In a glossy scene originally rendered at HD 1080, the first frame was rendered with the following settings using all mia_material_x shaders.
Quality 8
Samples Min 1.0
Samples Max 800
Reflection Bounces 2
Shadow Bounces 2
Resulting Time: 48 minutes
In a second test I added these settings:
Error Cutoff 0.04
Resulting Time: 35 minutes
The images appeared to be identical to the eye. I ran imf_diff to analyze actual pixel differences with this result:
differing pixels: 0.379% (7869 of 2073600)
average difference: 1.265%
maximum difference: 4.632%
Summary: Some pixels differ slightly.
== "glossyA.exr" and "glossyB.exr" are similar
So I am pretty happy with the fact that the time savings of 13 minutes resulted in no observable difference.
Below is an explainer graphic of the glossy rays count set for each sphere.
Below is the Samples Diagnostic framebuffer (tonemapped to work on the internet). You can see that the more “brute force” the reflection rays settings, the harder Unified Sampling had to work.
Below is the time buffer where the longer it takes to render a pixel, the brighter the resulting pixel in the time buffer.
You may also have a better understanding of how Unified will perform consistently across a scene with a single Quality parameter when given a wide range between minimum and maximum samples.(These spheres resemble one another despite having large changes in reflection gloss rays.)
Despite these results you might still notice a little grain on the pure brute force sphere. Add a texture map and you’ll hardly notice but is there a reasonable balance in a more complex scene?
If you need a completely smooth scene where there are few textures and more of a “pure” shader effect, then small increases seem to work well without sacrificing extra time. 2-4 samples works well for this in those special cases. But we find that animation and VFX work do not need this level of detail. This would be for something like print work and large resolutions.
Next we might take a look at lights and how to use them in similar circumstances.























