Blog Archives

“My render times are high. How do I fix that?”

If you don’t have access to an infinite render farm, chances are you might be concerned about render times.

With a certain amount of flexibility and exposed controls you may be tempted to try lots of different things or even combine techniques seen on the internet. In some cases this can be useful and in others this combination doesn’t work well.

For example:

If you use an inexpensive Final Gather solution you may increase the quality of, or add, Ambient Occlusion to increase details. If you then find that Final Gathering has splotches or hotspots caused by some other effect, your first instinct may be to increase the quality of Final Gather. Well, it may be that now you can reduce or eliminate the Ambient Occlusion. In some cases we forget to do that and suddenly our render takes much longer. This is both the benefit and downfall of flexibility: keeping track of your decisions.

Where’s a good place to see what might be eating your render time?

The Output Window and the Time Diagnostic Buffer with Unified Sampling.

The Maya Output Window

What effects cost you the most time?

Well, that depends on what you are rendering. Hair can be difficult. Or scenes that reach your memory limit. Layering shader on shader can also increase or double some ray counts (this will change with the introduction of the layering library in mental ray 3.11) Even texture input/output (I/O) can make rendering slower. I will try and touch on some of the more common cases and solutions.

Let’s look at some output from a render. How can you find it? Well, you can increase the verbosity of the output in the Maya Rendering Menu > Render > Render Current Frame (options box)

Render Current Frame Options Box

I usually choose “Progress Messages”. The option below that is “Detailed Messages” and gives you more information, but also tells you every time mental ray blinks and isn’t usually necessary. Also, the more messages it prints, the more it might impact render time as a debug process.

So, I have rendered a decently complex scene from a project at 1280 by 720. I have quite a few lights in the scene, most of which are area lights (about 46 of them, most are small). I have wide glossiness and I am using the Native IBL to render the environment lighting.

I haven’t included the image here because we’re going to look at the numbers. (I know, really boring.)
RC 0.9 1072 MB info : rendering statistics
RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : eye rays                 6613564            1.00
RC 0.9 1072 MB info : reflection rays         65049860            9.84
RC 0.9 1072 MB info : refraction rays          3693155            0.56
RC 0.9 1072 MB info : shadow rays            501916475           75.89
RC 0.9 1072 MB info : environment rays        69498575           10.51
RC 0.9 1072 MB info : probe rays              33284793            5.03
RC 0.9 1072 MB info : fg points interpolated  31840843            4.81
RC 0.9 1072 MB info : on average 34.21 finalgather points used per interpolation
RC 0.2 844 MB progr: writing frame buffer mayaColor to image file D:/untitled_project.exr (frame 12)
RC 0.2 844 MB progr: rendering finished
RC 0.2 844 MB info : wallclock 0:31:52.00 for rendering
RC 0.2 844 MB info : current mem usage 844 MB, max mem usage 1091 MB
GAPM 0.2 844 MB info : triangle count (including retessellation) : 5240633
IMG 0.2 844 MB info : total for cached textures and framebuffers:
IMG 0.2 844 MB info :                 4656815552 pixel block accesses
IMG 0.2 844 MB info :                     535270 pages loaded/saved, 0.0114943% image cache failures
IMG 0.2 844 MB info : maximal texture cache size: 2700 pages, 298.781 MBytes
IMG 0.2 844 MB info : uncompressed cached texture I/O: 16650.313 MB
PHEN 0.2 726 MB info : Reflection rays skipped by threshold: 17691563
PHEN 0.2 726 MB info : Refraction rays skipped by threshold: 2272489

What can you gain from this?

In a raytracer, you are shooting quite a few rays around in your scene. These strike other objects and more rays are sent, etc. This can grow geometrically in a scene where you are using some expensive effects.

Eye Rays:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : eye rays                 6613564            1.00

These are the rays shot from the camera used to sample the scene. These strike objects and cause other rays to be cast. This is part of why they are listed first. These may be more or less depending on a couple things:

1. Motion blur will call more of these to smooth blur. Each ray is jittered temporally during the frame (shutter interval) to catch changes in a pixel as objects pass through them spatially (objects crossing the frame in movement.)

2. Depth of Field will call more of these to resolve blur

3. Scenes with high detail or contrast will need more to improve anti-aliasing.

Tuning: Reducing these is only an option if you can live with less quality (more grain or aliasing). Reducing these in Unified Sampling is done through decreasing the Quality parameter or by artificially capping the maximum through Max Samples. You can try using a Render Region on a noisy area of the most complex/blurry frame.

