12.4. Buffer Shadows

Relevant to Blender v2.31

The lighting schemes analysed up to now produce on the objects only areas which are more or less lit, but no cast- or self-shadowing, and a scene without proper shadowing looses depth and realism.

On the other hand, proper shadow calculation requires a full - and slow - ray tracer. For a scan liner, as Blender is, shadows can be computed using a shadow buffer for shadow casting lights. This implies that an 'image', as seen from the Spot Light itself, is 'rendered' and that the distance for each point from the spotlight saved. Any point of the rendered image further than any of those points is then considered to be in shadow.

The shadow buffer stores this data. To keep the algorithm compact, efficient and fast this shadow buffer has a size which is fixed from the beginning and which in Blender can be from 512x512 to 5120x5120. The higher value is the most accurate.

The user can control the algorithm via the bottom buttons in the Spot Panel (Figure 12-16).

Figure 12-16. Spot Light shadow buttons.

ShadowBuffSize - Numeric Button, from 512 to 5120, defining the shadow buffer size.

ClipSta, ClipEnd - To further enhance efficiency the shadow computations are actually performed only in a predefined range of distances from the spot position. This range goes from ClipSta, nearer to the Spot light, to ClipEnd, further away (Figure 12-12). All objects nearer than ClipSta from the Spot light are never checked for shadows, and are always lit. Objects further than ClipEnd are never checked for light and are always in shadow. To have a realistic shadow ClipSta must be less than the smallest distance between any relevant object of the scene and the spot, and ClipEnd larger than the largest distance. For the best use of the allocated memory and better shadow quality, ClipSta must be as large as possible and ClipEnd as small as possible. This minimizes the volume where shadows will be computed.

Samples - To obtain soft shadows the shadow buffer, once computed, is rendered via its own anti-aliasing algorithm which works by averaging the shadow value over a square of a side of a given number of pixels. Samples is the number of pixels. Its default is 3, that is a 3x3 square. Higher values give better anti-aliasing, and a slower computation time.

Bias - Is the bias used in computing the shadows, again the higher the better, and the slower.

Soft - Controls the softness of the shadow boundary. The higher the value, the softer and more extended the shadow boundaries will be. Commonly it should be assigned a value which ranges from the same value of the Sample NumButton to double that value.

Halo step - The stepping of the halo sampling for volumetric shadows when volumetric light is on. This will be explained in Section 12.5.

Figure 12-17. Spot Light shadow examples.


For Shadows to be rendered, they must be enabled at a global level. This means that the Shadow Button of the Render Panel in the Scene Context and Render Buttons must be on!