Render cast shadows in an alpha channel with 3ds Max.
- [Instructor] In rendering, it's very common that you will want to render the shadows separately from the rest of the scene. And in this case, I want to do that to optimize render times for animation. I've got a simple animation here of a flying saucer flying over this desert mesa. I can press Play Animation, and you can see in the physical camera that we've got our little saucer flying by. It's casting a shadow onto the ground. We can visualize that by positioning the timeline at about frame 130 or so, and in the physical camera viewport, we can switch the rendering mode over from Standard to High Quality.
And although it looks overexposed, we can see that there is a shadow cast onto the ground. I want to render that shadow out separately, because if I were to render this out just as it is, I would be rendering the same information 180 times. So I can just render a still image of this background and render a sequence of the shadow. So let's take a look at what this looks like just now without any special treatment. With the timeline parked on frame 130, I'll do a production rendering of the physical camera.
So here's the rendering with this shadow in place, and you can see that we don't have a background here, although it is showing up in the reflections of the saucer, and I did that through the environment settings in the Arnold renderer. If you want to learn how to do that, you can check that out in another course, which is 3ds Max: Rendering with Arnold. Okay, so that's a baseline of what we want our shadow to look like. I'll close the rendered frame window, and now we'll apply a material onto this ground plane to capture the shadows.
Go into the material editor, and we want a map, in fact. And that's going to be found in the Material Map Browser here under Maps, Arnold, Surface, Shadow Matte. Drag that over into the view. Now, that's a map, and in 3ds Max, we cannot apply a map directly onto the surface of an object. A map can only modulate or change a certain material property.
We can assign a material, but we can't assign a map. But Arnold gives us a handy utility material which will convert a map to a material. Very helpful. So up here in Materials, Arnold, Utility, we have Map to Material. Drag that over into the view as well. And connect the output of the shadow matte map to the texture map input of the Map to Material material.
And so that we don't get too confused, let's rename these. Double-click on the material, and I'll call it Matte Material. And with the map over here, let's double-click on that too and call that Matte Map. Okay, now let's assign the material to the object. Click and drag from the output of the material node onto the terrain object.
And we can now close the material editor. We don't need to change any of these parameters. Let's do a rendering of what that looks like. Click on Render Production once again. Here's the rendering with the shadow matte map piped through a map to material node, and we don't see anything here because the shadows are actually stored in the alpha channel. In the rendered frame window, we can visualize the alpha channel or transparency.
Click on Display Alpha Channel, and what we see here is the shadows and the dark areas of shadows are represented by white areas of the alpha channel. And when we composite this, what will happen is the black pixels stored in the RGB channels will be made opaque. So this area will actually be black. Now we see that there's also some ambient shadows everywhere. And that's coming from my lighting.
I've actually got a sky dome in this scene, and that's great, but it's not what we want in this case. We want just this one shadow and nothing else. Okay, so I'll close the rendered frame window, and in the top view, here's the Arnold light that is the sky dome. Select that, go over to the Modify panel, and just turn that light off. So with that turned off, the shadows that we will see will be only from this Arnold distant light or directional light.
So go back over to our camera view and do another production rendering and see what that looks like. Okay, the RGB pixels in the foreground here are still black. Notice that the saucer has changed here because it's not receiving any sky dome illumination or reflections. Let's check out the alpha channel. Click on Display Alpha Channel. And we're in better shape here now, we're not getting the shadows from the sky dome. We're getting the direct shadow from the saucer, but we're also seeing some stuff that we don't want to see.
We're seeing self-shadowing on the ground here. Well, I've rendered out the ground as a still image with the shadows baked into it, so we don't need nor do we want this. We only want a rendered sequence of just that shadow and nothing else. And you can see also that the alpha channel for the saucer is showing up here. So we want to turn that off too. So let's deal with the saucer first. I'll select it and, in its Modify panel, we want to add an Arnold properties modifier.
Go to the modifier list and choose Arnold Properties. And open up General Properties. Enable the Visibility section. And once that's turned on, we can turn off all the options under Visibility. What will happen now is the saucer will still be able to cast shadows, but it will not be visible in the rendering. And we also want to add an Arnold properties modifier to the ground plane.
So select that terrain object, go to its modifier list, add the Arnold Properties modifier, and in here we want to enable the Shadows section and we don't want it to cast shadows, so turn that off. And we do want it to receive shadows from the saucer, but we don't want it to shadow itself. Okay, so now we've got this all set up so that when we do a production rendering all we'll see is the shadow of the flying saucer and nothing else.
So click Render Production. Once that rendering has completed, we can see that with the RGB channels visible we've got solid black, but if we go to the alpha channel, boom, that's exactly what we need to see. These shadows are rendering as white in the alpha channel, which means those pixels will be opaque, and all of this area here will be transparent. So in our final comp, we will get a little splash of black.
Okay, so I've got that basically set up in After Effects already, so I'm going to jump over to After Effects, minimizing 3ds Max. And it's all set up here. This is not an After Effects or compositing course, so we really don't have time to cover the entire workflow here, but you can see we've got a background layer and that of course is the sky. That's a still image, and I only needed to render it once. Also I've got a foreground layer.
Nail that's visibility, turn that on and off. And again, that's a still image. I only had to render it once. I've got a sequence for the flying saucer. As we scrub through the timeline, we can see that the saucer is moving, 'cause that's an image sequence. And I've also prepared an image sequence of the shadow itself, so let's bring that in over in the Project window. I'll right-click and choose Import, File. And in the exercise files for the course, I've got a folder for Render Output, Arnold Shadow Matte, and then there's a sequence inside there and it's in a folder labeled Shadow.
I'll just click the first image in the sequence and click Import, and that's coming in at 30 frames per second. And it's a PNG document, and it's being interpreted correctly as having straight alpha. I just want to rewind back to the beginning of the timeline and then drag that shadow matte PNG sequence into the composition. We want it to be placed on top of the foreground.
And we can scrub our timeline. And there's our shadow. And once again, rendering that shadow alone saved me a lot of render time. If I had rendered this entire thing as a single composition instead of separately, then it would have taken, you know, maybe 100 times longer to render. Right, well, there's one last thing here. We can see that that's too dark, so we can go into the Shadow Matte layer, open that up, and under Transform, we have Opacity, let's just knock that opacity down to a value of 30.
Maybe we'll make it 40. Okay, so there's our shadow matte. And once again that really improved our render times and brought that down by maybe even a couple orders of magnitude. And here's the final rendered composition with the shadows rendered separately using the Arnold shadow matte.
Skill Level Intermediate
Q: Why can't I earn a Certificate of Completion for this course?
A: We publish a new tutorial or tutorials for this course on a regular basis. We are unable to offer a Certificate of Completion because it is an ever-evolving course that is not designed to be completed. Check back often for new movies.