The Native (Builtin) IBL

Inside mental ray there is a Native or Builtin image based lighting scheme called environment lighting mode. This was integrated into mental ray some time ago in version 3.7. So it’s been around for about 4 years or more.

It’s unexposed in OEM packages but using our new UI for rendering, we have exposed it for use in Maya 2013. mentalCore also makes use of the Environment Light. We refer to the feature in the UI by its String Option name: Environment Lighting.

Edit: This is properly exposed in Maya 2015 in the Environment Lighting as “Light Emission”

Keep in mind you should be using the UI provided or at the least add the “light relative scale” string option to correctly light non-BSDF or legacy materials. Otherwise they will blow out. This is also true of the user_ibl_env shader. The MEL script below will add it otherwise. (This is unnecessary in Maya 2015 as it is already added from Autodesk.)

select miDefaultOptions; 
int $idx = `getAttr -size miDefaultOptions.stringOptions`; 
setAttr -type "string" miDefaultOptions.stringOptions[$idx].name "light relative scale"; 
setAttr -type "string" miDefaultOptions.stringOptions[$idx].value "0.318"; 
setAttr -type "string" miDefaultOptions.stringOptions[$idx].type "scalar";

Why do I want to use this?

Simply put: It’s fast and automatic direct lighting of scenes where your primary light source is a high dynamic range image (HDRI).

You have heard of this method in other packages as a Dome Light and in Maya 2013, the user_ibl_env was introduced with similar functionality.

Why would I use this instead of the user_ibl_env?

  • The Environment Light re-bakes data by point sampling an environment attached to your camera. This means it also accepts procedurals unlike the user_ibl_env shader.
  • In the baking process you can re-bake to a lower resolution that automatically blurs the texture detail, meaning typically faster glossiness and less variance
  • The Environment Light combines with BSDF shaders to use Multiple Importance Sampling automatically for quick renders
  • The Environment Light will allow you to continue to use the Maya IBL mechanism that is visible and manipulable from the viewport.
  • It uses a simple “Quality” scheme that is familiar from Unified Sampling and they work together accordingly.

Can’t I just light with Final Gather?

Sure. But Final Gathering (FG) samples in a way that distributes rays somewhat randomly. This means you have a few obvious problems illustrated below:

Rendering the scene with only Final Gathering as lighting

Rendering the scene with only Final Gathering as lighting

  • Splotches. Being an interpolated scheme means you need great accuracy to resolve fine lighting details.
  • Soft shadows and sort-of occlusion-like shadowing. You need a LOT of accuracy to get the shadows looking correct.
  • Complex or high contrast HDRIs need a lot of FG tuning.

An easy way to illustrate this is to look at the indirect diffuse lighting pass.

Indirect Diffuse pass without Builtin IBL

Indirect Diffuse pass without Environment Lighting IBL

Now try the Environment Light alone!

Environment Lighting Only

Environment Lighting Only

MUCH better with pretty much default settings.

Was it longer to render? Yes. It’s a brute force-like technique. But in order to get the same quality from FG would take much MUCH longer to render. So in that comparison, Environment Light is actually much faster.

What does FG + Environment Light look like?

Final Gathering with the Builtin IBL on

Final Gathering with the Environment Light on

In this situation I was able to capture direct and indirect lighting. But now, indirect lighting is only captured for object to object light reflection. Take a look at the indirect diffuse pass now (it’s very hard to see in this case, open in a new window):

Indirect diffuse lighting with Builtin IBL on

Indirect diffuse lighting with Builtin IBL on

This means you can greatly reduce your FG “accuracy” setting. In some cases as low as 8 or 16 rays. Keep in mind you might still need an FG filter setting of 1 if highlights on nearby objects are especially hot and generate speckles like the first indirect diffuse picture.

Another important thing when using the mia_material: by default it does not generate a specular (direct reflection) from a visible area light. This means your specular pass may be empty for the mia_material because it is using indirect reflection (reflection rays) to sample the environment. Other shaders that directly sample the Environment Light (like the car paint shader) may show noise or grain because it’s less efficient. To reduce this grain you have to increase the “Quality” of the Environment Light (or more Unified Sampling Quality at less efficiency)

