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 walk through putting together a custom environment in order to provide lighting information for our portal lights. So we're back in our simple scene in Maya. And, lo and behold, someone has deleted my portal lights. And I need to recreate them real quick. Well, just so happens to be that inside of Kludge, I have a script that will do just that. Actually, I have two scripts. One built a portal light at the center of our scene. The other is meant for exactly this kind of situation. If I go ahead and select four edges that define a rectangle and I click on build portal in hole, you'll see that it creates a light, pointing into the scene essentially in that space that we need to have there. So the only thing that I need to change now is change the high samples inside of this light. So I'm going to change this to something a little bit more production-friendly. We'll be able to use this whenever we render. So I can do this again. Select the edges. Go back to the Kludge tools, which is one of these tabs. Ah, there we go. And, again, build portal in hole. And we get our light that's approximately the right size and shape. Just need to scale it down and scale it into place. And we can just back this off a little bit. Change the high samples one more time. And we can also back off this light just a little bit, as well. So you can see already just how quickly you can work whenever you have a little bit of scripting under your belt. The way that I would put it is, as an artist you owe it to yourself to learn how to script. It makes those tasks that are not necessarily difficult but are repetitive or time-consuming, it makes them much, much, much easier. If you're working on a Gorilla production, like we are, then it's essential. You have to learn how to script. You have to be scripting. You have to be coming up with tools. You have to have ways to make things quicker and easier for yourself. So, hopefully, throughout these lessons I'll be demonstrating just how much easier things are when you have a suite of tools that are available to you to do those sort of things. So we've got our portal lights in the scene. And they're all set up. So now we need to create some kind of environment for this to be sampling from. And, normally, I might use something like a physical sun in sky. But I really want to have a lot of creative control over the way that the colors are being evaluated. So I'm going to actually create an IBL node inside of Maya. So if I go to my render settings, go to indirect lighting, and create the image-based lighting set up, this'll give me this nice big sphere that I can place interactively in my scene that will define the environment color for the scene. The benefit of working with this has nothing to do with its real sort of intended functionality. This would normally be used for casting high dynamic range light from an image into the scene. I'm just using it as a placeholder for final gather ray lookup whenever these lights sample the environment. In order to do so, I'm going to use a series of ramps to create a sort of fake sky. So I'm going to go ahead and open up the hypershade. And I'm going to create a ramp. I'm going to go ahead and clear my work area by going up to graph, clear graph. And I'm going to create a ramp and use this ramp to create a sort of horizon line for myself. So I've got red and green as my two colors right now. I'm just going to plug this into the color value on this IBL shape. What's cool about this is you can actually see in real time what your update looks like. Excuse me. There's one thing I need to do before this actually comes in. I just realized instead of using an image file, we need to set this to use a texture. And that will allow us to use that color setting. So you can see exactly what's going on in our scene. And we can rotate and move this in order to better see what we need it for. So going back into the hypershade, I'm going to set a ground color to something a little bit more ground-like than bright red. We're not trying to make this thing look like lava. So I'm going to go for kind of a neutral gray. And that'll provide my ground color. I'll tighten this up a little bit. Move this green down a little. And instead of actually plugging a color into this green, I'm actually going to plug another ramp into it. So just grab a ramp. I'll plug this into the green color swatch. And what you'll see is that we now have two ramps plugged in-- one that provides this gray and the other that provides sort of this horizon line glow. I'm going to go and use this as my source in here. I'm going to plug this-- it's already plugged in, excuse me. So if we take a look, zoom out a little bit, we'll see that we have this nice gradient across the sky. So I'm going to use that as a test bed to make sure that my portal lights are working properly. Go back to my bookmark and take a render. What we should see is some dim light coming in. There, that's exactly what we get. We got little bit of green coming across here, and this blue light coming in as well. In order to get this intensity more in the ballpark of what we want, there's two ways we can go about that. Either we can start cranking up the intensity of the sky itself, or we can start to play with the intensity of the lights. I pretty much like the way that this sky is coming in the window. I like the color values. So I'm going to use the intensity on the lights instead of changing the intensity of the sky itself. So in this case, I'm going to change the intensity multiplier on the portal light shader itself. Change that to, say, three. And maybe do it here too. Inside of the portal light, intensity multiplier, put that on three. And if we go back to our bookmark, we can see how this has changed our scene. And this is actually providing a pretty good starting place for lighting a scene. And we're using ramps instead of some other set up. So we've got green light. We got blue light. And it's all being calculated based on this gradient that we have in the sky. It's a really nice way to work. We're getting a lot of color variety and variation without having to use a single color on an individual light. It makes things much, much easier down the line whenever we're getting these really nice sort of base direct light results. So I'm also going to add in this sort of a, I guess, a sun location for this. And just to make sure it's working, I'm going to probably use something like bright red. So I'm going to grab my hypershade one more time and bring that up. And I'm going to create another ramp. In this case, what I'm going to do is create a circular ramp. So I'm going to change the type of this ramp to-- excuse me, the type to circular. And I want to make this a nice red circle. That's going to sit about like that. And I'm going to make this black real quick. So it's fading from red to black. I'm going to make sure that this black comes off the edges a little bit, so we just kind of get this nice glow right in the center. And there's a few different ways that we could go about putting this together. In this case, all I'm going to do is probably just plug this in. So instead of plugging the sort of horizon ramp into here, I'm going to plug it into this black slot on the sun shader. So plug that in here. So what we get is this nice red sort of dot that's right in the middle of this. And this one will get plugged in exactly where the other one was. So it's just chaining together these ramps in such a way that you get the result that you want. And, again, whenever we get to the actual scene, I'll be plugging in real colors that match a real sky a little bit better. But I just want to show off sort of the flexibility of this approach. So if we wanted a red sky or a red sun right in the middle of a green sky with a blue top, this is something that we could get away with. So if we zoom out real quick, you can actually see what this looks like. And we can change the scale and the size of this any way we want. But especially what we can do is we can rotate this around. So if I want my red sky to be on the other side, we can do that very easily. So I'm going to go back to my bookmark one more time and see how this changes the overall lighting scheme that we have. Keep this image and take a render. And now you can see that red glow coming in from exactly where you would expect it to. And this is essentially now a first bounce of indirect light for our scene. So if we've got a scene where we don't have a whole lot of artificial lights or direct sunlight, we need a way to create really plausible indirect lighting. And this is a really good way to do it. In our scene we're actually going to be working with sort of a sunrise or sunset. So this location is actually pretty good in terms of having a sky location. But if we wanted this sort of sphere, this circle to come up in the sky a little bit more, that's also fairly easy to do. All we really need to do is go to this circular ramp. And we can actually start to move this up in 3D space a little bit, or 2D space, as I might say. So if I go to my place 2D texture node, we can actually start translating the frame up and down in space. I'm going to go ahead and zoom in on this ramp, so we can really see what's going on. And we can start to move this in the U and V direction. [INAUDIBLE] move it in V, say, by 0.5. And you'll notice that that has now pushed that much higher up, probably too high. No, actually looking pretty good. Again we're going to get these little poles in here if we're not careful. So I'm going to start moving this back down to, say, 0.25. We can start to see that we're just moving that color value higher up in the sky. Again, I'm not too worried about accuracy. Ultimately, what I want to do is replace the sky color that we're getting inside of the render with, say, some custom image that I can [? posit ?] in later, or maybe a sky sphere or something. This is just to provide the color values for our lights. So if I go ahead and save this one more time, go back to my bookmark, and take another render, we can see that we're now getting that red light coming in from a higher angle than we were previously. So, again, whenever we're working with our final image, it's not going to be sort of this Technicolor sherbet color values. But you can see just how powerful we're working here. We've only got two lights, no colors inside of the lights, and we're using this skydome to provide those colors for the lights. So in this lesson we've gone through how to set up a custom IBL node for final gather lookup on portal lights. One more thing that I just realized, having gone on at length in the first lesson about gamma correction, I have neglected to gamma correct my sky, which will actually make a pretty big difference when it comes to seeing how these lights are contributing. So if I grab my ramp real quick and bring up Kludge, I actually have a tool in here that will greatly increase your ability to do gamma correction. The very first button on here under linear workflow is insert gamma node for selected. So if I have this ramp selected, I insert gamma node, essentially what this does is it puts in the gamma correct node with the correct settings. And you don't even have to think about it. So now this is getting plugged in with the correct gamma correction on top of it. And I can go ahead and take another render and see what we get and see how different it is. So, yeah, we're getting much richer, much deeper results using it this way. So if we actually change the intensity values on these lights inside of here, we'll actually be getting a much different result than we would have without using gamma correction. In the next lesson, we're going to start looking at ways to provide the rest of the ambient lighting for a scene like this.