Introduced with mental ray 3.10 are new shaders called the user_ibl shaders.
Inside this shader package are two new shaders with different usage scenarios.
- A more simplified usage than the Native IBL (mental ray), the user_ibl is a scene entity used for lighting a scene globally from an environment.
- A shader used to generate light cards or “billboards” to replace otherwise complex geometry and lights in a scene. An example workflow is discussed with Speed Racer and Digital Domain: How to Paint a Digital Car
Part 1: The user_ibl_env
Why would you use this instead of the Native IBL with string options?
The user_ibl_env can be used as a shader in the scene. This means it can be operated and manipulated as a scene shader attached to an area light. It also improves on the importance sampling used by the Native IBL.
The shader uses a connection to a texture. This means it has direct access to all of the detail found in an HDR image. The Native IBL will bake anything (including procedurals) attached as an environment. The user_ibl_env requires a texture to work correctly. If you are using a procedural like a ramp, it should be baked to a 32-bit image format like an HDR or EXR for rendering.
First, let’s look at the shader settings:
Texture: This is where you attach a lat-long formatted HDR or similar high dynamic range texture to be used to light the scene.
Samples: The samples used for lighting. This is the maximum number of samples used for lighting. More complex images or images with wide ranges of values may need more samples. As the importance of the sample becomes less (maybe it’s a few reflections or refractions later) the shader may call fewer than this number.
Color: A scaling factor (RGB) for the colors in the texture. You can use this to manipulate the texture colors from the shader.
Intensity: A standard multiplier for the lighting effect. 2 = twice a s bright. 3 = three times as bright, etc.
Shadow Mode: 0 = opaque 1= solid 2 = transparent The default is transparent shadows (good for images with windows or colored glass). The UI can be changed by using the enum attribute in the .mi file that will give you a dropdown menu instead of an integer field. Change the line in the .mi file regarding the shadows to this:
integer "shadow_mode" default 2, #: enum "no shadow:opaque:transparent"
Rotate: This rotates the lat-long texture for placement. This is measured in degrees.
As Reflection: Was the image being used for lighting shot through a reflection (mirror ball)? This will reverse the image to correctly integrate objects.
How do you use this shader correctly?
There are some steps to correctly use this shader inside Maya. We’ll look at them here step by step.
1. Create an area light in Maya. Its position and size do not matter. Under the mental ray rollout select Use Light Shape.
2. Under the mental ray ->area light rollout, Set the area light to ‘visible’.
3. Set the Type to Custom
4. Under the mental ray -> Custom Shaders attach a user_ibl_env shader to the Light Shader connection
5. To keep things easy, use the Maya Connection Editor to connect the user_ibl_env Samples to the High and Low Samples of the Area Light
A final area light:
If you try to render your scene now, it won’t light as an environment. You still need to attach this shader to the Environment connection on the camera under the mental ray rollout.
Additional Notes on this connection: You can still use ray switches and the mia_envblur shader here and attach the user_ibl_env to them. Keep in mind you may need to use a large resolution setting in the mia_envblur shader to preserve detail in reflections.
Lastly, and very important: you must use the string option for Light Relative Scale for this shader to correctly scale the light for non-BSDF or older (legacy) shaders. This value is 1/pi. This is added in the miDefaultOptions.
Name: light relative scale
Now render with Unified Sampling. The following image was rendered using a backplate and HDR from: HDR Labs.
- In these images I did not use indirect lighting. If you do use it in such a scene, you can decrease the quality by quite a lot. Maybe 16 or 32 rays (or around there) for Final Gather.
- Insufficient samples for the user_ibl will show as grain in the image. In motion, slight grain won’t be noticed, don’t over-tune your scene.
- Avoid using any shader where it forces a specular (direct reflection) calculation from these lights. It will cause noise and increase render time.
- Do not defeat the importance sampling mechanism by making the High and Low Samples of the area light different than the user_ibl shader. Let it do the work for you.