Direct Reflection (specualr) is not generated for visible area lights like the Builtin IBL

Direct Reflection (specular) is not generated for visible area lights like the Builtin IBL

How can I set this up?

You can use the regular Maya procedure for adding an HDRI or a Texture to light the scene including the flags. You can also attach any environment to the camera such as an environment shader, environment switch or Sun & Sky.

Relevant controls built into Maya

Relevant controls built into Maya

What are the controls?

First: I want you to realize this is NOT the Maya IBL “emit light” option.

Do not use "Emit Light"

Do not use “Emit Light”

Here are the important exposed controls: (please excuse their existence in the Indirect Lighting Tab. It is a form of direct lighting as illustrated above.)

Environment Lighting Controls

Environment Lighting Controls

  • On: This means “Automatic” mode. Until the correct Progressive API is used in Maya, there is little point in using Approximate lighting mode. (Approximate generates probe rays and then fills in ambient lighting from the HDR for fast but inaccurate lighting. The other modes sample the light as a light source.)
  • Quality: Scalar slider for quality/grain control. Many scenes with sufficient texturing/complexity can get away with as little as 0.3. Increasing this value decreases grain/noise at the cost of speed, more shadow rays are traced. (Too much noise is insufficient Quality)
  • Scale: Multiplier for the light. Used to control tint/shade and brightness (value) The visible environment is not changed, only the light contribution. Environments are typically assumed to be comped later.
  • Shadow: Optimization, solid shadows are faster but treats all objects as opaque. Off is no shadows cast.


  • Cache: on/off, this creates an acceleration structure for faster lookup on complex lighting. This means the lighting lookup is done through a non-texture mechanism. Reflections may show artifacts at insufficient baking resolution (described below) but should light faster. Off = baked to texture with the usual implications/mechanisms for texture lookups.
  • Resolution: The lower the resolution, the faster the baking, less memory usage, and quicker rendering at the cost of details in reflection and lighting. (Works with iray as well) Below is an example where the resolution is so low the shadows are muddy and the lighting is very dim because the baking process missed some of the light sources. Below that is a correct version with higher resolution.
Rendered with low resolution samples (6 minutes a frame)

Rendered with low resolution samples creating muddy shadows and dark lighting (6 minutes)

Low resolution using Cache "on" (3.5 minutes)

Low resolution using Cache “on” (3.5 minutes)

More resolution to the lighting cache (4 minutes)

More resolution to the lighting cache (4 minutes)

Rendered with higher resolution to capture more lighting and details like multiple shadows

Rendered with higher resolution to capture more lighting and details like multiple shadows (5 minutes)

Resolution involving Cache “On”. Notice how the same resolution for the cache “on” mode did a better job by default for the lighting and shadows.

  • Shader Samples: When baking the IBL, this will take more samples before baking to avoid missing details or little hotspots. Useful with complex HDRI or small resolution settings like the above examples(Works with iray) This isn’t typically important with low contrast or low detail maps/procedurals. A ramp for example, will not benefit from more samples. Use this if you find that you are missing some small light sources or shadow details suffer. You can find a happy medium of lower resolution and some extra shader samples typically easily.
Cache "on" same resolution as above but more "shader samples". (Just over 4 minutes)

Cache “on” same resolution as the low settings above but more “shader samples”. Notice it resembles the high resolution version. (Just over 4 minutes)

Things to note:

  • HDRIs with low range or values will not produce crisp or deep shadows. You might want a happy medium range in a tonemapped HDR so you don’t have hot spikes in reflections and poor shadowing.
  • HDRIs with multiple light sources will automatically cast multiple shadows.
Automatic Multiple Shadows (Grace Cathedral EXR gain factor of 2)

Automatic Multiple Shadows (Grace Cathedral EXR gain factor of 2)

  • Don’t forget to use “light relative scale”!! (MEL at the top of the post)
  • Concave objects or interior scenes not lit directly by the Builtin IBL will need the usual higher quality FG and Portal Lights.
  • Set-acquired HDRIs work well for this with some additional bounce lights to “sweeten” the look.
  • The mip_matteshadow shader can be used to capture shadows for compositing onto live action plates.
  • Remember to use HDRI data. JPEGS and other common formats do not have enough range to produce good lighting.
  • Remember to reduce your Final Gather accuracy to speed up renders considerably. You do not need high settings since the Environment Light handles the bulk of the work.