-Gradually lower the Quality until you reach a limit of what you’d accept.

-Introduce small amounts of “Error Cutoff”

-Lastly, alter per-object samples as needed for difficult objects.

Reflection Rays:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : reflection rays         65049860            9.84

These are rays cast into a scene from an object/shader to collect indirect reflection (light from other objects seen as a reflection). When these strike another object they run that object’s shader to get color information.

1. You may have more of these when you increase the shader ‘Samples’ parameter for glossy reflections

2. You may have quite a few if you have a high trace depth set by either the shader or render settings to allow more than one ‘bounce’ of the ray. This is necessary for things like a reflection in a reflection (imagine a hall of mirrors).

Tuning: You can reduce these in a few different ways. You can:

-reduce the samples for glossy rays based on acceptable quality (the appearance of grain) For objects and scenes where this is textured or there is motion blur and/or depth of field, we recommend a brute force approach (Using Unified Sampling) with a setting of ‘1’ sample. You may need more for very wide glossy lobes on perfect surfaces without textures that are very reflective or blurred.

mia_material Glossy Samples

-reduce the trace depth where it makes little or no visual difference (you may not need a reflection of a reflection of a reflection if it is blurry or dim) Or use a falloff distance with either a color or environment attached.

Trace Depth Options: Reflection

Reflection Falloff Distance and Trace Depth overrides

-use the mia_envblur node to send only single samples to measure an environment texture that is pre-blurred. This is supported in the mia_material and the car_paint phenomenon. An example can be seen here on Zap’s blog: More Hidden Gems: mia_envblur

Single Sample from Environment (mia_envblur node as environment)


RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : refraction rays          3693155            0.56

These are rays sent through and bent or change direction (refracted) through objects like glass or windows. Note that this isn’t the same as transparency where a ray passes through an object and is not bent. Transparency is handled differently in a scene but may still be expensive with large amounts of semi-transparent objects. There are no such rays in this scene or they would be listed. Glossy refraction (specular transmission) is an effect like frosted glass and can be one of the most expensive effects. It is not as simple as a more diffuse effect like specular (glossy) reflection.

1. Frosted glass or blurry effects will increase these.

2. A high refraction trace depth may also increase these.


-Reduce the samples on the refraction (similar to the control seen in the mia_material reflection samples) to an acceptable amount of grain.

-Add a small amount of translucency instead

-Reduce the refraction trace depth in the shader or the Render Settings. Or use a falloff distance with either a color or environment attached. A good guide for the global trace depth is how many surfaces you must pass through before stopping. For instance: a correctly modeled (volumetric) empty bottle will have 4 surfaces to strike before passing through the other side.

Shadow Rays:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : shadow rays            501916475           75.89

Shadow rays are rays sent from surfaces back to light sources. These may sample an area light (direct reflection or specular for invisible sources). These can be expensive and are usually the most prolific in a scene. The more lights casting shadows and especially soft shadows, the more you will have. The larger the area light, the more you will have as well if you need to reduce grain. And naturally, the more lights you have casting shadows, the more of these rays you will have.

1. Large area lights may be sampled more to reduce shadow grain or direct reflection noise on shiny objects. This happens when the light is invisible or the shader is selected to use “highlight only” for reflections even if the area light is visible.

2. Slightly softening the shadow and increasing the rays on delta lights (lights without area like point and spot lights) generate more samples

3. The shadow trace depth is high so you can see a  shadow in a reflection or refraction for example

4. High ‘Quality” settings on Native IBL or high samples on the user_ibl shader.

A quick way to read about optimizing area lights can be seen in the Area Lights 101 post.


-Follow the guidelines in the Area Lights 101 post for tuning area lights using both High/Low Samples and a helpful shader like the Physical Light

-Reduce the trace depth as needed. You may not need the reflection or refraction of a shadow in a blurry surface; especially if Final Gather is already darkening it.

-Old trick: use a depth map shadow or preferably a Detail Shadowmap that can be baked and reused on many frames assuming the objects or lights casting those shadows do not move or are not animated. You can do this selectively per light.

Environment Rays:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : environment rays        69498575           10.51

Environment rays are rays that leave the scene and call the environment. These are usually fast. They exist in this scene more often because I am also using the mia_envblur to speed up the environment lookups for glossy reflections as described above in Zap’s blog.


-None typically.

Probe Rays:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : probe rays              33284793            5.03

