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. 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
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, 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.
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.
Posted on March 19, 2012, in Lighting, maya, Optimization and tagged area light, lighting, mental ray, optimize, samples, shadow. Bookmark the permalink. 31 Comments.
When you’re talking about the Autodesk light shader and a brighter centre, what light shader do you recommend using?
I included it here because I was discussing the native features of the area light. This behavior exists in Maya using the default light setup (shader). Other shaders can override this behavior (current and possible future shaders).
I believe they had a workaround using a different light shader (post #9). This is more difficult for this situation in Max than Maya.
http://forum.mentalimages.com/showthread.php?8686-Center-point-direct-light-emission-from-area-lights
the standard softlight node in xsi has the same behavior, wrong area light shape. but the mr photometric lightnode for example works as expected.
I tried using different light shaders, and the photometric one behaves the same as when you turn on use light shape, without any light shader. This seems to behave as a proper area light.
“..try to avoid this by keeping networks simple or using mib_interpolate to use importance and weight to run a shader layer.”
So using a mixing shader (mib_interpolate/ color_mix etc) is a more efficient way of layering shaders? Could you explain how this works?
Also, I still find it confusing as to which is the most accurate and efficient light configuration in MR for Maya:
Is it preferable to use Maya’s ‘Quadratic Decay’ rate, or to plug in a light shader (portal, photometric, physical light)? Which of these light shaders offers best/accurate performance?
Thanks
mib_interpolate will attempt to avoid running a shader layer if it is not visible. color_mix will still run all the layers even if it isn’t visible because it doesn’t know the difference.
In the thread on the ARC forum where they discuss writing new shaders for Unified, they will run samples for different parts of the shader based on weight. For example: 70% reflective and 30% diffuse for 10 samples will sample the reflective component 7 times and diffuse 3 times. Traditionally it would sample both for all 10 samples and then weight them. You can see how the new technique is smarter (don’t sample everything and then weight, use the weight to decide what to sample.)
This post was 101, basic, in the future I’d like to go over more about the light shaders. Less to recommend one more than another, but more to inform the user so they can just pick one for their situation. Typically speaking, less is more (for performance in most cases) or use something as it was intended to avoid possible overhead or artifacts. Experiment when it’s easy to compare. That’s something we do, we do a lot of comparison when we can and then decide a good default/usage scenario. Then we bring it to the blog. 🙂
This post was to clear up a lot of misconception I see when getting scenes to clean up. This information is all in the documents (so the answers are already there, even if no one reads them) but we try to make it a little more friendly and pertinent to production. 😉
Thanks ! Very useful explanations.
I also find that changing the sampling quality per rgb channel to something similar to the Maya defaults works great for resolving area light noise and noise in general.
So in the miDefaultOptions change contrastR to 0.040, contrastG 0.030 and contrastB 0.060 and that will add a couple more rays but better than increasing the samples on the light. I’m not using unified sampling so can’t experiment with that. On 2011.
Hi David, thanks for covering the area light topic. I wanted to know how you fight against the hard cut of the area light where it starts. Is there a way to change the focus of the light? The physical_light shader does that a bit but you can’t control the focus value. Or do we have to model proper barndoors for the light?
Typically speaking if the light is in the view of the camera it’s in a fixture or enclosure of some kind so the cut off doesn’t affect me there. Or I use appropriate falloff.
As for focusing the light I either use the physical_light as you mentioned or just a spot light. In other cases I may change the light shape from a plane to a sphere and use it as a ‘legitimate’ light source (a bulb for instance like Jiayu’s scene in the 3.10 Unified post). In fact that post used only area lights. I think object area lights are the next step. It’s possible they still exist in mental ray for Maya, the UI is there but buried. Light Importance Sampling has already been mentioned on the Twitter feeds. So that plus an object area light should be much faster and easier to do in the future.
Thanks for your help, I was just wondering if there was a special trick. I start to use more often Mental Core geometry lights for light sources present in the view, I guess that’s the object area lights you’re talking about. They work great 🙂
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.
Hey David.. Been reading thru alot of your posts..very helpful tips you are giving bro!! Having a little trouble understand your example regarding layer shaders.. can give a reason why would you plug in a shader into the additional color of the mia material.. also.. having trouble locating mib interpolate.. is it hidden?
In a lot of cases people may need an extra lobe of reflection (more than one reflection coat) and for the SSS shader most people prefer the mia_material reflection model so they will add it to the Additional Color slot.
In mental ray, look under the Data Conversion shaders for the mib_interpolate. It looks a lot like the mib_colormix.
In 3.11, the Layering library will solve quite a few of these issues easily and much more flexibly.
thx david.. i really appreciate your time bro
Thank you for this post!
I tried to follow your instruction (I’m working with Maya 2013 on Mountain Lion) for the linear workflow, but the gamma node seems to have no effect at all on my area light (with or without the render is the same): can you tell me if this still apply on Maya 2013?
It should still be the same. Autodesk has not changed the colorspace of the color picker in Maya yet. . . .
Are you able to post the render you mention in your reply? 🙂
This tutorial explains that you should only use spot lights or area lights because the light doesn’t touch the surface, I’m curious if this an issue in recent versions of Mental Ray, in other words if I can use point lights, unless it’s really not recommended as mentioned in the tutorial ?
As well in this tutorial, the author shows the flash light creates a very high white spot on the surface, I’m going to assume, this is physically correct in a non-linear workflow because he tone mapped the render, is my assumption correct ?
He’s using an area light or a spotlight because they have a visible direction in the viewport (you know which way the light is pointing) Point lights have no easily seen direction in the viewport. (Is it pointing up or down?) IES files are often from light sources that emit in a single direction. Spots and area lights make it easy to point it correctly. It’s a Maya issue because the point light icon is just a circle. Spin it all you want and you have no idea where it’s pointing unless you render.
The hot spot from the light is linear and physically correct, but physical values are really high. In the real world, even a small light is very high energy. Think about all the lights you can see below you while flying in a plane. They aren’t really lighting up the plane from that distance, but you can see them clearly on the ground. Tonemapping is used to help keep that from looking poor in a render, think about exposure in photography, it’s the same thing. However, I would not apply it in the render like he is doing, I would use a LUT, color management, or do it in post with Nuke or Photoshop.
Thanks David, I appreciate the info and help 🙂
Hi David,
Have you noticed when enabling Mental Ray area light shape in Maya, when you then use “f” – frame camera with the light source selected the camera jumps to some point way out in space.
I am currently replicating this in maya 2015, fresh scene, area light, mental ray area light shape, select & f.
Is this there any know reason or way around this?
Many thanks
James
This may be a Maya bug. The Light Shapes are Maya entities that mental ray already uses.
Pingback: Area Lights 101 Using Area Lights in Maya Mental Ray
Pingback: Aniquito – CG Learning Simplified - Area Lights 101–Autodesk Maya
Pingback: Unified Sampling – Visually for the Artist « elemental ray
Pingback: Unified Sampling in 3.10 (and other changes) « elemental ray
Pingback: Unified Sampling – Visually for the Artist | Pixel
Pingback: “My render times are high? How do I fix that?” « elemental ray
Pingback: The Layering Library (MILA) UI: BETA SHADERS « elemental ray
Pingback: Object Lights – mental ray 3.11 | elemental ray
Pingback: Lighting Process Diary | 3d art and animation