Skip to content
Part IA Michaelmas Term

Shadow Rays

What are Shadow Rays?

After finding an intersection, shadow rays determine whether the point is illuminated by each light source.

Pshadow=Phit+ϵLto_light\mathbf{P}_{\text{shadow}} = \mathbf{P}_{\text{hit}} + \epsilon \mathbf{L}_{\text{to\_light}}

where ϵ\epsilon is a small offset to avoid self-intersection with the surface.

Shadow Ray Algorithm

FOR each light source
    cast shadow ray from hit point towards light
    IF shadow ray intersects any object before reaching light
        point is in shadow for this light
    ELSE
        point is illuminated by this light
END FOR

Hard Shadows

A point is either:

  • Fully illuminated: Shadow ray reaches light unblocked
  • Fully in shadow: Shadow ray blocked by an object

This produces sharp shadow boundaries.

Shadow ray from intersection point to light source, blocked by another object

Soft Shadows

Area light sources create penumbrae (partial shadows):

  • Multiple shadow rays distributed over the light surface
  • Average the visibility results
  • Partially blocked points receive partial illumination

Soft shadow from area light source vs hard shadow from point light

Colour in Shadow

If a point is in shadow for a light source:

  • The diffuse and specular components for that light are zero
  • Only ambient illumination contributes

For multiple lights, shadows are computed per-light:

  • A point may be illuminated by some lights but shadowed from others

Self-Intersection Problem

A shadow ray starting exactly on the surface may hit the same surface due to floating-point precision:

  • Solution: Offset the ray origin by a small ϵ\epsilon along the surface normal

Summary

  • Shadow rays determine if intersection points are illuminated
  • Hard shadows use one ray per light (sharp edges)
  • Soft shadows use multiple rays over area lights (penumbra)
  • Points in shadow only receive ambient illumination

Past Paper Questions

2025 Paper 3 Question 3(c): Explain shadow rays. What is the colour of a pixel if it is in shadow? [3 marks]