Instead of relying on 3Delight's ray-tracing to render projected shadows, one have the option to use Shadow Maps. These can be generated manually or automatically by 3Delight. This is specified through the Shadow Maps groups of light attributes of The Render Settings. Among these attributes, there are two types of Shadow Maps that can be used: Standard (Depth) and Deep shadow maps. Here is an explanation of the advantages and disadvantages of each:
Standard (Depth) Shadow Maps
These are normal shadow maps that, historically, have been widely used in the industry. They have a number of advantages:
- They are fast to generate. Indeed, shadow maps can be generated much faster than a normal "color" image, mainly because only depth information is needed. When rendering a shadow map, one could remove all surface and light shaders, even displacement shaders can be removed if they do not affect the geometry too much. Also, filtering (using PixelFilter command) can be lowered (even to 1x1) and ShadingRate increased (up to 10 or more).
- They can be reused in more than one render. If the scene is static and only the camera moves, a generated shadow map can be used for all subsequent renders. This often happens in the lighting stage of a production pipeline.
- They can be used to generate low cost (approximate) penumbra. Specifying an appropriate value for the "Filter Size" attribute on the light shape, one can simulate penumbra effects. This attribute is located in the "Shadows > Depth Map Shadow Attributes" group. When a light has an associated RenderMan light shader, this is usually controlled by a "blur" attribute directly on that shader instead.
- They provide fairly good results when used carefully.
Now, the drawbacks:
- Self shadowing. This is the most common problem encountered when using shadow maps. It appears as dark artifacts in areas that should appear completely lit. This problem can be resolved by using an appropriate value for the light shape's shadow bias attribute, located in the "Shadows > Depth Map Shadow Attributes" group. When a light has an associated RenderMan light shader, the bias is set directly on that shader instead.
- Nearly impossible to generate high quality area shadows. Even if tweaking with shadow blur can give a nice penumbra effect, it is impossible to generate a true area shadow.
- Expensive to generate really sharp shadows. This is because high resolution shadow maps are needed which often leads to longer render times and memory/disk usage.
- No motion blur in shadows. Moving geometry still casts shadows. It is wise to remove motion blur when rendering shadow maps.
- No colored shadows. Translucent surfaces cast opaque shadows.
- Only objects that are in the shadow map cast shadows. That is why shadow maps work so well with spot lights: they light only a limited field of view. Point lights are more tricky to handle (need six shadow maps) and distant lights are difficult to setup with shadow maps. When creating shadow maps, make sure that shadow casting objects are framed correctly (and tightly) in the camera view that is used to render the shadow map. If objects are too far (small in shadow map view), precision problems may arise and high resolution shadow maps are needed. If objects are too close and parts of them are clipped, shadows might be missed. 3Delight supports the ‘midpoint’ algorithm for normal shadow maps. This should help to get rid of shadow bias problems in most cases. The 'midpoint' algorithm can be chosen for the Shadow Depth Filter attribute.
Deep Shadow Maps (DSM)
Deep shadow maps retain many of the features found in standard shadow maps and provide some more goodies:
- Translucent shadows. Translucent surfaces cast correct shadows.
- Shadows in participating media. It is possible to render volumetric shadows using DSMs.
- Supports mipmapping. DSMs are mipmapped, which means that they exhibit much less aliasing artifacts than normal shadow maps.
- Needs lower resolution. Instead of generating large shadow maps to boost quality, one can generate a smaller DSM by using higher PixelSample values when creating the DSM.
- Copes well with fine geometric details. Fine details such as hair and particles can be handled without increasing the shadow maps resolution too much.
- Since DSMs are prefiltered, render time lookups are faster (in general) than with normal shadow maps since the signal reconstruction step is more efficient. In addition, DSMs are more texture cache friendly than shadow maps.
- Easily included in a rendering pipeline that already uses shadow maps. No modifications are necessary in shaders when changing shadow map format (normal or deep). That is because light shaders are programmed using the
shadow()
instruction that works with both formats.
Before throwing DSMs into the production pipeline, consider the following facts:
- More expensive to compute. Generating good DSMs is generally slower than shadow maps. This is often the case when many PixelSamples are used during the generation step.
- Needs more disk space. DSMs can grow quite large, mainly for two reasons: 1) DSMs are mipmapped by default and 2) more data is stored per texel.
- Using the "midpoint" option to produce deep shadow maps can lead to unpredictable results!