Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When rendering depth map shadows on directional lights you are going to find a few issues with the quality of the shadow map created by the light. I want to demonstrate that in this movie and also show you a new feature in Maya 2011 that can help you easily solve this problem. So, in this scene I have my tree and my ground plane, and I have a directional light. So, I am going to zoom in here so that we can see what the shadow looks like. I have the light selected and in the Attribute Editor, I have the LightShape tab.
I am going to activate Depth Map Shadows and scroll down to the mental ray section and Use mental ray shadow map overrides. So, in the Overrides, my Resolution is set to 2048 and my Sample is set to 64. So, when I do a render I should get a fairly decent-looking shadow, and this is where I get on the ground plane. So I am going to store that image, and now what I am going to do is there's a polygon plane here in the scene, and I am going to unhide it by only Shift+H, and we can see that the plane stretches off from the distance.
Now I am not going to make any other changes to the scene; all I did was make this plane visible. But I am going to create another render, and you'll immediately see what the issue is. Our shadow looks significantly worse. There is before the ground plane was visible - after the ground plane was visible. The reason that it looks so terrible is that a directional light is trying to create the shadow map based on all the geometry visible in the scene. In other words, before I made this plane visible, the shadow pap was just being created for the tree in this little hilly area right here, so a resolution of 2048 was sufficient for that.
But once I un-hid the plane, now the light is essentially trying to create the same resolution shadow, 2048 shadow, but cast it for all of the geometry in the scene, even though there is nothing casting shadows here in the background. So, in previous versions of Maya, there were a number of workarounds that you had to go through in order to improve the quality of the shadow in scenes where there is a large amount of geometry. In Maya 2011, there is a new attribute that allows you to easily solve this problem, and this is the Shadow Map Camera.
This feature only needs to be used with directional lights that are casting depth map shadows. That's the only time you need to turn this on. I am going to turn this on now, and basically what this does is it creates a camera from the point of view of the light and allows us to control how much of the scene is actually going to be seen by the light when it's casting the shadow. So if I just turn this on and create a render, we are going to see not much, actually. It'll look like our shadow, for the most part, disappeared. The reason is because the Aperture is set to 0.
So I am going to increase the Aperture. I am going to start with the setting of 4 and see what that gets us. So, now you can see part of the shadow is visible. So, if I look from the point of view of the light, this is how the light is viewing the scene. You can see the top of the tree here and the ground plane underneath. By increasing the Aperture, if you can imagine sort of a virtual circle right here, we are widening that circle by increasing this Aperture value, but just enough so we can get just the shadow that we need and nothing more.
So I am going to switch back to the Perspective view here, and I am going to set this up to 10 and create another render. Now, we can see most of the shadow. Just a little bit is being clipped off right here. So, I can just set this up to about 12 and do one more render, and I think we should be exactly what we need to be. When you're working with the Shadow Map Camera a good way to approach it is just basically increase the Aperture, do test renders until you get essentially the amount of shadow that you need and nothing more.
So, that works pretty well. Notice that the quality of the shadow is not that much worse than before we made the ground plane visible, but the Resolution is actually set to 512. So, this is being a bit more efficient than when the Resolution was set to 2048. Now the Camera Aspect determines the aspect ratio of the Shadow Map. For Maya, you shouldn't need to adjust this because Maya depth map shadows are square. So, an aspect ratio of 1 means 1-to -1, so it basically means a square- shaped depth map shadow.
So, you really shouldn't have to fool with the setting too much. The only two that you need to play with are the Camera Aperture and the Resolution. So, the main thing to remember is if you're going to use a directional light as a shadow-casting light in a scene, and if those shadows are going to be depth map shadows, and if the geometry in the scene is fairly large, you want to remember to turn on Use Shadow Map Camera, and then adjust the Resolution for the resolution of the shadow - it shouldn't have to be too high - and then use the Camera Aperture to determine exactly how much light you need to cast that shadow. So you can set this at a low setting, something like 4 or 5, and then just do test renders and slowly add to the Camera Aperture value until you have just enough to cast the shadow properly.
Get unlimited access to all courses for just $25/month.Become a member
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.