Skip to content
CoreSource checked

Whitted Ray Tracing

Traces primary, reflection, and refraction rays for sharp recursive lighting effects.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Intermediate
Family
Recursive Ray Tracing
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
3
Code example
Ready
Visualization
Ready

Overview

Whitted Ray Tracing recursively follows ideal reflection and refraction rays from visible surfaces, adding local lighting at each hit.

Core Concepts

primary rayreflection rayrefraction rayrecursive shading

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(pixels)

Average

O(pixels * rays * intersection cost)

Worst

O(pixels * rays * intersection cost)

Space

O(recursion depth)

When to Use

  • Use when sharp mirrors, glass, or shadows are the main visual features.
  • Use when mirror and glass rendering is a central requirement.

When Not to Use

  • Avoid when soft indirect lighting is more important than ideal reflections.
  • Avoid when the renderer cannot provide the buffers, samples, or lighting data the technique needs.

What It Does

  • Finds primary ray intersections
  • Spawns reflection and refraction rays
  • Combines local and recursive lighting

Use Cases

  • Mirror and glass rendering
  • Teaching recursive ray tracing
  • Offline image synthesis

Inputs

  • Scene geometry
  • Materials
  • Lights
  • Camera

Outputs

  • Rendered image

Key Formulas (1)

Reflection direction

r = d − 2 · dot(d, n) · n
r = d - 2 * dot(d, n) * n

Reflects an incoming ray direction around the surface normal.

Pseudocode

  1. 1.Cast a primary ray per pixel
  2. 2.Find the closest surface hit
  3. 3.Compute local lighting
  4. 4.Spawn reflection or refraction rays when materials require them
  5. 5.Combine recursive contributions up to a depth limit

Canonical Example

Input
scene = mirror sphere over plane
Output
image = reflected plane visible on sphere
Explanation
Recursive reflection rays add mirror detail to the primary surface hit.

Implementation Notes

  • Offset secondary ray origins slightly to avoid self-intersection artifacts.
  • Debug with simple geometry, known lights, and visualized intermediate buffers.
  • Keep a tiny example with expected output beside the implementation.

Common Pitfalls

  • Missing recursion depth limits can cause runaway ray trees.
  • Coordinate-space mismatches often cause artifacts that look like math errors.
  • Not defining boundary, empty, or degenerate inputs before implementation.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show a camera ray branching into reflection and refraction rays at a shiny surface.

Whitted Ray Tracing mechanism walkthrough step 1 of 5
Step 1 of 5: Cast a primary ray per pixel
rendering-pipeline

Notes

It handles sharp specular effects well but not full diffuse global illumination.

Sources (1)

What each reference supports for this entry.

Whitted 1980

Paper

Original recursive ray tracing paper for reflection, refraction, and shadows.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toPath Tracing

Whitted ray tracing handles ideal reflection/refraction rather than full stochastic light transport.

Variant ofRay Tracing

Whitted ray tracing is a recursive ray tracing variant.

Related Algorithms

Tags

GraphicsRay IntersectionLightingRecursion