Short Contents

7.2 Shadows

3Delight has an extensive support of shadow rendering methods. It is up to you to choose the algorithm that suits you best.

7.2.1 Raytraced Shadows

Tracing shadow rays is an easy way for rendering shadows that requires very little setup. This technique has the advantage of being convenient and efficient in the case of complex scenes. Ray traced shadows are further described in Ray Traced Shadows.

7.2.2 Standard Shadow Maps

These are normal shadow maps that are widely used in the industry. Generating such shadow maps implies placing the camera at the position of the light source and rendering the scene from that view point (`zfile' or `shadowmap' display driver has to be selected, see The zfile display driver and The shadowmap display driver for information about file formats used and options). The shadow map is then used from inside a light source shader to cast shadows on objects. Shadow maps have a number of advantages:

Now, the drawbacks:

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' (Options) algorithm for normal shadow maps. This should help to get rid of shadow bias problems in most cases.

7.2.3 Deep Shadow Maps

Deep shadow maps retain many of the features found in normal shadow maps and provide some more goodies:

Before throwing DSMs into the production pipeline, consider the following facts:

Using the "midpoint" option to produce deep shadow maps can lead to unpredictable results!

For deep shadow map creation please refer to The DSM display driver.

7.2.4 Aggregated Shadow Maps

Aggregated shadow maps are a collection of standard shadow maps concatenated into one single file. A good example of the usefullness of this feature is to generate shadow maps for point light sources, in which case six shadow maps are needed per light source (one for each cordinal direction). In this case, having six shadow maps to deal with creates at least two "problems":

  1. Pipeline wise, managing six shadow maps is more complicated than managing just one.
  2. Shaders (most commonly light source shaders) need to accept six shadow map string parameters, which is tedious.

The aggregation operation is performed by passing the aggregate parameter to the shadowmap display driver, as explained in The shadowmap display driver. For example, to aggregate a shadow map to the already existing `shadow_point.shd' file, one would issue:

Display "shadow_point.shd" "shadowmap" "z" "integer aggregate" [1]

There is no limit on the number of shadow maps that can be aggregated together and the resulting shadow map can be queried from inside shaders using a single shadow() call. The resulting operation of this single call is the accumulation of the opacities of all shadow maps present in the agregated file. Parameters passed to shadow(), such as `blur' and `samples', will be used on all the shadow maps in the aggregated file.

Note

Aggregated shadow maps do not need to be rendered from the same point of view, as in the point light example.

3Delight 10.0. Copyright 2000-2011 The 3Delight Team. All Rights Reserved.