Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
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.
There are a number of render layer presets that you can use that can help speed up some of your workflow when creating render layers. And I want to show you just basically how to find them and how to apply them. This is my dining room scene, and I've already split the scene into several different render layers. I have a render layer for the lit and textured geometry of the scene. I have a render layer for my volumetric lighting effects. You can see there is geometry in this render layer, and I have another one for color masking.
So it's divided by color mask. So I'm going to create another render layer that's going to add ambient occlusion shading using a preset. So the first thing I want to do is I'll go to my default render layer, and in this case I'm only going to add my room geometry to the new render layer. So I'll select it in the Outliner, go to the Render Layer palette and under Layers, I'll choose Create layer From Selected. I'll double-click on this layer in the Render Layer Editor, and I'll name this AO.
This is a typical abbreviation for ambient occlusion. AO_RL. Now that I have this render layer established, I want to create a preset for it. So I'm going to go to the Attribute Editor. I'd like to select the layer and open the layer itself in the Attribute Editor, and that sometimes will be a little bit tricky to hunt around and find the actual node. So a quick way of being able to find the actual render layer node is I'll go to the Outliner, under Display, I'm going to turn off DAG Objects Only.
So that now the Outliner shows all the nodes in the scene. So you can see I have a whole lot of nodes here displayed. There is everything in the scene. If I scroll down here, I can find AO render layer. Another easy way for working in the Outliner is I can just do *AO*, hit Return, and it's going to just show everything listed in the Outliner that has capital AO in it. The stars just tell it to ignore everything before and after this. So now that I have this selected, I know I have this render layer selected, here it is in the Attribute Editor, just open up the Attribute Editor, and if I click on Presets here, I can see a number of presets, so the one that I want to choose is Occlusion.
And when I apply this to the render layer, it automatically goes in and applies a special shader to this render layer. And I'm going to click back in the Channel box, and now I have AO_RL render layer selected. So I'm just going to create a quick render. So let me open up the Render view, make sure I've this stored and do a render from the renderCam camera. Let's see what we get. Believe it or not, this is actually working the way it's supposed to, but there are a couple things I need to do to fix this, because, as you can see, this is extremely dark.
This is a bit more ambient occlusion than I would like. So I'm going to hit Escape here to stop this render, and I'm going to store this images just so I can compare it with the fixed version, and the problem is is that I have a ambient occlusion shader that's been automatically applied and set up for me, and all that's great. Maya has taken a few steps out of my hands and made my life a little bit easier. The problem is is that the default settings for this shader is using an infinite amount of distance to detect ambient occlusion. So the way ambient occlusion works is that rays are shot into the scene by the camera, and when one of these rays hits the surface, it looks around to find out if there any other surfaces near. If there is a surface near the initial surface, it's going to darken that point where the ray intersected that surface.
The problem is if I have the Distance set too high - let's say the ray comes out of the camera and hits the center of the picture here - by having the distance set to maybe one unit, then it's only going to search for anything within one unit of that initial spot on the painting. If I have it set too high, for instance, like an infinite amount, it's going to search all the way to the other side of the room and, let's say, detect this part of the ceiling, and that's going to influence it, causing it to be dark here. So that's why we're going to get something that's way, way darker than we need.
So this is an easy thing to fix. I will just select any part of the geometry in the scene, because I know that my ambient occlusion shader has been applied to all of it. I'll open the Attribute Editor, and I'm going to scroll through here, until I can find this surfaceShader. I believe this is the ambient occlusion shader. You can see that there is a connection here to Out Color. So I'll click on this and this indeed is my Ambient Occlusion shader. Another way to find this quickly, rather than just scrolling through all that, I can just go to the hypershade and under Texture tab, I can also find it here, select on it here: mib_amb_occlusion1.
Now that I had opened the Attribute Editor, what I want to adjust is the Max Distance. Since this is set to zero, this is telling mental ray to search an infinite amount of distance. So I'm going to set this to 1. I think that should be plenty, and I'll improve the Quality, reduce the graininess by increasing the Samples to 32. Now when I open the Render view and create a render from the render camera, we should see a different result.
In this case, I think the distance is a little bit low, but you can see at least now, we can see our objects. So we're getting sort of almost like a dark tuned shading quality to it. What I want is something a little bit softer, like a shadow that occurs in the corner. And the reason this effect is useful is ambient occlusion is part of indirect lighting, for instance, when you're using final gathering or global illumination. The problem with using final gathering or global illumination is that it's hard to get a lot of detail out of your ambient occlusion shading.
You have to pump up the number of rays that you're shooting into the scene, or the number of photons, depending whether you're using final gathering or global illumination, or both. By creating a separate ambient occlusion pass, I can also use this in my compositing software to add detail to the shadowing. So it takes some of the burden off of indirect lighting techniques, such as final gathering or global illumination. So to make the shadow a little bit more prominent, I'm going to go back into the Attribute Editor for my mib_amb_occlusion node, and I'm going to set the Max Distance to, let's try 5. I'll go to the Render view and do another render.
And this is closer to what I was hoping for, something that shows a little bit more detail in there. And this dark line you're seeing right here is just the shadow underneath the tablecloth that's under the table. So there we go. I might set this up to 8, and do one more rendering. That was fairly quick. You can see how much faster that is than doing final gathering. And there we go. You can see this is the one where I had the distance set too high, so it's completely dark, and once I adjusted the distance, I'm getting different levels of ambient occlusion here, just by increasing that Distance amount.
There are a number of other render layer presets. I'll select this layer again, and if you look under Presets, you can see Luminance Depth, Occlusion, Normal Map, Geometry Matte, so on and so forth. So these presets are here for your convenience. Since render passes were introduced in Maya 2009, there are other ways to create similar effects using render passes, as opposed to render layers. So these aren't used as much, but it's nice to know how to find these render presets, if you find that you ever need them for one reason or another.
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.