About David

I am a VFX artist that specializes in Lighting and Rendering. I spend a fair amount of my time supplying clients with artistic solutions as well as technology solutions. With a background in fine art and technical animation training, I strive to bridge the divide between the artist and technologist.

Posted on January 18, 2013, in Example, Lighting, maya, Optimization and tagged , , , , , . Bookmark the permalink. 75 Comments.

  1. thanks a lot for that! very intersting!

  2. “Another important thing when using the mia_material: by default it does not generate a specular (direct reflection) from a visible area light. This means your specular pass may be empty for the mia_material because it is using indirect reflection (reflection rays) to sample the environment. Other shaders that directly sample the Environment Light (like the car paint shader) may show noise or grain because it’s less efficient. To reduce this grain you have to increase the “Quality” of the Environment Light (or more Unified Sampling Quality at less efficiency)”

    Is specular actually required these days? And can I actually consider IBL as a area light in terms of reflections?

    Great article, even for max users.. Thank you for your hard work

    • The car paint phenomenon has a specular effect that is built in. The only way to avoid it is to turn the weights to zero.

      But a specular highlight (direct reflection) can still be useful in some circumstances. A careful blending may look better when using different lights where some may be hidden or very small. This is part of multiple importance sampling.

  3. This is great, it clarifies a lot of “foggy” concepts in my brain and answers most of the questions I had in my last post. Thanks again David! I LOVE this technique!

  4. why are the reflections in the pot wavy?
    thank you for your posts:)

    • It’s a poor teapot model I got online from an OBJ collection. You can see the surface itself has them. I kinda like the waviness, gives it texture. Not a result of the rendering. 😉

  5. Chris Mielczarek

    is anything better with satellite rendering while using ibl? (here is my thread from 2011 :d >
    also, what is the correct workflow for extracting depthRemapped pass while using ibl+fg and unified sampling?

    please have a look at this image:
    are those “hotpixels” going to dissapear over time or is there something wrong with the settings?


    • What version of Maya? Those hot pixels look like a filtering problem. Do not use Mitchell, use Gaussian 2.0 2.0 for almost everything.

      Depth Remapped should work exactly the same as it has always worked. The IBL and Unified don’t change that.

      We don’t use Satellite rendering, you can try in the latest service pack of Maya 2013 and that should have the fix. If not, then it should be reported to Autodesk.

  6. Chris Mielczarek

    speckles (2012 sap + service pack) are gone when rendered in maya 2013.5
    does filtering matter at all in progressive and unified?

    depthPass is grainy when using ibl/unified, so i use to override render settings just for that pass. kinda hoped there is faster straightforward approach.

    im going to try satellite rendering and report back…


    • There was a filtering bug in 2012 that affected both beauty buffers as well as data like z-depth (separate bugs but both involved filtering) That’s part of why our UI is designed for 2013 instead. Progressive only uses the Gaussian filter. Gaussian 2 2 is recommended for 99% of rendering.

      • i’m rendering an outdoor scene , wher there’s a key Direct a fill IBL native and a area…
        and inside the beaty pass i’ve the ibl shadows missing…
        so we are not able to reconstruct via passes the original render…
        10nx for your work and help to improve

      • If you are using the mia_material_x_passes, there is a bug with the environment light.

        To solve it, under the Advanced tab select “Output Maya 2009 passes”

  7. With the ordinary “emit light” option -not using the script I mean- I was able to get much more controlled shadows as far as direction and intensity is concerned!

    What I mean is if I turn on emit light on an ordinary light, I still be able to set direction so that shadows are cast in specific area (maybe differnet from hdri !!)

    Although your script is spectacular as far as setup is consernced, could this issue be addressed somehow as well ?

    • The Environment Light is meant to replicate the captured set lighting from an HDRI. The ’emit light’ option uses and older algorithm that is less precise and typically slower than the Builtin IBL. ‘Emit light’ also exposes a lot of controls where you can just use “Quality” for the Builtin IBL. So we would actually recommend this instead.

      Are you talking about the ‘vary focus’ parameter to alter your lighting shadows?

      You can still alter the rotation/location of the IBL node in the perspective windows.

    • Ok I think I know what you mean. The ’emit light’ option nearly always generates a hard shadow. Even if I use an HDRI that shouldn’t generate one I still get a sharp/hard shadow. It’s also very slow and the shading quality is suspect. And the lighting loses a lot of its saturation contained in the HDRI.

      I would use the Environment Light option from the UI (Builtin IBL) so you’re lighting is much more accurate. Give this a try.

  8. I always get very soft shadows with your script.
    By which option may one define its hardness instead ?
    I couldn’t find any “vary focus” option you mentioned in your previous post.

    Could you please be more specific ?

    • The strength of the shadow is based on the dynamic range of the HDRI. I mention this in the post itself. This means the shadows with the builtin IBL are automatically hard or soft based on the measured data. You can see on the chrome teapots that I have a hard shadow there. With the ’emit light’ option I still get hard shadows even when my data (HDRI) should not have that hard shadow. Like a soft light box shouldn’t have a harsh shadow. The “vary focus” is part of the ’emit light’ options.

  9. That’s it!
    You are the best!!

    Last but not least, I edited in your script and acutally copy pasted the code from David Johnson ( which added in the ability to select exposure mode when one selects
    Physical Sun and sky

    I wish that as included/ integrated correctly from you in the next version and HOPEFULLY was added the ability to select the same camera exposure trick, when the user selects image based lighing as well OR maybe a global function of such kind!

    Any luck ?

    • We prefer you not render through a tone mapping lens shader. Instead, view through a LUT. Compositing when rendered through the lens shader is very difficult.

  10. Ι discrovered that using the script, to enable hard shadows as you’ve mentioned, the only way is to enable emit light in ibl!
    Though by doing so, one gets a new light emmision over the scene’s obects!

    What I mean, is that if your script isn’t used, and one tries to recreate the effect using the ordinary area light/ mental ray -> light shape etc, he will not only get hard shadows in the scene but also no extra light emission as the method with the IBL node “Emit Light” option does.

    I tried to disable emit diffusion / specular individually, but still the rendering result wasn’t the same.

    Is there something I am missing here ?
    Any idea, how could that provide similar renderings ?

    • We’re recommending you not use the ’emit light’ option at all or any of those controls as shown above. The Environment Light (builtin IBL) we have in the UI is more accurate lighting from the HDRI. You won’t easily be able to recreate one from the other.

      • I really get the point to this, but still, hard shadows is something really needed in casesand it is quite difficult to demand it from the hdr image everytime.
        There are many cases where the light data in hdr are not sufficient to provide hard shadows. As such by using this method, which is REALLY nice and easy to setup I have to admit, though it is quite limited to soft shadows in most cases.
        The only way as fars as I tested is to enable emit ligh option, but still it provides other isssues like emitting new light in the scene which isn’t really wanted.
        I am afraid, that unless a trick or another workaround is found, the ordinary area light shape way, is a much more accurate option.
        I hope you prove me wrong

      • What I’m trying to say is the area light “emit light” is already incorrect. You’re just used to it. 😉 The environment light is correct. If your shadows are soft, it’s because of insufficient range in your HDRI, not the environment light. If your chosen HDRI isn’t good enough range you can augment with practical area lights. We do that often for a sun scene.

  11. Chris Mielczarek

    I’ve come across another interesting thing: how is HDR (as opposed to procedural mrSky) colour mapped? I’m using this approach to LWF : (basically – colour profile management sRGB > linear sRGB on all texture nodes, gammaCorrection on others and 32bit frame buffer with sRGB preview)…
    therefore when i use mentalRayTexture for loading HDR file its colour corrected (sRGB>linear sRGB). i suppose its wrong and i should disconnect the colourProfile node?

    • Depends on how the HDRI was prepared. Floating point images are typically assumed to be linear. But not always true. I can usually light with an HDRI without adjustment.

      • Chris Mielczarek

        david, you say: “I can usually light with an HDRI without adjustment.”. the difference in light strength between procedural mrSky and usual HDR is huge. when using mia_exposure_photographic i have to crank up “cr2 factor” way up (2k or even 10k) to get decent (close to real life) values in Film Iso, Shutter and F Number.

        Am I doing it correctly?

      • We don’t render through an exposure node or use Sun and Sky. You’ll notice in our colorspace posts we mention viewing through a LUT, we don’t use lens shaders because it doesn’t work well in post.

      • Chris Mielczarek

        got it, no lens shader at all.

  12. Could you please point out a free hdr image that includes sufficient range data of light to test out hard shadows? All hdr images that I tried, are proved not to provide such ranges, hance I get always soft shadows!!

    I have to mention though that with the SAME hdr images, with the old emit light on area light option, i still get NICE hard shadows and dcenet colored images!!

  13. I have a problem about the native ibl ( portal light have the same problem).I use renderpass to output the multipass,then i got the diffuse pass .The shadow area is not match the beauty pass. It is a very hard shadow,and the shadow range is wrong.

  14. Hi David I have a little question is this moment I try to make a scene with GI and FG bake for still objects and for animated object use environment light like brute force GI technique for V-Ray (ok, I prefer MentalRay I’m a big fan hehehe^^)but I don’t find one way to disconnect the still object to the environment light.
    My older technique I did the same but I use bent normal for the animated objs is work for different situation. anyway if have any Idea
    And again I really like this blog it’s a huge help for MR users. Thanks a lot

    • Couple things:

      If you’re using the Environment Light, then your lighting solution is stable. You should not need to separate your static and animated objects. You can typically get away with much less accuracy on the FG as well since the Environment Light is doing the bulk of the work.

      If you find FG still needs some help (you have a lot of surfaces that are very indirectly lit like enclosed spaces and overhangs) then try the fgshooter:

      Using both, you should still be able to render in one phase without separating objects.

      • Hum… I use a lot fgs_shooter but sometimes my animation have basic 2000 or more frames and complete different position and I find the FG sometimes still give me problems but sometimes it’s work good. but still a long process when I need bake many frames. but thanks for the reply.

  15. Thanks David for the great article! So I’m at a facility that is still using Maya 2012, and I’d like o use the newer techniques as of late. I guess the question is is it even possible to do knowing this version of maya has bugs pertaining to mental ray? If so, would it be possible to use the native ibl and unified sampling? Are there things I should watch out for? Thanks again for keeping MR relevant!

    • The UI is meant for Maya 2013 as some changes made in mental ray were released with that version of Maya (like improved Unified Sampling)

      The environment light should be fine.

      Unified Sampling in 3.9.1 suffered from some poor edges in initial release. This was quickly fixed in 3.9.2 but Autodesk never released that version for Maya 2012.

  16. Cheers David!

    So far so good, and yes Im staying away from unified sampling on this version of Maya. Im hoping this could be the default method for now on (2014) with using IBL with unified sampling. Right now I feel like there are so many legacy options that it gets overwhelming messing with functions that might of worked for one method and now does not. I’m sticking with Unified Sampling and Native IBL approach as I get really fast results by default. Only real thing missing would be a real (Linear workflow approach without the gamma curves applied to each and every color slot) I know there are scripts, however would be nice to load the plugin and know it works with that method from the start. Anyways thanks for the useful information!

  17. Bertrand Laroche

    Hi David,

    I am rendering an indoor scene (warehouse) using environment lighting mode … my IBL is quite powerful and the shadows I get are fantastic … my problem is on some material some really hot spot appear on the “specular area ” when animated it fells like the a sort of glimmering effect … I can reduce it if i lower the exposure of the HDR but I lost the nice contrast between shadow / lit area … any idea how to go around it without changing the intensity of the HDR. Any help will be appreciated.B.

    • We typically clamp HDRIs and use an area light as the sun/hottest source.

      Other renders have a clamp in the renderer itself for this effect and we still add an area light (or two: one diffuse and one specular) but I can typically get away with the above workflow in mental ray.

      • Bertrand Laroche

        Thanks David … I gave it a try … it works but I will have to spend more time on the lighting to achieve the same shadows I had before. I used an other method at the end … since the problem was in the reflection I used a mip_rayswitch for the IBL and used my HDRI just for the environment and used a dummy sphere with a clamp HDR for the reflection. Once again thanks for your quick reply.B.

      • Your solution is basically like the 2-light solution. Depending on the HDRI that might be necessary. But we typically go for what “looks good” and not necessarily what is accurate for the situation. So we prefer the control of the light versus what is baked into the HDRI. (Who’s to say the HDRI looks as pleasing as it can be? 🙂

  18. Hi David,

    Thanks for the post. This method looks really nice and renders fast! One question though. Is there anyway to get matteshadow to render the IBL shadows? The older “emit light” function does render shadows on matteshadow. But I’ve had zero luck getting native IBL shadows to show up.

    • It works for me. Just tested it.

      Keep in mind that the Maya IBL ’emit light’ always generated hard shadows even when it is incorrect.

      The Environment Light might have a softer and more accurate shadow based on the energy of the light in your HDRI so it might be harder to see if it’s soft.

      • I agree, the Environment Light looks much much better than “emit light.” I was able to get nice hard shadows by adjusting the HDRI in photoshop. The shadow has a nice range of color information which is missing in ’emit light’.

        For matteshadow to work do I need to somehow connect the Environment Light to the matteshadow background? Or should it work without any connections? Does it catch the environment light shadows on the shadow catch, AO, or indirect light?

        Right now I’m using the IBL as the only light source. The only thing that shows up on matteshadow is AO.

        Sorry for all the questions. If I can get this to work with matteshadow, this’ll be a great lighting solution.

      • Change the shadow color to red instead of black. Allow multiple outputs and pipe result to the out color of a surface shader.

      • Cool thanks. I did more testing and got it to work. I removed rayswitch_environment from matteshadow’s background and replaced it with alpha_color and then it worked perfectly. I was trying to route the environment from the IBL back into the background environment for the matteshadow. I think that created the problem.

        pano rather than mirror ball environments for matteshadow are another topic I guess.

      • The vast majority of HDRI used in film appears to be latlong.

  19. Hi I’m trying this with the 2014 version of your UI script.
    It lights the scene when I turn it on, but the scale slider is not working when I want to increase of decrease the intensity.
    Any ideas how this could happen?

    • It actually does work, the problem is a Maya UI bug. When you adjust it, the value will stick, but if you re-open the dialogue it resets to 1.0

  20. Everything working properly in maya 2014, but i can’t get to render over the network, it just ignores the environment lighting mode… Any ideas ? Thanks

  21. sorry here me again… im in a new office with maya 2014, and i havent mentalcore installed… so if your UI is not working in 2014 how in gods name do you enable the user_env_ibl???? please god help me…. thanks!

  22. Hi,

    I´ve been using this method for a while now. Just with a latlong HDRI using the standard ibl nodes.
    But now I want to project the HDR on a virtually rebuild set. Like in this clip:

    I can´t seem to figure out how to do this.
    Any tips?

    • Scott was using Mari to project the textures. But you can use spherical projection in Maya to do similar but making it match well will be difficult.

      Keep in mind they were taking shots and modeling based on a point cloud of the set data. It’s helpful to take the data and HDRI from the same location.

  23. The MEL script in this post won’t work for Maya 2014 correct? Do you have a way to expose the Builtin IBL features and controls in 2014?

  24. Quick question: I have my value on the scale up to 5,000,000 and it behaves as if it’s set to 1. Do I need to adjust the color gain in the IBL or should it be controlled solely from the Environment Light controls? Thanks in advance!

    • Environment light controls should increase the intensity of the light (not reflection) but there might be a bug there in the UI. Make sure it changes in the string options too.

  1. Pingback: The Layering Library (MILA) UI: BETA SHADERS « elemental ray

  2. Pingback: MILA New Features – May | elemental ray

  3. Pingback: The Layering Library in Action | elemental ray

  4. Pingback: Like a Boss | elemental ray

  5. Pingback: Render Tests, Combined Lighting | elemental ray

  6. Pingback: Maya 2015 – mental ray changes | elemental ray

  7. Pingback: Project 2 progress/research | Uncanny Mudpuddle

  8. Pingback: New GI Prototype Quick Start | elemental ray

  9. Pingback: Maya 2016, new features and integration | elemental ray

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: