Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Lighting and Rendering with mental ray in Maya with Eric Keller shows how to master practical mental ray techniques for rendering models created in Maya. This course walks through the most efficient and innovative mental ray techniques, including direct versus indirect lighting methods, creating different types of shadows, using the new ShadowMap camera, and reusing shadow and final gathering maps. A chapter on optimizing render times and enhancing render quality is also included. Exercise files are included with the course.
I would like to show you how to split up a scene into render layers for easy compositing. In this scene, I have my dining room geometry with some basic lighting texturing applied, and I also have a volumetric lighting effect established, and this is using this directional light and this volume surface. If I open up the Attribute Editor for the directional light, you'll see it has a physical light shader applied, and that's part of what's necessary to create the volumetric lighting effect.
I am going to go back to my renderCam camera, so you can see from the point of view of how I am going to render. I am going to switch to the Channel Box, and the first thing I want to do is create a render layer that contains all my room geometry and lights. So, I will select the roomGeometry group, go to the Render Layer Editor and choose Layers > Create Layer from Selected. I am going to double-click on this and call it roomLit_RL.
The RL is just there to remind me that this is a render layer. So if I select on roomGeometry group and scroll down in the Channel box under Inputs, I can see roomLit_RL among the inputs. By having the RL there, I know that that's a render layer. The next thing I need to do is add my lights. I am going to switch to Perspective view and press 4 to switch to wireframe. If I go back to my defaultRenderlayer, you can see the lights there. I will select on the chandelier group, and this group is just made up of all the point lights that are in the chandelier.
I just created that group to help me organize it a little bit better. So if I switch back to roomLit_RL in the Render Layer Editor, right-click and choose Add Selected Objects, it's going to add that group. I will go back to my defaultRenderlayer, and I will select these four lights. To be consistent and neat, I will press Ctrl+G to group these, double-click on the group name and call these lampLights. So I know that that is the lampLight group.
Click back on roomLit_RL. With lampLights group selected, I will right-click over the render layer and choose Add Selected Objects, and now they appear. Finally, I do have this other directional light here, and this is used to simulate maybe light coming from a room from behind the camera, but really it just helps to boost the lighting in the room to make everything a bit more invisible. So now that I have this selected, I will go back to roomLit_RL, right-click and choose Add Selected Objects, so now this is added.
The last thing I would like to do is switch back to the renderCam camera, press 5 to switch to shaded view. You can see these skylights up here. What I want is this volumetric lighting effect is created with the volumeLight1, and this is just a directional light, and it's pointed down at a particular angle so that the beam's light will come in through right here. I am not going to render the beams of light on the roomLit_RL render layer, but I do need the effect of the light hitting the surfaces here.
So what I want to do is I want to add a light that is at the same angle and has the same properties as this light to the roomLit_RL render layer. So let's switch back to the Perspective view here. An easy way to do this is just to select volumeLight1 in the Outliner and press Ctrl+D to duplicate it, and I will just move it over to the side here. Now remember, this won't change the angle of the light, because the position of a direction layer has no bearing on how it shines; it's just through rotation.
So I am going to rename this light sunLight, so I know it's distinguished from this. If I open its Attribute Editor, I am going to select it, open the Attribute Editor, and switch to the sunLightShape tab. There are no Light shaders applied to this light, so these are both blank. If I select on volumeLight1, you will see physical_light1 is in the Light Shader, sunLight, no light shader. But I do need to turn on Raytrace Shadows. So I will just scroll to the top, go down to the Raytrace Shadows Attributes and turn on Use Ray Trace Shadows.
So that's good to go. And then of course, the last thing I need to do is with sunLight selected, I will switch to roomLit_RL render layer, right-click and choose Add Selected Objects. So now in this render layer, I have my room geometry, my room lighting, and a duplicate of the sun light. So I am going to switch to the renderCam camera. Now you will notice one thing. The only thing I did not add to these render layers is the renderCam camera. When you are using render layers, you should not have to add or subtract a camera from one render layer to another, unless you want to.
You can, if it helps you to remember that that camera is on a particular render layer, but it's not going to affect how the layer renders. Cameras sort of get a free pass when it comes to render layers. So let's open up the Render view and create a render from the renderCam. Okay, so here we have our rendered image. I will store this in the Render view. It will take about not quite four minutes. We can see that we have, obviously, the room geometry.
Everything is shaded correctly. We have our lights. You can also see that the sunlight is coming through the windows here, and it's actually shining down on the table, creating these white squares. It's because of the bars here in the skylight. You could also see the same light coming through the windows here. It looks a little strange because, of course, it is dark outside the window; there is a number of ways we can handle that after we set up all our render layers. For one thing, when we composite it in Photoshop or After Effects, I will take a look at the alpha channel here, just by clicking on this icon here in the top menu bar in the Render view, and you can see that the outside is not included in the alpha channel.
So we could easily composite a simple gradient or image for sky back here, and that will work as well. So let's store that, and let's go to setting up the next render layer. Now the next render layer is going to have the geometry on it and then all the necessary elements for creating the volumetric lighting effect, and this will be the volumelight1 directional light, as well as the volume geometry that I've created. Let's go to the defaultRenderlayer, which contains everything in the scene. I want to select the roomGeometry group, and again, I am going to go Create Layer from Selected.
Double-click on that layer in the Layer Editor, and I am going to rename this volumeLight_RL. The other two things that I am going to need, I am going to need my volume geometry, so I will select that in the Outliner and right-click and choose Add Selected Objects. So now this has been added. If I switch to the Perspective view, you can see now there it is. It's not on the roomLit_RL render layer, but it is on the volumeLight_RL render layer.
Now the last thing I need to add to this layer is the volumeLight1 directional light. So I will select that in the Outliner, right-click over volumeLight_RL and choose Add Selected Objects, and there it is. I am going to switch back to the renderCam camera. There's one other thing I'd like to do. I am going to switch to the Select tool here in the toolbar, and the first thing I would like to do is select the roomGeometry, and I am going to apply a special shader to this geometry, so that it doesn't appear in the render.
It will block the light coming through the top here in order to create the nice- looking rays that come through the skylight. But it actually won't show up in the render, and it won't show up in the alpha channel, as well. So with the roomGeometry group selected, and I am in the volumeLight_RL layer, I have that selected - those are very important - I am going to click on the black surface material shader and that applies the shader to the roomGeometry group. I will open up the Attribute Editor to the surfaceShader2 tab, and I am going to set the Out Matte Opacity to black, so this does not show up in the alpha channel.
Now what's interesting to note is since I applied the shader while I was in the volumeLight_RL render layer, if I switch back to roomLit_RL render layer, I will deselect it, and you can see the textures are correct; we have a brown wood texture here, white wall texture, and so on and so forth. So the shader, you can have different shaders applied to the same geometry on different render layers, and this is what makes them so useful. I'll turn on Wireframe on Shaded so we can see the geometry. So on this render layer, we have a black surface shader applied. On this render layer, we have a regular texturing applied.
So that's a very important element of render layers. It's what makes them so flexible. And there is one thing I like to point out is that since I applied the shader to the entire group, this included the window geometry here, these polygon planes that act as the glass in the windows. So I am going to select those, and once they are selected, I will do Ctrl+H to hide them. So you can see what's going on here, I am going to hide this to volume geometry and take a look what's going on.
So you can see through these windows because the geometry is not there; same with these two pieces of window, Ctrl+H to hide them. So this is another element of render layers. The visibility of an object can be different, depending on which layer you are on. So in other words, if I'm in the roomLit render layer, these pieces of glass are visible; their visibility is set to on. On the volumelight_RL, their visibility is turned off, so they are invisible. So that's also very helpful; you can this with lights to have lights on or off, depending on different render layers, or objects as well.
So at this point, I should be good to go. I will go to my renderCam camera, and I am going to make sure that the volumelight geometry, I am going to select that in the Outliner and do Shift+H to turn it back on, because we are going to need that to create the volumetric lighting effect. And I am going to open up the Render view, make sure this image is stored, and create a render. Okay, so we have finished our render of the volumetric lighting effect, so you can see it's completely isolated.
I am just seeing the volumetric effect. I am not seeing any of the lights in the room or the shading on the geometry, and this will make it much easier to composite. This is just one of the many users of render layers, but I think this is a good example of how they can be useful. So now that I have created that, I am going to keep this image. I will minimize the Render view, and I only have one more render layer that I would like to create, and this is the one in which I can use the red, green, and blue colors to create a geometry mask so the different elements can easily be selected based on their color channels and the compositing software.
So all I need for that is really just the room geometry. So I am going to select the room geometry. I will switch to the default render layer and make sure that everything is visible, and in the Layer palette, I will choose Create layer from Selected, and there we go, and I am going to select on this layer in the Render Layer Editor, double-click, and call it colorChannel_RL. Actually, I would like to call it colorMask. That makes more sense. There we go.
Now that I have this selected, I can start applying different shaders to it as well. The first thing I will do is, I am just going to, with the entire group selected, click on the black surface shader icon here on the rendering shelf. This applies it to everything that was selected, and I will open up, this is surfaceShader3. I will call this redShader, and the Out Color I will set to red. Now everything in the room is red. So now what I want to do is I want to select on just this globe geometry.
So I will switch to Perspective view, press 4 to switch to Wireframe, so I can see what I am selecting here. And really, an easy way to do this is to go on the Outliner, expand roomGeometry group, expand the room subgroup and expand the chandelier, and I have my globe geometry right here. You could just select the first one; this is globe8, Shift+select globe1. Now that they are selected, I will just click on that surfaceShader icon in the rendering shelf again, and this applies a new shader, and I am going to call this greenShader in the Attribute Editor.
Click on the Out Color in the Attribute Editor and pick green. Switch back to the renderCam camera. If I press the 6 button to switch to Shaded mode - and in the Shading palette, I will turn off Wireframe on Shaded - now you can clearly see red for the geometry of the room, green for the globes of the chandelier. So the last thing I want to do, I will press 4 to switch to Wireframe, and I am going to select this lampShade, carefully select this lampShade, carefully select this lampShade, and I will go to the other side of the room, Shift+select on this lampShade, Shift+ select on this lampShade.
So now I have all four lampshades selected, and I will zoom in on the candles, as well. Shift+select the little flame there, move over here to this candle, Shift+select that flame, so now I have the two flames and the four lampShades selected on the rendering shelf. I will click surface material to create a new surface material, and I will call this blueShader. And I will click on the Out Color of the blueShader and select a blue color.
And now, when I go to the renderCam camera and press 5 and deselect everything, I can clearly see that the geometry of the room is red, the geometry of the chandelier - the little glass globes - are green and the geometry of the lampShades as well as the two flames are blue. And I am just picking these somewhat arbitrarily, just as an example of why you might want to use this technique. The reason using red, green, and blue is helpful is because I can do a single render layer render, and with these three colors, create three different types of masks, easily, from my compositing software.
This would be - I mean, I could create one render layer for the glass globes of the chandelier, another render layer for the geometry and another render layer for the lampShades here and the candle flames, but this just combines it all in one single render pass, and this makes things a little bit faster. Of course, when I select this render layer and create a render, this is also a very fast render. It only takes about three seconds, and there we go. And since this has an alpha channel, I will click on alpha channel here.
I essentially have four different types of masks: red, green, blue, and alpha. I will store this image, and that's essentially how you would go about splitting a scene that already exists into different render layers.
There are currently no FAQs about Lighting and Rendering with mental ray in Maya.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.