Link Bake Port IES Sample IBL

Maya, Mental Ray: Lighting

This Page Is out Of Date.

LIGHTING ADVANCED

In this section we’ll finish off the main aspects of lighting. Baking Final Gather for animation, using portal lights for interiors, IES lights which mimic real interior light fittings and an overview of image sampling.

 

LIGHT LINKING

Light Linking is very easy in maya.

By default all lights will affect all objects in the scene. We can switch this off in the light settings

Light Shape Node > Illuminates By Default Off

Unlinking Lights
1. Select the lights in Maya And Objects We wish to Unlink
2. Go Rendering Menu > Lighting/Shading > Break Light Links
or hold the L key down and go “Break Light Links”

Linking Relinking Lights To Objects
1. Select the lights in Maya and Objects to link
2. Go Rendering Menu > Lighting/Shading > Make Light Links
or hold the L key down and go “Make Light Links”

Managing Light Links
Window > Relationship editors > Light Linking > (object or Light centric, choose which you prefer)

or use the script “Lighters Friend” as seen below.

 

LIGHTERS FRIEND SCRIPT/ MANAGING MULTIPLE LIGHTS

We can use the Lighters friend script to do various tasks while handling multiple lights, it’s also very handy for managing light linking.

http://www.creativecrash.com/maya/script/lighter-s-friend

 

BAKING FINAL GATHER

It’s very handy to know how to bake final gather for scenes/render layers where the light isn’t changing and objects aren’t animating. Note the camera can still animate and move through the scene.

When can’t we bake final gather?
When animated object/s are moving through the scene causing changes in FG.
When lights are animating on and off causing changes in FG.

Why Bake (cache) Final Gather?
1. To stop the flickering of final gather on animated shots
– FG is randomly generated from frame to frame, so the splotches can animate sort of like a light ball in a disco. If it’s not animating say in a still image it’s not really noticeable, but once animated we can often notice flicker in the FG.

2. To speed up render times.
– The speed increase can be huge if we are using high quality FG settings.

How to bake (cache) Final Gather

Go to
Render Settings > Indirect Lighting Tab > Final Gather > Final Gathering Map

Rebuild is the most important item here for caching.

Rebuild On = Is default and calculates FG always, over writing any previous frame or settings.
Rebuild Off = Adds the FG point data of every frame to the cached file, we use this to calculate the FG Map
Rebuild Freeze = Uses a cached file on the hard disk, usually it will be the one we create with Rebuild set to Off*. *Note this must be in your project directory if moving computers.

To Cache FG
1. Switch to “Rebuild Off”
2. Render the necessary frames to get all the FG information we need. We move the camera to cover all angles. See next section
3. Once completed switch to “Rebuild Freeze”. Now the FG will be cached and only using the data that’s been previously calculated to the HD. Faster render times and no flicker.

Pumping Up FG Settings for Cached Scenes
Remember when caching FG scenes it’s ok to crank up the FG settings. We’ll have slow renders while computing the maps, but after freezing the FG will render almost instantly. This is great for high quality results.

Visualising FG
To Visualise FG we can switch on “Enable Map Visualizer” This can help us create maps of the FG to see the areas we may have missed.

Render Settings > Indirect Lighting Tab > Final Gather > Final Gathering Map > Enable Map Visualizer

1. Move the camera with Rebuild Set to Off to map all the areas covered by the camera in the scene.
2. Switch Rebuild to “Freeze” to use only the cached data

Breaking apart Cached BG scenes with Animated Objects/Characters
We can break up the scene into render layers so the BG environment is rendered separately to the character/animated objects. It’s then possible to bake the FG in such cases. The character won’t affect the final Gather (bounce lighting) but sometimes this is ok in order to speed up our renders. We can render shadows separately and comp together.

Tweaking Render Speeds With Animated Objects/Characters without caching FG
We can use lo res objects to place hold hires characters just for the bounce light effects rather than having heavily displaced/heavy characters in our scenes. This is done on scenes where we can’t/don’t want to cache the FG

1. Completely remove the hi res character and render on a separate pass/render layer
2. Use a lores substitute for FG
3. On the lores substitue object/s shape node turn off…
– geo shape node > Render Stats > Primary Visibility off

Now the final gather will be cast by a lores placeholder of the hires animation object.

While rendering the hires character we can use IBLs of the scene too… See “CREATING A HDRI FROM A MAYA SCENE” at the bottom of this page.

Final gather Mode for Animation
For animation we can set the final gather mode to animation, to do this go

Render Settings > Indirect Lighting tab > Final Gather > Final Gather tracing

This can minimise flicker some more too.

 

MENTAL RAY “use light shape” AREA AND SPOT LIGHTS

By default if we’re using Maya lights either area or spot lights Maya is having to convert the lighting on the fly to mental ray. From my tests this is ok, but strictly speaking Mental ray lights will give lighting results that are more accurate.

To create a mental ray spot or area light
1. Create the lights as per usual
2. In the light shape node > Mental Ray (dropdown) > Area Light > Use Light Shape
3. We no longer use the “Raytrace Shadow Attributes” to control the shadow quality
4. Set the “type” to the desired shape (rectangle, Sphere, Disc etc)
5. Instead up the “High Samples” until we get better results*

