ART 488 - Depth Map Shadows


This page is designed as a supplement to lectures. It is not intended to be a stand alone tutorial.


Depth Map or Ray Cast Shadows

Depth Map Shadows are easy to create and quick to render. However, their default quality is low. Directional, Spot, Point, and Volume Lights can all create a depth map shadow. In this process, a depth map (or Z map) image is created for the light and from the light's point of view. Using this information, the renderer is able to determine where shadows are cast. Usually this Z-depth information is not stored. It is discarded when the frame is finished rendering. At the beginning of the next frame, a new calculation is made. This allows for shadows to change as objects move, change shape, or as lights move.There are times when it is helpful to save out the Z-depth information permanently as a file.
    1. If no objects that either cast or receive the shadow are moving in the scene, and the light is also stationary, then you can then have the renderer only have to make the calculation once and then reuse it. This can save rendering time. A good example of this is for a fly-through of a stationary scene. Another example is if lights in your scene are linked to specific objects. You could set up a scene where objects and shadows that don't move are linked to a specific light. This light's Dmap would be saved. Other lights that illuminate a moving object would re-calculate each time.
    2. If you want/need to see how your depth map shadows are working and perhaps to problem solve their looks.

Saving Depth Map Shadows

Select the Light and turn on "Use Depth Map Shadows"

Under "Disk Based Dmaps" you can select either "Reuse Disk Maps" or "Overwrite Disk Maps". Either of these options will save an image out (actually it will save out two slightly different images). These images are Maya IFF files and are saved in the renderData/depth directory of your current project.

Viewing them requires fCheck. At first you will not see them. You will have to toggle on Zdepth by either hitting the "z" key or clicking the "Z" toggle in the menu bar. You cannot view these in other programs, but you can save them out from Fcheck if you want.


Understanding Depth Maps

Dmaps are created with a specific pixel size. The default is 512 x 512. Many times this is so low that you can see artifacts and thus need to increase the resolution. This however, increases rendering times.

Dmaps are created, by default, with sharp or defined edges. Softening the edges is accomplished by adjusting the "Filter Size". Many times, this is the only adjustment you need to make.

 

This is a directional light with a default Depth Map Shadow. You can see the artifacts given by the low resolution of 512.

If you wanted soft shadows, you could increase the "Filter Size" and probably remove the artifacts. If you want sharp hard shadows you would have to increase the resolution of the map dramatically.

This is the Dmap that was created for the above render. Note that the directional light is required to cover the whole plane. With a resolution of just 512 across the whole scene there is not enough pixels to sample accurately the shadow edge.

Large ground planes can quietly and quickly start sucking up huge amounts of render time unless you pay attention.

This is the exact same scene, but the directional light was been replaced with a spot light with the default Dmap shadow settings. The light has been aimed to only illuminate the foreground sculpture. Note that the shadows have very little aliasing.

This is the Dmap for the above image. Note that the image only covers the area that the spotlight is illuminating. Thus, the default resolution of 512 provides enough samples across this smaller area to have the shadows more define.

 


Using Depth Map Shadows

Here are some quick hints on a basic level for working with Dmap Shadows:

  1. A crisp edge requires high Resolution and low Filter Size
  2. A soft edge requires low Resolution and high Filter Size
  3. You can select higher values for Filter Size than 5
  4. Directional Lights and large ground planes that recede into the distance are not a good match
  5. Intelligent Light Linking could save some render time
  6. Turn shadows off for objects that you don't need to them for.
  7. Reusing Dmaps can save time, but only when shadows don't move.