These rays are usually the result of Ambient Occlusion rays being sent into the scene. (Ambient Occlusion + Colorbleed isn’t the same thing in this case.) These are caused by their inclusion in a material like the mia_material or in a separate occlusion framebuffer pass. In the mia_material with Unified Sampling we usually recommend keeping the sample counts to 4-6 since it is like a lighting effect. If used in a pass there are a few things that affect the quality: these things may be the distance they travel, the distribution of objects in the scene, and of course sample count for the buffer. (Note: The Native IBL set to “approximate” mode will generate probe rays as it is using lighting by the environment through occlusion. Not usually recommended but ok for tests.) If no distance cutoff is used, it increases the raytracing overhead for your scene by striking anything contained.

Ambient Occlusion has become a staple effect for most CG work but the need is less than before. Generally used as a fake for global illumination in the past, the inclusion now that global illumination is faster and more detailed isn’t always necessary unless the global illumination solution is purposefully reduced or interpolated a lot and loses details.

Creating an AO pass by default for compositing can be used to enhance or create details that aren’t there (occlusion where there is direct lighting is not realistic but is an artistic consideration) Using this pass as a multiplication in post is also incorrect mathematically if trying to reproduce a beauty render. Production is starting to move away from using Ambient Occlusion as a pass or effect in modern raytracers. Path tracers like iRay automatically include such an effect in its light transport so adding this effect on top is redundant.


1. Avoid large sample counts in a shader. These rays may be sent when the shader is struck by some other ray like reflection or refraction. High trace depths will call more and more of these as the ray bounces around.

Ambient Occlusion in the mia_material

2. Use a small distance to avoid lots of strikes on other objects that are unnecessary. For example: Buildings to scale 3 city blocks apart do not need to occlude one another.

3. Detailed indirect illumination may decrease the need to have this feature on at all.

Final Gather Points Interpolated:

RC 0.9 1072 MB info : type                      number     per eye ray
RC 0.9 1072 MB info : fg points interpolated  31840843            4.81

Final Gather is a topic in and of itself, so I will hit the highlights here. These are the points that are generated in the prepass and interpolated when they are struck (or near) by an eye ray. Points are generated based on geometric complexity (automatically adaptive) and by altering the “Point Density” parameter in the Render Settings. (These are also altered by the old radius settings that have since been deprecated and should be avoided for easier setup and rendering.)

Final Gather prepass time is greatly influenced by “Accuracy” which are the number of rays sent to measure the scene and “Point Density” used to place points projected by the camera on geometry. During the render phase, “Point Interpolation” can increase render time at higher settings because the renderer is doing more work mathematically.

Since we are talking about the render phase and not the prepass phase I will just mention those solutions here. Final Gather settings and prepass may be covered later.


-Avoid large interpolation values. If your scene has complex lighting, increase the “Accuracy”. If the scene has complex geometry, increase “Point Density”

Final Gather Settings

-Use more direct lighting to stabilize the solution (such as the Native IBL or user_ibl)

-Use the fgshooter shader/script to avoid flickering in animations

Triangle Count:

GAPM 0.2 844 MB info : triangle count (including retessellation) : 5240633

This may sound silly, but most modern raytracers do not have a Scanline option. This is because we have reached a point where complex scenes with lots of triangles are common. Scanline rendering may slow down this process with many triangles. Instead you should turn off Scanline and select “Raytracing” as the renderer. This is the default in Maya 2013. Rasterization also counts as a Scanline algorithm although more modern.

This is often why comparisons with other renderers may show a slower result, users with lots of objects or displacements fail to turn off Scanline.


-Stop using Scanline Algorithm!!

-Do not use overly aggressive displacements

-Use proxies or assemblies: these are pre-translated and more memory efficient since they are on-demand geometry

Texture I/O:

IMG 0.2 844 MB info : total for cached textures and framebuffers:
IMG 0.2 844 MB info :                 4656815552 pixel block accesses
IMG 0.2 844 MB info :                     535270 pages loaded/saved, 0.0114943% image cache failures
IMG 0.2 844 MB info : maximal texture cache size: 2700 pages, 298.781 MBytes

Texture usage can not only increase memory usage, it can slow down a render by quite a lot! Reasons for this can be:

1. Large textures pulled across a network

2. Un-mipmapped or un-cached textures, this will force mental ray to load the entire full-resolution texture from the source even if all of it is not seen.

3. Insufficient memory means a lot of flushing instead of rendering (related to point 2)

4. Poorly filtered textures may also call more eye rays to solve aliasing. This runs the shader and may increase all of the other rays counts.