*Please note this setting works in conjunction with the
Render Settings > Quality > Unified Sampling > Quality Setting

The higher we have the Unified Sampling > Quality, the less we need the High Samples in the “Use Light Shape Area”

Spot Light Settings
Please note that using an area light checked on for spot light will mean that the scale of he light will affect the shadows. Change the “Types” (rectangle, Sphere, Disc etc) for different effects.

 

PORTAL LIGHTS

Here’s a great video about portal lights in Mental Ray which are used to light through window which Mental Ray has a hard time computing with Final gather. The setup is at 15:20 min. With a cool explanation about how FG calculates earlier in the video.

1. Create an area light and put it at the same size as the window just outside
2. Go to the mental ray tab of the area light > Area Light
3. Make sure Use Area Light is checked
4. Click on Visible (mental ray > area light)
5. Scroll down to Custom Shaders > create a Light Shader
6. Go to Mental ray Lights > Mia Portal Light

Defaults are pretty good

To up the shadow samples up the sample in the actual Area Light. The portal light multiplier now controls the intensity.

Maya/Mental Ray: Portal Lights
Zeth Willie

Vimeo / zeth willie - via Iframely

 

SAMPLING IN MENTAL RAY

It’s important to have a rough idea of how Mental Ray samples work, this is one of the key aspects of a physically correct raytracer.

This is a complex area and goes right to the heart of how raytracing actually works.

 

Sampling for Dummies

Adjust the unified sampling quality higher for better antialiasing and render shadow quality. Default is .25 but we can switch it lower (.1) for test renders and higher for final images (1-2).

– Render Settings > Quality > Unified Sampling > Quality Setting

Usually values past 2 are excessive and usually used only for rendering stills.

 

Sampling for Lighting Gurus

Sampling is the area that once mastered allows a lighter to fully optimise render times. Pre Maya 2014 the sampling default was not unified sampling. Hence the drop down allows you to select legacy sampling modes.

Unified Sampling is a new sampling type which automatically scans your scene for complexity and automatically adjusts for sampling quality. This means it samples more in the areas it has to (high contrast) and less in the areas it doesn’t have to (smooth areas… including depth of field and motion blur).

For more information about sampling modes in Maya and Mental Ray see
Elemental Ray Blog

And here is a rather good explanation of DMC sampling in VRay which is basically the same as Unified Sampling in Mental Ray. It’s starts off nice but gets complicated very quickly…
DMC Sampling in VRay (Similar to Unified Smapling in MR)

 

MANUFACTURER LIGHT SETTINGS (IES)
An .IES file (Illuminating Engineering Society) is a real world industry lighting standard that describes real world lighting data. We can use these to plug into Mental Ray and they’re commonly used for archvis (architectural visualisation) or rendering for architecture.

IES Light Profiles can be downloaded from light manufacturers and various 3d communities. Here’s a good collection of basic manufacturer’s lights from Derek Jenson…
http://www.derekjenson.com/2/post/2010/11/ies-light-profiles.html

4:47 mins

YouTube / andrew silke - via Iframely

 

EXPOSING THE CAMERA WITH A LENS SHADER

A real camera needs to open the shutter or lower it’s FStop in dark lighting situations, and the same is for us in Mental Ray. It mimics the real world. We can do this in compositing/post to varying levels with our 32 bit images, but it’s best to see this in the maya viewport and do it before compositing.

Creating a Lens Shader
1. Select the Camera
2. Go to the camerashape tab in the attribute editor
3. Scroll down to the mental ray section
4. In the lens shader slot click on the add checkerbox
5. Under the mental ray section go Lenses
6. Click on the mia_exposure_photographic
7. IMPORTANT! With linear workflow we have to make the gamma on the lens shader to 1. I miss this in the video.

This will create the lens shader, the defaults are extremely dark for low light situations.

Tweaking the Lens Shader
1. For dark scenes it’s easier to set the exposure node to “arbitrary or photographic mode” to do this set the Film ISO to 0. Now we just adjust the CM 2 Factor attribute.
2. Up the “Cm 2 Factor” in small increments to change the results. Settings of 15 – 200 is not uncommon for darker scenes.

Cm 2 Factor is Candela/m2, which is a type of math for lights.

This from wikipedia
“As a measure of light emitted per unit area, this unit is frequently used to specify the brightness of a display device”

5:42 mins
IMPORTANT! With linear workflow we have to make the gamma on the lens shader to 1. I miss this in this video!

YouTube / andrew silke - via Iframely

 

CREATING A HDRI FROM A MAYA SCENE

The Latlong Lens Shader for Maya is put on the camera lens in order to render a full 360 spherical map of your 3d scene. We can use it to create our own IBLs for lighting characters etc.

Latlong_Lens Shader Download

This page has a video and some nice info on how to setup the shader. There was a lack of install information so I’ve included that below.

Latlong Information Page

Latlong_Lens Installation Instructions
1. Find the folder… applications/mentalrayForMaya2014
2. Put the latlong_lens.dylib goes in the shaders directory
3. Put the latlong_lens.mi in the shaders/include
4. Put the icons in your prefs directory where you install my user prefs.
2014-x64/prefs/icons
5. Once installed make sure it comes up in the “lenses” section in the mental ray hypershade

Instructor

Andrew Silke

Leave a reply