Software used
Maya 2011, mental ray
What you will learn
In this tutorial, we will tackle a lighting challenge with small-scale production needs in mind. Intended for small-scale productions, this tutorial walks through one lighting and rendering workflow that introduces new tools, techniques, and workarounds. We will exploit the environment-sampling power of portal lights, build a fake GI solution with projected light fields, and use MEL scripts to automate tedious tasks. These methods won't work for every scenario, but they can be very useful tools for the guerrilla CG filmmaker.
In this lesson, we're going to go over creating some indirect lighting effects using direct lighting methods, namely portal lights. So back in Mya, we're back in this really simple scene. I've added a skylight to the top of the geometry. And I've gone ahead and set up a physical sun and sky inside of mental ray. I've got final gather turned on, some pretty low quality settings. We're just going to take a look and see what we get from this result. So I take render, give it a few seconds to calculate the final gather map. This is what we get. We've got direct light coming in from the sun, this little patch right over here. But most of this blue light that's being cast in the scene is actually coming from the sky. And that's an indirect source of light from the sun. And we're getting this really patchy result, and we're not getting very good resolution on the details around here. And there's a few ways that we could handle this. We could start pulling up our final gather values and make them much more accurate. That becomes very render time expensive. Another technique that we can use is using portal lights. I've gone ahead and created a display layer inside of here. If we go down to the display, turn on this layer called Portal Lights, we'll have a couple of area lights that show up. It's outside of each individual window in the scene. Mya refers to these as portals. In order to set up a portal light-- I've already put one on here-- in order to set it up, we click on the light, go down to the attribute editor, go down to the mental ray tab inside of the shape node, and inside of area light, we have a few different options. In order to get a portal light to calculate properly, we have to turn on Use Light Shape, Type of Rectangle. And High Samples will be the overall quality of the shadows that we get out of the lighting. So in this case, I'm going to set it to 32 samples on High. Low Samples is the quality inside of reflections. So we don't have any reflections on our scene right now, so I'm going to leave this at one for right now. Another thing that we have to do is set this light to Flag Visible. And normally, if we just took a render of this without adding the portal light, this would mean that this comes up as a white card inside of our scene. If we're using a portal light though, we have a separate controller that allows us to control whether or not it's visible in actuality. But we have to have this flag turned on in order for mental ray to sort of understand that we want this to be a portal light. So keep scrolling down until we get to Custom Shaders inside of Light Shader. Go to the checker box and go to mental ray lights, and grab MIA Portal Light. And the defaults here will work just fine. What's really important is we need to have Enable Sky Portal turned on, and we need to make sure that this is using lookup with final gather rays. If we want to create a custom color for our light, we can use custom environment. But for now, I just want to use that as a set up. So we've got this light and this light on top set up as portal lights, and what we can do is take a render of this. I'm going to go ahead and bring out my render window, save this image as a point of reference, and take a render. This will take a few seconds to calculate. 32 is a fairly high number for samples on these lights, but it will give us a very nice result. It's calculating final gather and then it will render the full resolution version. So we're still getting a lot of speckling, but the overall quality is much nicer than what we had before. You'll notice in these areas where there are contact between objects, you're getting much finer resolution of details in the corners and that sort of thing. We're using a direct light result to fake that first bounce of light coming from the sky. Now the really cool thing about this, and sort of the thing that makes this from a usual technique in order to get better final gather, is that we don't actually have to have final gather enabled. Because we're using final gather raise in order to calculate the color values, we don't even need to have final gather calculating in order to get color out of this scene. So if I turn off final gather and take another render, what we get is only the color contribution from these lights. So we've just set up a light. We didn't add any colors to it, but it's sampling the colors from the environment that we have set up in our scene. So now what we can do is take this scene and start to fake the other effects that we would usually get from final gather while still maintaining a very accurate calculation of indirect light using direct lighting methods. So that's an overview of how to use portal lights in order to create the ambient lighting from skies in a scenario where you have windows. In the next lesson, we'll start looking at production rendering settings in order to get a really good idea of how our changes are affecting render time inside of our scenes.