From BlenderWiki

Jump to: navigation, search

Shadows

Light wouldn’t even exist without its counterpart: shadows. Shadows are a darkening of a portion of an object because light is being partially or totally blocked from illuminating the object. They add contrast and volume to a scene; there is nearly no places in the real world without shadows, so to get realistic renders, you will need them. Blender supports the following kind of shadows:

  1. Raytraced lamp shadows.
  2. Buffered lamp shadows.
  3. Ambient occlusion darkening.
  4. Radiosity.

Ambient occlusion really isn’t a shadow based on light per se, but based on geometry. However, it does mimic an effect where light is prevented from fully and uniformly illuminating an object, so it is mentioned here. Also, it is important to mention ambient lighting, since increasing Ambient decreases the effect of a shadow. In that same vein, radiosity casts light from one object onto another, and if radiosity is high, the shadow will not appear either.

You can use a combination of ray-traced and buffer shadows to achieve different results. Even within raytraced shadows, different lamps cast different patterns and intensities of shadow. Depending on how you arrange your lamps, one lamp may wipe out or override the shadow cast by another lamp.

Shadows is one of those trifectas in Blender, where multiple things have to be set up in different areas to get results:

  1. The lamp has to cast shadows (ability and direction).
  2. Opaque object has to block light on its way (position and layer).
  3. Another object’s material has to receive shadows (Shadow and TraShadow enabled).
  4. The render engine has to calculate shadows (Shadow for buffered shadows, Shadow and Ray for raytraced shadows).

For example, the simple Lamp, Area, and Sun light has the ability to cast ray shadows, but not buffer shadows. The Spot light can cast both, whereas the Hemi light does not cast any. If a Sun lamp is pointing sideways, it will not cast a shadow from a sphere above a plane onto the plane, since the light is not traveling that way. All lamps able to cast shadows share some common options, described here.

Just to give you more shadow options (and further confuse the issue), lamps and materials can be set to respectively only cast and receive shadows, and not light the diffuse/specular aspects of the object. Also, render layers can turn on/off the shadow pass, and their output may or may not contain shadow information…

Lamps: Raytraced Shadows

Mode: All modes

Panel: Shadow and Spot (Shading context, Lamp sub-context, F5)

Render panel.

Raytraced shadows produce very precise shadows with very low memory use, but at the cost of processing time. This type of shadowing is available to all lamp types except Hemi.

As opposed to buffered shadows, raytraced shadows are obtained by casting rays from a regular light source, uniformly and in all directions. The raytracer then records which pixel of the final image is hit by a ray light, and which is not. Those that are not are obviously obscured by a shadow.

Each light casts rays in a different way. For example, a Spot light casts rays uniformly in all directions within a cone. The Sun light casts rays from a infinitely distant point, with all rays parallel to the direction of the Sun light.

For each additional light added to the scene, with raytracing enabled, the rendering time increases. Raytraced shadows require more computation than buffered shadows but produce sharp shadow borders with very little memory resource usage.

To enable raytraced shadows, three actions are required:

  • Enable shadows globally from the Scene context (F10), Render sub-context, using the Shadow button on the Render panel – see (Render panel).
  • Enable raytracing globally from the same panel, using the Ray button.
  • Enable shadows for the light using the Ray Shadow button on the Shading context, Lamp sub-context, Shadow and Spot panel. This panel varies depending on the type of light.

All lamps able to cast raytraced shadows share some common options, described here.

Raytraced shadows can be cast by the following types of lamp:


Lamps: Buffered Shadows

Mode: All modes

Panel: Shadow and Spot (Shading context, Lamp sub-context, F5)

Render panel.

Buffered shadows provides fast rendered shadows at the expense of precision and/or quality. Buffered shadows also require more memory resources as compared to raytracing. Using buffered shadows depends on your requirements. If you are rendering animations or can’t wait hours to render a complex scene with soft shadows, buffer shadows are a good choice.

For a scanline renderer – and Blender’s built-in engine is, among other things, a scanline renderer –, shadows can be computed using a shadow buffer. This implies that an “image”, as seen from the spot lamp’s point of view is “rendered” and that the distance – in the image – for each point from the spot light is saved. Any point in the “rendered” image that is farther away than any of those points in the spot light’s image is then considered to be in shadow. The shadow buffer stores this image data.

To enable buffered shadows two actions are required:

  • Enable shadows globally from the Scene context (F10), Render sub-context, using the Shadow button on the Render panel – see (Render panel).
  • Enable shadows for the light using the Buf Shadow button on the Shading context, Lamp sub-context (F5), Shadow and Spot panel. This panel varies depending on the type of light.

The only lamp able to cast buffered shadows is the Spot lamp.