-The easiest catch-all is read the post on Texture Publishing

-For the image cache failures you will want to keep this as low as possible. Preferably below 0.01% This can be done by altering a few things manually such as:

*The tile size of the cached texture with imf_copy

*The cached memory limit with the registry option to force more efficient handling, either an increase or decrease. This and the option above work together and are scene dependent. Not always worth a lot of tweaking unless your scene is exceptionally texture heavy. I can now render scenes with hundreds of 4k textures with only 8GB of RAM locally.


    • I didn’t cover interpolated reflections or refractions. This is because in animation they are difficult to not artifact. With the usage of Unified Sampling you may not even need those features. Future shading models (BSDF) will also omit these features.
    • I didn’t cover the Ambient Occlusion Cache. While it may be faster to use during a render, tuning it can be difficult and less necessary with the usage of Unified Sampling
    • Try to avoid layering shaders for some effects. A lot can be accomplished through selective layering of textures instead. 3.11 will introduce the layering library that will help remove this effect of added ray counts.
    • I assume usage of Unified Sampling
    • Using ray cutoff values: these can be useful and exist in the mia_materials as a way to tell the shader not to cast a ray if the effect is not important. It’s a little tricky to use, but heavily traced scenes may have some speed-up if this parameter is increased. Do so slowly and test frames, it will erode raytraced effects if too high with little benefit.
    • Use the Time Buffer Diagnostics as seen in the Unified Sampling for the Artist post to identify where your scene is taking longest to render. Then look at those shader settings or possibly change per-object sample settings.

Time per pixel measured in ‘S’ or seconds. Brighter is longer.

  • Dimmer reflections/refractions need fewer samples
  • The decadent “Maya Glow Buffer” is very slow on large resolution rendered frames, even if the effect isn’t used. Turn off “Export Post Effects” in the Render Settings > Options and do the effect in post.
  • Scenes rendered in motion with motion blur do not need to be perfectly smooth when viewed in motion.
  • Do not marry an image. Some tweaks may alter the look. Even client notes alter the look. Go with the best balance of what’s achievable and is possible in the time you have. Otherwise you’ll constantly be unhappy.
  • To resolve artifacts, simply “cranking up the settings” is a horrible idea. Use the progress messages and the time buffer to make faster/smart decisions.
  • Form habits of rendering with correctly prepared textures and default settings. Only tweaking where necessary by recognizing the cause of the artifact, be it FG splotch or aliasing crawl.
  • Begin to ween off of using Ambient Occlusion as a default effect or pass. The original reason to use it (ao multiplied against an ambient pass) no longer exists and is really an artistic consideration now.
  • Always remember you are going for a good image. An improvement on reality so-to-speak. Avoid using mental ray as a physical simulation to render an image. Use iRay or similar for that type of workflow. Flexibility and choice is key to getting what you need quickly for animation and visual effects
  • I did not include Irradiance Particles or Photons. These aren’t used as often (or at all) in VFX or animation work. They are also (like Final Gathering) topics in their own right.
  • If non-of-the-above applies, change your BSP2 to BSP and try again. If your geometry has bad bounding boxes and other problems, ray traversal can be painfully slow. This is a geo problem, remake it if necessary.

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.

The Area Light Attribute Editor

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.

Falloff Type (Quadratic is physically accurate)

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. Maya 2014 has thankfully changed the defaults to those you see here for shadows. See the post on what has changed here: mental ray changes for Maya 2014

Shadows Settings

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:

Global Raytracing Settings

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, 3 is also now the default in Maya 2014).

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.

Typical Area Light Samples

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.

High Samples: 1

High Samples: 4

High Samples: 16

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:

Area Light Size 1

Area Light Size 1

Area Light Size 5

Area Light Size 5

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.

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. 😉

Glossy Test Scene

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.

Reflection Samples from Shader

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.

Samples per pixel (brighter is more)

Below is the time buffer where the longer it takes to render a pixel, the brighter the resulting pixel in the time buffer.

Time per pixel (brighter is longer)

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.

Brute Force Only: 22 minutes at HD 1080


Next we might take a look at lights and how to use them in similar circumstances.

Optimizations: Lighting and Thresholds

National Geographic

We will be discussing different ways to optimize scenes for rendering.

For this one I will visit an old attribute of the Physical Light shader. You can connect the Physical Light Shader in the area light (or many light types) under the mental ray rollout and under the Custom Shaders rollout (here just attached to Light Shader, I am not emitting photons)

