Introductory mental ray Lighting

Written December 4th, 2008
Categories: Articles, Lighting, Modeling, Rendering / Compositing
9 comments

For this tutorial, weā€™re going to explore mental ray by making a simple room and lighting setup. Iā€™ll be using 3dsMax 9 but you can follow along with any version. I’m also including my finished file so you can pick it apart if it suits you.

Final Render

Our final render, after some materials and direct light.

Mental Ray Room

Now I’m assuming a low, but non-zero level of previous knowledge during this tutorial. Specifically, that you’ve been using scanline for a few days or weeks and would like to extend your knowledge to include mental ray. While I’ll include images and try to go step-by-step, Remember that mental ray isn’t for those just starting the program for the first time.

Step 1: Build a box and flip its normals.

Iā€™ll start off by making a box thatā€™s 200x100x70 thatā€™s the basis of my room.

Convert it to an editable poly object by right clicking and selecting editable poly.

Select all the polygons and in the Edit Polygons rollout, select ā€œFlipā€.

Box with Flipped Normals

Create a box with flipped normals.

Step 2: Make some windows and details.

Feel free to deviate slightly from the tutorial at this point if youā€™re feeling confident. Iā€™m going to create a single window at one end of the long-ish room. However, you could do some pretty ambitious stuff with the roof, creating a long skylight and then putting up rafters and plants. Oh my! But for me, and for the sake of some beginners out there, Iā€™m going to keep it easy and direct for now.

Select the polygon at the end of the hall and inset it, then extrude it with a negative value. If you want to resize the window you can. Iā€™ve selected the bottom polygon of the window sill and moved it up a bit.

Delete this polygon. This will form our window!

A box with a window cut out

Cut out a window for the room.

Select the floor polygon. Inset it a little bit, and then extrude it down to form a baseboard. This is a minor stylistic thing that always adds a little realism to the room! I’ve also taken the artistic liberty of raising the base of the window a little higher.

Create a floor boarder

Create a border for the floor.

Now we have the makings of a basic room. Go ahead and save your work. Always a good practice.

Step 3: Switch to mental ray and create some lights.

We need to enable the mental ray renderer, since the scanline is being used by default. Hit F10 for your render settings panel and under the ā€œCommonā€ tab in the ā€œAssign Rendererā€ rollout, hit the ā€œā€¦ā€ next to production and select t the mental ray renderer. For a shortcut, in the little pink box in the lower left corner you can type

    renderers.production = mental_ray_renderer()

Super! Letā€™s get some lights in here. Under your create panel, go to the lights group, and select an ā€œmr area omniā€. Place it at the base of your window sill in the perspective viewport. Move it up so that itā€™s just outside your window.

Now for some lights.

Now for some lights!

Step 4: Scene adjustment.

Take a render (Shift-Q). Hmmā€¦not quite what we want yet, is it? That’s ok, I know just the trick!

The first render

Not quite what we expected.

For starters, we need the polygons of the room to be double sided so that light doesnā€™t leak in from the walls. Hit your hotkey ā€œMā€ and open the material browser. Drag and drop any grey material from the browser onto your room object and the material will be applied. Select the ā€œ2-sidedā€ checkbox in the material you just dragged over.

Use a 2 sided material

Create and use a 2 sided material.

If you render again, youā€™ll realize that now we canā€™t see inside the room! Thatā€™s because the walls are now impenetrable. We need a camera on the inside of the room. Under your create tab, go to the cameras group and create a target camera inside the room by clicking and dragging.

You can switch to this camera by pressing the ā€œCā€ key. Reposition the camera if you feel the need to. It was likely created at ground level, and thatā€™s not quite right.

Now if you render you get a much better perspective on things. If youā€™re having trouble, it could be because the camera is not entirely inside the room, or itā€™s not pointed in the right direction.

Next, go ahead and hit your ā€œ8ā€ key or go to the tool bar ā€œRenderingā€>ā€Environmentā€ and click the black swatch under background color. Pick a very light blue color. That will make it look a little more like the light coming in the room is real.

Pick a Color

Pick an outdoors-y color.

Step 5: Use Final Gather.

Re-render the image, and youā€™ll see that itā€™s looking even better now!

Our second render

Our second render's looking good.

But something is still off with the light. I bet if we enable final gather itā€™ll look twice as good! Final gather is a light bouncing solution in mental ray similar to 3d Studio Maxā€™s native radiosity. If we turn it on, the light will cast around the room in a much more realistic way. If youā€™re using 3dsMax 2009, final gather is probably on by default so you can effectively skip this step.

In your render settings window (F10) youā€™ll see an ā€œIndirect Illuminationā€ tab. Click on the checkbox that says ā€œfinal gatherā€, select ā€œDraftā€ from the quality preset pulldown, and change your bounces from 0 to 1.

Re-render your image. Now weā€™re cooking!

The render with Final Gather

Final Gather makes all the difference.

Step 6: Make the spherical light project properly.

What do you say we make that light source look like itā€™s really from outside? Select the mental ray light, and under the modify panel, click on the ā€œarea light parametersā€ rollout. We want to change the height and width of the area light to fit the window better. The window is the lightsource. Increase the radius of the light such that it can reach the left and right sides of the window, even if it starts protruding into the room. Use the scale tool to scale it such that it becomes a big flat disk right outside the window. Youā€™ll have to twiddle the radius spinner to see the size of the disk, so donā€™t hesitate to do a guess-and-check kind of approach. Donā€™t worry too much, this isnā€™t that critical.

Proper Spherical Light Use

The spherical light is softer.

Re-render, and youā€™ll see the lighting solution really coming to life. Itā€™s a little graining and dark, so weā€™ll have to increase the intensity of the light. In addition, change the samples on the light from 5 and 5 to 8 and 8. This will increase the sampling of the shadows and remove some of that grainy texture. Note that this change will increase render times, so if it becomes difficult for your system to handle, leave it low until youā€™re ready for a final render!

Render with more light.

We're getting more light now.

Cool beans! Now Iā€™m going to let you try out whatever you want on this scene. Put some materials around the room and see how they render. Maybe make more windows or direct lights and let the light sources interact and brilliantly light up the place. Itā€™s your call! I encourage you not to skip this step. Playing around is what really teaches you how to use this program, tutorials like this are supposed to get you to that stage.

Final Render

Our final render, after some materials and direct light.

Iā€™ve done a few things to my scene, and you can check them out at your leisure. The biggest changes are the extra light sources, a few lighting tweaks like intensity, and the materials.

If you have any questions, you can always find me on the 3dTotal Forums and PM me (Bluesummers-3dt).

Until next time, happy rendering!

9 Responses to Introductory mental ray Lighting

Leave a reply


©2023 MrBluesummers.com