Important Notice:

As of September 15, we will no longer publish new courses on We encourage you to begin learning on Pluralsight where you have access to 5,000+ courses and can take advantage of new platform features that measure your skills and make learning a breeze.
How to render alpha channels in a luminance depth render layer
See Details
Hi, my name is Dan. And I'm one of the DT evangelists here at Digital-Tutors. In this video, we're going to look at a question from one of our users on how to set up a technique for rendering a luminance depth render layer with alpha channels. So here to illustrate this I have a simple scene set up here. So if I were to just do a quick render. And let's pull this over-- it kind of rendered off screen here. So basically, what we can see is I have a plane set up here. And I have a file texture on that plane that has a transparency map on there. So we can see that there's some objects behind it. If I were to, say, hop into my top view, we can see basically I have my plane that has the transparency map on it. And then I have a couple objects that are behind there that we'll want to look at. If we look in the Hypershade real quick, we just see basically on this plane here-- if I were to select that-- we can see that I just basically have a simple file texture that's being piped into the transparency. So let's set up a luminance depth render layer for this scene. So I'm going to come into my render layers here. And just to make sure that I get everything, I'm going to go ahead and just copy this master layer by right clicking and going to Copy Layer. Let's rename this, maybe something like luminance depth render layer. And once we have that created, we can go into Layers, Attributes, and then apply the luminance depth preset. So once we have that set up, let's go ahead and open up our Render View here. Now when we render this out, there's a couple things that we'll notice. The first thing is that we lost our alpha channel, and we're no longer able to see the objects behind the plane. The other issue is actually that our luminance depth is all white. And this is a common issue that I've come across in my projects. And it's pretty easy to fix. So let's come in and fix that first. So basically the luminance depth preset is going to set up a shading network here. If we were to look at the shading network that gets set up, it's a surface shader with a set range node, a multiply divide node, and the sample info node in order to actually create our luminance depth shader. Now, here on this Set Range Node, there's actually a plug-in that determines the distance from the camera in order to actually determine the gray scale values for the shader. But I found that this doesn't really work that well. So very often I have to come in and actually break the connection and then come in and manually input the minimum and maximum values. Now, the actual values that you put in here are going to depend on your scene size. But usually, I find a good place to start off is by coming in and typing in something like 0.1 and 100. So let's start off with that and see how that looks when we render it out. Open up my render view. Save that off. And when we re-render, we can see we're getting a nice depth later here like we would expect-- so much better than before. So the next issue that we want to fix is the issue that we're not able to see our objects through this plane with the transparency map on there. So basically, what we're going to want to do is to apply another shader to this plane and apply the alpha channel-- or the transparency map that we have into that shader. So let's come in and create something like a Lambert here. Pull in new material. You can see we have this Lambert. Now, if we were to try to select our plane and apply that, it's not really going to let us do that. So if I try to render this out again, it's going to look exactly the same as before. Now the reason for that is this luminance depth preset is actually setting a material override. So everything on this layer is going to be using the surface shader that was created. So let's come in and break that layer override so that we can apply another shader to just this plane and then keep this surface shader on the rest of our objects. So I'll right click, go to Overrides, and remove the material override. And once we have that removed, we'll actually need to come in and reapply our surface shader to everything in our scene. So we can come into our Outliner. Select everything. And hop back to the Hypershade. And right click and apply the surface shader to the selection. So what we should see when we render this out is that there's absolutely no change. And as we can see there is no change. But the difference now is that we can come in and apply a different material to this plane. So I'm going to apply this Lambert material here. So we have that applied. And when we render that out we can see that that plane actually does have a different material. If we look at the alpha channel, it's rendering out. It's just completely black. We don't actually have any lights or anything like that set up in our scene. And that's OK, because for this depth layer, we don't really need any lights in there. So what do we want to do with this Lambert now that we have that applied? Well, let's come in, and actually I'm going to select both the surface shader as well as the Lambert, and look at the connections for both of those, so that we can come in and basically take this same shading network and plug that into our Lambert. So I'm going to come in. And I'll hold down Shift and middle click and drag the set range into the Lambert. That'll open up our Connection Editor. So if we take a look at how these set range is plugged into the surface shader-- if we hover over the little connection here, we can see that the out value x is plugged into the out color RGB. So let's plug in the out value of x and plug that into the color of our Lambert. OK, so we have that connected. And let's go ahead and render this out. We can see that not a whole lot has changed. And the reason for that is actually because this Lambert here still has some shading on it, which is what differentiates it from the surface shader. So if I come in and double click on the Lambert, I can bump the ambient color all the way up. And that almost basically makes it a lot like a surface shader would act. However, I found that this technique really doesn't work too well with a surface shader, which is why I'm using a Lambert instead of a surface shader just because of the way the surface shader handles the transparency. So let's bump the ambient color all the way up and go ahead and render this out. As we can see, basically we're back to having the depth as we would expect. But we're still on having the alpha. So now that we have all of this set up, we're finally ready to actually plug in the transparency map. So let's come in. I'm going to select the color that we had on this plane, and also select my Lambert, and pull both of those up in my hypershade here to make it a little bit easier to see. Here we go. So we have our transparency map. Let's plug that into our Lambert. So I'll just middle click the file and drag that into transparency. And now what we should have when we render this out is that we get our luminance depth render layer. But we're also able to see all of the objects behind that due to the transparency map. So let's go ahead and render this out. And as we can see, we're getting our transparency map that's being included within our luminance depth. So we're able to see the plane down here on the bottom, as well as these sphere in the background. So that's one technique that we can use in order to get an alpha channel to work within our luminance depth render layer. Now, if you want to learn some more great rendering tips, check out the mental ray tips and tricks course.
Each video in this course is a self-contained lesson focused on answering questions that Digital-Tutors customers have had as they learn rendering in Maya.