Here is the default setup for the Physical Light Shader:

This attribute is called the Threshold. According to the docs it is described:

[threshold] is for optimization: if the illumination is less than threshold, the illumination can be discarded and no shadow rays need to be cast. The default is 0.

This means that anything receiving less than the described threshold of light will neither cast shadow rays or add the light from it.

You might think this is handled by the regular falloff of the light where objects outside its influence will not attempt to run the light shader. This isn’t true. Your renderer is blind to this information and will try the calculation anyway only to return no illumination. (The renderer never knows unless it tries.) So this parameter is a hint that it shouldn’t even try beyond a certain level of ‘darkness’.

How will this help?

In VFX work you may have expansive scenes as opposed to cozy interiors. In many cases the lights are only going to affect objects nearby (this is true of other scenes than just VFX but means most in these scenarios). If I have 20 practical lights in my scene then my light loop will try to run the list and figure out their contribution. In a case where the lights are expensive (like an area light) this can mean large amounts of rays are traced for lights that are too far away to make a visual difference.

In the below example I have magnified the result so you can see how it helps cut back on expense.

A close up of this simple scene and a large area light with the physical light attached has a sample limit of 128. This image renders with the following statistics:

RC 0.3 info : rendering statistics
RC 0.3 info : type                   number       per eye ray
RC 0.3 info : eye rays               946945              1.00
RC 0.3 info : shadow rays         105251572            111.15
RC 0.3 info : probe rays            3479348              3.67
RC 0.3 info : fg points interpolated 946945              1.00
RC 0.3  info : wallclock  0:01:12.35 for rendering

You can see here that I am casting 111.15 shadow rays (samples for the area light) on average for each eye ray.

So let’s zoom way out where the light won’t be able to illuminate the scene.

Now look at the statistics:

RC 0.4 info : rendering statistics
RC 0.4 info : type                   number       per eye ray
RC 0.4 info : eye rays               474331              1.00
RC 0.4 info : shadow rays          54898447            115.74
RC 0.4 info : probe rays             298992              0.63
RC 0.4 info : fg points interpolated 474331              1.00
RC 0.3  info : wallclock  0:00:29.78 for rendering

Ouch, still a lot of rays per eye ray even though there’s nothing out there. Just a long expanse of flat dark plane.

The renderer knows the area light is out there somewhere. . .and it’s trying to sample it.

So now let’s look at the parameter. Generally speaking a good binary search is good for testing settings. Get the frame where you want it and jump halfway to say 0.5 The next test can be 0.25

If you need to go up, go to 0.375; if down go to .125, etc. Each time taking a halfway point to get it where you want visually.

So let’s say I am eventually going to zoom into the closeup with the cubes. So that is my measure of what I want it to look like at its best. (Assuming I don’t animate the parameter.) So from the original setting of 0.000 let’s try 0.5 first and see what makes the most sense.

0.5 Threshold

0.25 Threshold

0.125 Threshold


It looks like a threshold of .125 looks pretty identical to the first image. The stats for threshold 0.125 are:

RC 0.3 info : rendering statistics
RC 0.3 info : type                   number       per eye ray  original
RC 0.3 info : eye rays               946837              1.00      1.00
RC 0.3 info : shadow rays         105195167            111.10    111.15
RC 0.3 info : probe rays            3478268              3.67      3.67
RC 0.3 info : fg points interpolated 946837              1.00      1.00
RC 0.3  info : wallclock  0:01:06.41 for rendering

Ok, there’s not a huge difference there, but I didn’t expect one because the images are the same. So now let’s zoom out again.

RC 0.3 info : rendering statistics
RC 0.3 info : type                   number       per eye ray  original (zoomed out)
RC 0.3 info : eye rays               514853              1.00      1.00
RC 0.3 info : shadow rays          11272699             21.89    115.74
RC 0.3 info : probe rays             312064              0.61      0.63
RC 0.3 info : fg points interpolated 514853              1.00      1.00
RC 0.3  info : wallclock  0:00:13.38 for rendering

We’ve gone from over 100 shadows rays to just 22 per eye ray. And the render time was cut in half!

Even though this is a trivial scene, you can see that multiple lights spread out across the scene will introduce overhead for areas they don’t even illuminate. For example, this image below if rendered would be very expensive. But lights down the bridge don’t contribute to the foreground and vice versa.

So spending a few minutes using this setting along with Brute Force-like Sampling and Progressive Rendering can help you quickly find a setting you can live with and render much faster than before.