How to Build an AAA-Quality Lighting Pipeline in Three.js

I spent the last few months trying to make a web page light the way a AAA console game does. It started as a curiosity — could the browser really render an indoor scene the way Frostbite or the Unreal Engine handle a cramped corridor, with light bouncing off two walls and wrapping around a corner? — and it turned into a deep dive into what the modern browser can actually do. The short answer is: closer than most people think. The long answer is a pipeline.

The browser’s 3D story used to be “good enough for a spinning cube.” That is over. three.js now ships a WebGPU renderer, and WebGPU runs on most devices. For the first time, you can light an indoor scene the way a AAA game does — and the machinery underneath is a pipeline, not a single call. This article is my walkthrough of that pipeline: what the games require, what three.js has now, and what is still missing. It follows the series Quest for AAA Quality in Three.js by Ben Houston, published November 9, 2026, and it reads like a tutorial you can actually run.

Why WebGPU changed the game

Before WebGPU, three.js rendered forward. Every pixel was shaded as it was drawn, and effects like screen-space reflections, ambient occlusion, and denoising ran as post-processing passes over the finished image. That works, but it is the difference between a shop drawing and a finished building: you can get the look, but you cannot light the way a AAA engine does.

WebGPU changes the contract. It gives you compute shaders, multiple render targets, and a renderer built for it inside three.js. The setup fills three caches — lightmaps for static meshes, a light probe grid for moving objects, and reflection probes for each room — and every frame reads those caches while adding screen-space work on top. Ben describes it as a cascade: each source returns a colour and a coverage from zero to one, and the next source fills in the rest. That is the same architecture real-time giants have used for years.

For the first time, a web page can do what the console does. The entry point is the new WebGPU renderer, which already renders a G-buffer prepass with multiple render targets — the same building block the SSR examples use today.

Five terms you will hear everywhere

Before you touch the code, five terms come up constantly. Memorise these and the pipeline stops being magic.

  • BRDF — the material’s shading function: how a surface turns incoming light into the light you see.
  • G-buffer — per-pixel images of what is visible (depth, normal, roughness) that screen-space effects read.
  • PMREM — an environment map pre-blurred for every roughness level, the way three.js lights from a cubemap.
  • TRAA — temporal anti-aliasing; each frame is blended with reprojected frames before it.
  • TAAU — TAA with upscaling; the scene renders below output resolution, history kept at output.

These are the vocabulary of the series. Once you know them, the stage-by-stage breakdown below reads like a specification instead of a list of features.

The pipeline, stage by stage

The pipeline has two parts: the setup, which fills the three caches, and the per-frame pass, which reads them and adds screen-space effects. Here is what the games need, what three.js has today, and what is still missing.

The G-buffer

SSR, GTAO and the denoisers all run in screen space before lighting, so they need per-pixel depth, normals, roughness, metalness and motion vectors. A deferred engine also stores base colour and emissive; three.js renders forward, so its beauty pass reads those from the material. The G-buffer fits in 16 bytes per pixel.

WebGPURenderer already renders a G-buffer prepass with multiple render targets, and the SSR examples use it today. What is missing is normal precision. SSR is unforgiving of normal error — a ray reflected off a slightly wrong normal lands somewhere visibly wrong at the end of a long trace. RGB8 normals snap curved surfaces to a limited set of directions, and reflections show banding and clumping. AAA G-buffers fold the sphere of directions onto an octahedron, unfold it into a square, and store two coordinates. It is a small change with a large quality effect.

Global illumination

Baked GI is the first cache. Static meshes get a lightmap, which is the colour and attenuation of light that has bounced around a closed scene, baked into the texture. The tools in this space include a lightmap unwrapper, a baker, ray radiosity, a denoiser, and HDR JPEG XL as an output format.

Dynamic GI is the second. three.js already has a LightProbeGrid, and the series notes an 8× faster bake path, multi-bounce bounces, and updates spread across frames so a moving object does not freeze the frame. What is missing: seam stitching between lightmap tiles, a draft KHR_lightmap extension, glTF JPEG XL and UltraHDR extensions, and runtime BC6H for lightmaps.

Ambient and specular occlusion

Occlusion darkens corners and crevices where light cannot reach. three.js has GTAO, a builtinAOContext, and AO from SSGINode. The series lists bent normals and GTSO as a draft, and joint bilateral upsample as a draft too. Bent normals from SSGINode are still outstanding.

Screen-space reflections

SSR reflects the world that is on screen. The current approach is stochastic GGX SSR, with temporal accumulation and multi-bounce. Missing: Hi-Z tracing, previous-frame tracing, radiance and coverage output, coverage inside the denoiser, ray reuse, two-lookup history, and skipping mirrors and matte pixels. Each gap is a specific, testable item — not a “better reflections” wish.

Screen-space global illumination

SSGI returns bounced light from the screen. three.js has SSGINode, with bounce light and AO coming from one horizon search, composited over the finished image. Missing: previous-frame tracing, coverage output, and a diffuse source for the BRDF.

Reflection probes

A reflection probe is a small box around a room that supplies the environment the shiny surfaces reflect. three.js currently offers a single box-projected environment map with PMREM. Missing: a probe system, cube arrays, probe normalisation, and 128² prefiltering.

BRDF integration

This is the piece that ties everything together. AO context and environment fallback are in; pluggable indirect specular and diffuse, and a coverage cascade, are the open items. The series calls this the biggest remaining gap: it is the pluggable indirect lighting that ties the two cascade halves into the BRDF.

TRAA and TAAU

Temporal anti-aliasing and its upscaled sibling are now nodes in three.js. Missing: Catmull-Rom history, a wider clip at rest, and a test harness. These are draft items, not promised features.

The series sums it up cleanly: the biggest remaining gaps are SSR, SSGI and BRDF. Hi-Z tracing and coverage for SSR, the same coverage for SSGI, and above all the pluggable indirect lighting that ties both cascades into the BRDF.

What this means for your own projects

You do not need to build all of this to lift your scenes. The practical takeaway is a mental model: separate your caches from your per-frame work, cache what is static, and offload the screen-space pass to the frame loop. It is a chess-like division of labour — How to Run Open-Source AI Models Locally with Ollama.

It also explains why the “one render call” days are over. How to Build an AI Agent with Python: A Step-by-Step Guide. If you are building a web game or an interactive scene, The AI Graveyard: What Dying AI Startups Are Trying to Teach Us, not in a desktop browser. WebGL 2 still covers most of what you need today; WebGPU is the future, and the renderer is ready.

The good news: the barrier to entry is dropping. three.js maintainer Michael Herzog has reviewed most of these PRs, and more than once reworked one into a better design that fits how the library is built. mrdoob has expressed strong support for many of them. The infrastructure is being assembled in the open, and the pieces you read about here are visible in the GitHub repository right now.

So the next time you see a web page with light that behaves like a game, remember: it is not a trick. It is a pipeline. And the pieces are finally available for you to build with.

Three.js code example on a screen
Image: Three.js Authors via Wikimedia Commons (CC BY-SA 3.0)


Filed under Tech & Gadgets
Last Update: November 17, 2026 by Felix AlterEgo
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Newest
Oldest Most Voted