Reflections, explained: probe, screen space, ray tracing

A real-time renderer has three ways to answer "what does this shiny pixel reflect?", and engines mix them. This page puts all of them in one room so you can see where each one is right and where it breaks, on this package's own pipeline: Reflections with a baked probe, the screen-space tracer, the ray-traced fallback and the denoiser. Step through the situations below: each one sets up the camera and names the two methods worth comparing. Switch between them under the image; drag the view to look around.

Pick a situation

Compare
Show

Reflections from

Reflection denoiser

Hybrid roughness cutoff

rougher than this: probe only, no rays

Floor gloss

roughness of the floor and the table top

Camera

Sculpture

The question every method answers

For each pixel, the renderer knows the surface: where it is, which way it faces, how rough it is. A mirror reflects one exact direction. A rough surface reflects a spread of directions around it (the "lobe"), which is why rough reflections are blurry. So the question is always: what light comes from those directions?

The noisy methods here answer it the way a path tracer would: pick one random direction in the lobe per pixel per frame, find what is there, and let a denoiser (FFX's reflection denoiser, from denoiser/ffx) average neighbouring pixels and previous frames into a clean image. Switch the denoiser to "raw" to see that one sample. Every mode below uses the same random directions; they differ only in how they find what is in that direction.

How each method works

Reflection probe

chair camera probe chair ignored:looks up the wall

Photograph the room once, in all six directions, from one point (a cubemap). Pre-blur copies of it for each roughness. At draw time, look up the reflected direction. Box projection first works out where that ray would hit the room's walls, so walls line up. Here: ReflectionProbes, baked once, every material sampling it through reflectionProbes(probes).

good
No noise, no rays, almost free per frame. Perfect for rough surfaces.
bad
A snapshot: moving things freeze. Everything is treated as if painted on the walls, so objects inside the room reflect in the wrong place, and light leaks where it should be dark.
cost
A bake: six renders and a prefilter per probe, on demand. Then a texture lookup per pixel.

Screen-space reflections

top of the screen lamp left the screen

The frame being rendered already has the colour and depth of every visible surface. Walk along the reflected ray in screen space and stop where it passes behind a surface in the depth buffer: that pixel's colour is the reflection. This package's tracer is a port of AMD's FidelityFX SSSR: it steps through a depth pyramid, so long rays take few steps.

good
Exact and live for anything on screen, including moving objects. Cost doesn't depend on how big the scene is.
bad
Knows nothing that isn't on screen: off the edges, behind the camera, behind other objects, the back of things. Those need a fallback (here, the probe or a ray).
cost
A fixed amount per pixel (a few dozen depth reads), plus a denoiser.

Ray tracing

BVH boxes

Shoot a real ray into the scene's triangles. A BVH (a tree of boxes around the geometry, built by @pmndrs/bvh and walked by @pmndrs/raytracer) lets it skip everything the ray can't hit. At the hit, shade the surface cheaply: its colour, roughness and metalness from a per-triangle table, lit by the probe at the hit.

good
Right almost everywhere: off screen, behind the camera, hidden surfaces, moving objects.
bad
Noisy on rough surfaces. The BVH must be kept up to date when things move (reflections.trace.refit()). Shading at the hit is simplified (no textures, no second bounce).
cost
Grows with triangle count and how many rays you shoot. Small in this room; much more in a big game level.

Hybrid

rough rug probe, no ray SSR SSR left thescreen: trace

Use each method where it's good. Rougher than a cutoff: the prefiltered probe, no ray. Glossy: try screen space first (cheap, exact on screen). Where it finds nothing, trace a real ray. Where that ray leaves the room, use the probe. This is AMD's FidelityFX "hybrid reflections" recipe, and roughly what Unreal's and Unity's high-end pipelines do. It is what Reflections.create(renderer, scene, { rayTracing: true }) runs.

good
Close to "ray traced" quality, while most pixels take the cheap path.
bad
Three systems to build and keep consistent (lighting has to match between them, or you see seams).
cost
Screen space everywhere glossy, rays only where it misses. On a GPU, rays in a few pixels of a group cost the whole group, so savings are smaller than the pixel count suggests.

Which one should I use?

probescreen space + proberay tracedhybrid
Reflects things off screenroughly, if they're on the wallsno (probe guess)yesyes
Objects inside the roommisplacedif on screenyesyes
Moving objectsfrozen until re-bakedif on screenyes (refit the BVH)yes
Rough surfacesgreatnoisynoisyuses the probe
Needs a denoisernoyesyesyes
Cost grows withnothing per frame (bake once)screen pixelspixels x scene complexitypixels, plus rays where screen space misses

GPU cost per pass, on real models: the showcase shows the GPU ms of each pass.

Rules of thumb

  • Mostly rough or matte materials (fabric, stone, painted walls), a static scene, phones, or a product viewer on an HDRI: probes (or just the environment map). Blurry reflections hide the probe's errors.
  • Glossy floors, roads or water seen at a low angle, where what's reflected is usually on screen: screen space with probes behind it. The standard for most games.
  • Mirrors, windows, car paint, anything facing the camera, or moving objects that must reflect correctly: add rays, as a hybrid.
  • A small scene on a fast GPU and you want the simplest thing that's right: ray trace. But one ray on a rough surface is mostly noise, where the probe is smooth and free.
  • Huge scenes, skinned characters, low-end GPUs: screen space + probes, with rays only on a few hero surfaces, if any.

In practice you stack them

Nearly every shipping engine layers these rather than picking one: probes everywhere as the base, screen space on top for glossy surfaces, and rays where the hardware allows. What differs is how far up the stack a given platform goes. The roughness cutoff is the knob between "cheap and blurry" and "exact and noisy".

Where denoising fits: anything that takes one random sample per pixel (screen space, rays, the hybrid) is noisy and needs a temporal denoiser. Probes come pre-blurred and don't.

How this demo is built

  • three.js WebGPURenderer; the room is explainer from examples/shared, lit by a shadowed spot light at the panel.
  • Reflections.create(renderer, scene, { probes, rayTracing: true, denoiser }): a G-buffer render, the screen-space tracer, rays for its misses, the probe for what neither reaches, FFX's denoiser, and the composite into three's lit image.
  • The modes are settings on that one pipeline: reflections.ssr.rayTracing off for "screen space + probe"; every pixel sent to the rays for "rays, every pixel"; three's lit image (the probe as its environment) for "probe only".
  • The source map is HybridReflections.sourceIndex of the composite: what answered each pixel's ray this frame.
  • The turning sculpture: reflections.trace.refit() each frame. The probe holds it as it was at the bake.

Words used on this page

Roughness
0 is a mirror, 1 is matte. Sets how wide the reflection lobe is.
Cubemap / probe
Six square renders around one point: a photo of the surroundings in every direction.
Prefilter
Pre-blurred versions of a cubemap, one per roughness, so a rough reflection is one lookup.
Box projection
Correcting a probe lookup for the room's shape, so walls reflect in the right place.
Depth buffer
The distance to the visible surface at each pixel. All screen space knows about the scene.
BVH
A tree of boxes around the triangles, so a ray tests a few dozen boxes instead of every triangle.
Sample
One random direction tried for a pixel. 1 sample per pixel per frame is noisy; a denoiser fixes that.
starting...