Real-Time Light

One buffer at a time — every shortcut the rendering equation lets you take at 60 frames per second.

FIVE CHAPTERS LATER  ·  DEFERRED PBR + IBL + MSM + SSAO + SSDO  ·  60 FPS

The path tracer was about correctness through brute force: shoot enough rays, average enough samples, the right answer falls out eventually. The deferred renderer is its inverse — cheat the rendering equation in clever ways so the right answer falls out at sixty frames per second.

The G-buffer comes first: every fragment writes its position, normal, albedo, and material into screen-space textures so lighting can be computed once per pixel, not once per pixel per light. Shadows arrive as a depth test from the light's point of view, then progressively softened — binary, percentage-closer-filtered, variance-, and finally moment-based — until the penumbras look right. Image-based lighting replaces the analytic light with an HDR environment, pre-filtered offline so a glossy surface can sample roughness-correct reflections at one texture lookup per pixel. Ambient occlusion is added back where the geometry never was — the small darknesses inside corners that direct lighting can't reach. And finally a single indirect bounce, also in screen space, lets one surface tint another by reflected light without ever leaving the current frame's depth buffer.

Every chapter is a different approximation of the same integral the path tracer evaluated honestly. The art of the real-time renderer is knowing which approximations the eye will accept, and where they break.

CHAPTERS

  1. 01

    The G-Buffer

    — Deferred Shading

    Where geometry and lighting are decoupled into two passes — so the renderer can pay for one BRDF evaluation per pixel, no matter how many lights are in the scene.

    G-Buffer Cook-Torrance BRDF Multi-light PBR OpenGL
  2. 02

    From the Light's Point of View

    — Shadow Mapping

    Where the rasterizer is asked to answer the same question the path tracer answered with shadow rays — and four progressively softer ways to answer it.

    Shadow Mapping PCF Variance Shadow Maps Moment Shadow Maps
  3. 03

    Light, Pre-Filtered

    — PBS + IBL

    Where the analytic light is retired — the sky itself becomes the light source, projected to nine numbers for diffuse and importance-sampled at runtime for specular.

    Spherical Harmonics GGX Importance Sampling Hammersley Sequence HDR Tone Mapping
  4. 04

    Where Corners Stay Dark

    — Screen-Space Ambient Occlusion

    Where the small darknesses inside corners — the ones IBL flattens out — are added back, by sampling the screen-space neighborhood of every pixel.

    Alchemy SSAO Bilateral Filter Spiral Sampling Edge-Aware Blur
  5. 05

    Light Bounces Once

    — Screen-Space Directional Occlusion

    Where occlusion gains a direction — every blocked sample becomes the color of the light it interrupted, and every blocker becomes a secondary emitter that bleeds its tint onto its neighbors.

    SSDO One-Bounce GI Hemisphere Sampling Screen-Space Visibility