Image Based Lighting Part 2: Mental Ray IBL Rendering


This page is designed as a supplement to lectures. It is not intended to be a stand alone tutorial.


Image Based Lighting can, at times, be a very efficient and accurate way of lighting and rendering a scene. Many times it is used to match a CG element to the cinematography of a live action scene. This requires that the CG scene is rendered with the exact same type of lighting as the live scene. Success depends on two steps: 1) acquiring the correct images to use and 2) correctly setting up the IBL node in Mental Ray to give the needed effect. This web supplement is in two sections: IBL Acquisition and IBL rendering.

This is Part Two and describes using the IBL node in Mental Ray for Maya. Part One, Image Based Lighting: Acquisition, describes what type of images are needed for IBL and how to create them yourself.

 

You now have your image to be used. It is either Equirectilinear (Spherical) or Mirrored Ball (Angular), it is in 32 bit mode (unless you are using a 8 bit), and it is sized correctly. Remember that the larger the image the longer the render times. Keep the images small unless you need it to appear accurately in the background or reflections.

Have your final modeled and textured scene ready to go. Delete or hide all existing lights. IBL rendering does not require lights.

Remember that when you don't have any lights in your scene you have to turn off "Enable Default Lights". Otherwise, Maya will make them.

Render Globals>Common>Render Options

Make sure you have selected "mental ray" as your renderer.

Under features, make sure that Raytracing and Final Gathering are enabled.

IBL can do Global Illumination, but this demo is not covering that. Keep GI and Caustics turned off unless you want to experiment on your own.

 

Switch to the Indirect Lighting tab and simply click on the Create button for Image Based Lighting.

This creates a large sphere in your scene that surrounds your objects. Your image will be assigned to this sphere and the renderer will, in effect, create a sphere of lights that are of the same intensity and color of the image. The scene will be lit as if the objects are in this setting (assuming you are using a 32 bit image)

With the sphere or node selected (you can select it in the modeling window) bring up the Attribute Editor for the IBL node.

Under "Mapping" select whether you are using a Spherical (equirectilinear) or Angular (Mirrored Ball) image. In this case we are using a Spherical image.

Under "Type" it will default to Image File. You can change this to Texture should you want to make your own texture as an image. For example a Ramp Shader can be very effective.

Under "Image Name" browse to your image.

The entire bottom section of this area relates to how the image shows up on your monitor. Its the hardware rendered image. This has NOTHING to do with how it looks rendered. Change exposure to get the image to the brightness you want to work with.

 

 

The image now displays in the screen. With the sphere or node selected, you can rotate it to get the image positioned correctly in relation to your objects.

NOTE: if you are using a Spherical, Equirectilinear image, it may be flipped left to right. Currently, I haven't found a quick way to flip it in Maya. If it is important to have it correct, I just go back to Photoshop and flip it there and resave.

 

The Render Stats section of the IBL node controls some aspects of the render and specifically how final gather effects will be used.

"Primary Visibility" will hide the sphere from the scene, but it will still be in reflections. Here you also have more choices of how the image will appear.

Enabling "Adjust Environment Color Effects" will allow you to increase or decrease how bright the image is in the background. This DOES NOT effect how bright the lighting is on the objects. It only increases the image brightness and its reflection on the objects.

NOTE: Many times you need to make the image brighter. Click on the color swatch for "Color Gain" and type in a number for "V" (Value). The highest the slider will go is "1", but many times I need 3 to 5.

Enabling "Adjust Final Gather Color Effects" will allow you to increase or decrease how bright the lighting is on the objects. This DOES NOT effect how bright the image or reflections.

Remember that you have all the typical and important Final Gather quality settings in Render Globals that you can use to increase the quality of the render.

 

Many times, just using the previous step of Final Gather will give you the results you want. However, if you want to generate real lighting effects and shadows, you will need to proceed to the next section of the IBL node, Light Emission.

NOTE: Before working with emitting light, I would suggest turning off "Adjust Final Gather Color Effects" in Render Stats. This will allow you to see exactly what the lights are doing.

Toggle on Emit Light.

Quality U and V defaults to 256. This is what is determining, in effect, how many virtual lights are be created. 256 x 256 is very large and probably not needed. I would suggest starting off with a lower number of 64 x 64. You can always increase.

"Samples" are increased to give you higher quality. It will also dramatically increase your render times.

Again, you can enable "Adjust Light Emission Color Effects" to increase or decrease the amount of light. Many times it is too bright and I need to lower the Color Gain.

 

 

This is a test render of "Metal Spike-Man" and his Lambert bumped necklace. I use him as a quick stand-in for tests. He is rendered here entirely from a 32 bit image of a computer desk in a room with windows and tungsten lights.

At this point, you are working to balance all the parameters that you have activated: Final Gather, Light Emission, Image Brightness, and quality in Render Globals.

I usually leave the image showing and that helps me to get the lighting I desire.

NOTE: you can also add in traditional Maya lights to the scene if needed. I rarely do this.

The image is rendered with a mask alpha channel, so even if the final render includes the background image and I don't want it, I can use the mask to cut it out.

Here is a final test.

Metal Spike-Man is rendered with Image Based Lighting. The image used is a 32 bit Mirrored Ball (Angular). CG Spike-Man is composited onto a full res undistorted image taken with a DSLR with a normal lens. The sphere of the IBL node was rotated so that the IBL image matched the direction of the light in the final background scene.

Spike-Man is looking pretty happy sitting at his desk. It is looking natural and integrated.

 

 

 

 

UMBC Department of Visual Arts, Advanced Maya Courses, Dan Bailey