Wednesday, August 10, 2011

Interior lighting with Maya and Mentalray

        This tutorial is on interior lighting in Maya and Mentalray. Thanks to Dapoon Rai Dewan for providing the scene.

This is our scene and the  tutorial shows how to create lighting through a window or a door.

Another view.

 All the sides are covered up and the window that is seen in the picture is the only opening in this room. When you set up the scene make sure that there are no unwanted openings on the wall because it causes light leaking.

1) Step one is to change the renderer from Maya software to Mentalray. Go to Window - Rendering Editors - Render Settings. Render using - Mentalray.

 2) In the quality tab change the quality preset to production.

 3) In this scene, the main light source is the sunlight entering through the window. To create sunlight go to Create - Lights - Directional Light.

4) In the Attribute Editor, scroll down to Raytrace Shadow Attributes under the 'Shadows' section. Check 'Use Raytrace Shadows'. Increase the 'Light Angle' to 1 to make the shadow edges softer.' Shadow edges tend to become softer at the edges as the distance to the object creating shadow increases. Shadows Rays are increased to 20 to avoid graininess on the shadow edges. These values vary according to the scale of the scene so some tuning is required to get the desired look.

 'Ray Depth Limit' is increased to 2 to enable the reflective objects to reflect shadows.

5) DIrectional Light can be placed anywhere in the scene. Using 'Rotate' tool play around with the angle of the light and do test renders.

Render with keylight and shadows.

6) Once the direction of the sunlight is finalized, move on to the diffused skylight. Area lights are very handy in simulating skylight. It creates soft shadows.
 Create - Lights -Area Light.

7) Scale the size of the Area Light to the size of the window\door. Scale of an Area Light is very important as it affects the light intensity and shadow softness.Keep it outside the wall, very close to the window\door.If more windows\doors are there then multiple area lights need to be used.

8) Render with sunlight + skylight (directional light + area light)

  I have given a very low intensity to the area light (.25) to achieve a dramatic effect. A high contrast creates a feeling of dark, strong emotions. If you need an emotionally neutral scene or want to make everything  bright and happy then increase the intensity of the area light.

9) For the light bounce Go to Render Settings - Indirect Lighting tab. Scroll down to Final Gathering section.  Check the box and change the 'Secondary Diffuse Bounces' value to 1.

 Render with Final Gathering

10)  Ambient Occlusion pass.

Take these two images(render sequences in case of animation) to a compositing sotware.
Adobe Aftereffects is what I use.

11) Place the occlusion image on top of the final gathering image and change the blending mode of the occlusion to multiply.

Final image with some minor color corrections.

Tuesday, June 28, 2011

exterior lighting with Maya and Mentalray

This is a simple lighting tutorial for beginners in lighting with Maya and Mentalray.
This is our scene and this awesome animation is done by Dapoon Rai Dewan.
Please follow this link to watch the animation.


This process can be followed to light any outdoor scene. I will be trying to achieve an evening scene.

1) Software render with default light.

2) Now we need to change our renderer from software to Mentalray.
    For that go to Window - Rendering Editors - Render Settings. Render using - Mentalray.

3) If Mentalray is missing in the drop-down menu,  MayatoMr plug-in must be loaded from the Plug-in manager.
    Windows - Settings/Preferences - Plug-in manager.

4) Go to the 'Quality' tab in the Render Settings window and change the quality preset to 'Production'

5) Now go to Create - Lights - Directional Light.

   Directional Light is the best to simulate sunlight.

6)   Go to the Attribute Editor and scroll down to Raytrace Shadow Attributes under the 'Shadows' section. Check 'Use Raytrace Shadows'.

   Directional lights can be placed anywhere in the scene. Light direction and shadows depend upon only the angle of light which can be controlled using the 'Rotate' tool.

    We may have to play around with the angle of the light and do test renders until the desired results are obtained.

This is my render.Shadows can be seen in this one.

7) Time to turn on FinalGathering.
    Go to Render Settings - Indirect Lighting tab. Scroll down to Final Gathering section.  Check the box and change the 'Secondary Diffuse Bounces' value to 1.

  Render the seen. This is what i have got. We can see the light bounce.

8) Outdoor scenes require skylight as well. To simulate that, select camera, go to attribute editor, scroll down to environment and change the background color in to blue. Final Gather will take care of the rest.

 Render the scene.

 9) To make it look like an evening, we need change the light's color. I have changed the color, intensity and the shadow color.

10) Edit the 'Raytrace Shadow Attributes' in the light's Attribute Editor to make the shadow edge a little soft. We need to tweak these values to get the correct amount of softness.

 This is the render after the changes.

  This is the final render in Maya. To add a background image and Depth of Field, we have to take this image along with couple of other render passes to a compositing software.

 To take those extra passes,

11) Select all the objects in the scene except the lights, in the Channel Box/Layer Editor, select 'Render' tab and click on 'create new layer and assign selected objects' (the right most button).

 A new render layer is created now. 

12) Right click on the new layer and select attributes. Attribute Editor will be opened.
     Click on the preset button and select Occlusion.

13) Occlusion shader opens up in the Attribute Editor. It needs some edits. So click on
the 'Out Color'.

14) Increase the Samples to 32. The other parametre that have to be edited is 'Max Distance'. This value depends upon the scale of the scene. Something in between 1 and 100 must work unless the scene is too small or too big.

 The render should look closer to this.

15) Now right click on the occlusion render layer - Add New Render Pass- Camera Depth.
     This Depth Pass is used to add DOF in the compositing software.

Double click on the layer to rename it. Remember to make the masterLayer renderable by clicking on this button before the animation is rendered.

Time to composit!. I use Adobe Aftereffects for compositing.

16) Once the animation is rendered open Aftereffects.

17) Go to File - New - New Project.

18) Go to Composition - New Composition.
       Enter the width and the hight of the render, Frame rate and duration, press OK.

19) To import the render files and the background image, File - Import - Multiple files. In the 'Interpret Footage' window, check Premultiplied-matted with color.

20)Drag and drop all the layers into the Timeline window. Change the Mode of the      occlusion layer to Multiply. Select the occlusion layer and press 'T' to adjust the opacity.

21) To add DOF, this plug-in has to be installed.

22) Go to Layer - New - Adjustment Layer. A new layer will be shown in the timeline.
  Right click on that, Effects - Frischluft - Depth of Field.

23) In the newly appeared Effects Control window, increase the radius and select the depth layer from the drop-down menu. Click on the '+' sign and then click on the scene to select the area of focus. Radius can be used to increase or decrease the blur amount.

24) To do some color corrections, right click on the masterlayer - Effects - Adjust -Curves  or  Levels. This is my final image.

 Please contact me if you have any doubts or need any clarifications.