@pmndrs/reflections
Full documentation content.
\[!IMPORTANT] This is an early release. The API can still change.
## The three sources
A reflection answers one question: what does this surface see in this direction? No single method answers it well everywhere, so the library uses three and combines them.
| Source | It sees | It misses | Cost |
| ---------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------- |
| **Reflection probes** | A cube map baked from a point in the room, prefiltered by roughness | Anything that moved or changed since the bake. Details are blurred and a little off, because a probe is one point. | Cheap. A texture lookup. |
| **Screen-space reflections (SSR)** | Whatever is on screen, found by marching a ray through the depth buffer | Anything off screen or hidden behind something | Medium. A ray march per glossy pixel. |
| **Ray-traced fallback** | The whole scene, through a BVH, for the rays SSR could not finish | Nothing in the scene. It is the most expensive and the least needed. | Highest. Only the rays SSR missed. |
The **hybrid resolve** puts them together. For each pixel it uses the SSR hit where SSR found one. It asks the ray tracer about the misses. It falls back to the probes, then to the environment map. Then it hands the noisy part to a temporal denoiser and composites the result into your frame.
## Which one do I need?
- **A static room with glossy floors.** Probes alone. Bake once, pay almost nothing.
- **Moving objects in glossy surfaces.** Add SSR. The reflections follow what is on screen.
- **Mirrors, wet floors, car paint, where an off-screen object must show.** Add the ray-traced fallback.
- **You want the best look and have the GPU time.** All three, through `HybridReflections`, with a denoiser.
You can start with probes and add the others one at a time. Each page in [Concepts](/reflections/concepts/reflection-probes) covers one source.
## What is in the package
| Import | What it holds |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `@pmndrs/reflections` and `@pmndrs/reflections/three` | The three.js adapter: probes, the SSR pass, the hybrid resolve, TSL nodes. Both paths give the same exports. |
| `@pmndrs/reflections/core` | Engine-agnostic WebGPU passes that run on a bare `GPUDevice`. |
| `@pmndrs/reflections/babylon` | Babylon.js `WebGPUEngine` adapter: probes and screen-space reflections. Experimental. |
| `@pmndrs/reflections/pixi` | pixi.js v8 adapter for pixi-3d scenes: probes, screen-space reflections and the denoiser. Experimental. |
The [adapter comparison](/reflections/guides/adapters) shows which feature each one has.
## Where to go next
1. [Installation](/reflections/getting-started/installation): peers, WebGPU requirements, and device limits.
2. [Quick start](/reflections/getting-started/quick-start): reflections in a three.js scene in a few lines.
3. [First frame, step by step](/reflections/getting-started/first-frame): the same thing with every part explained.
4. [Live examples](/reflections/examples/showcase/): the showcase runs the whole pipeline on real models. Switch each source on and off. The [examples page](/reflections/getting-started/examples) lists all of them.
The library sits next to a few others from the same group, each with one job: a [denoiser](/reflections/concepts/denoising-and-upscaling), an upscaler, a ray tracer and BVH, a path tracer used as a reference, a depth downsampler and motion vectors. You do not need them all. The [denoising and upscaling page](/reflections/concepts/denoising-and-upscaling) says how they fit.
]]>
=0.187.0` | The three.js adapter. r187 is the floor. |
| `@babylonjs/core` | `>=9.35.0 <10` | The Babylon adapter. |
| `pixi.js` | `>=8.22.0 <9` | The pixi adapter. |
| `@pmndrs/raytracer` | `^0.1.0` | The ray-traced fallback (`rayTracing: true`). The only ray-tracing provider. |
| `@pmndrs/bvh` | `^0.1.0` | The BVH that `@pmndrs/raytracer` walks. Install it with the raytracer. |
For ray tracing, install both:
```bash
npm install @pmndrs/raytracer @pmndrs/bvh
```
The denoiser is not a peer on purpose. It plugs in through a small interface, so you pass an object in. Install it as its own package, [`denoiser`](https://github.com/pmndrs/denoiser) `^2.0.0` (`npm install denoiser`). See [Denoising and upscaling](/reflections/concepts/denoising-and-upscaling).
Each adapter has a page with its own install line and a minimal setup: [three.js](/reflections/guides/three), [React Three Fiber](/reflections/guides/react-three-fiber), [Babylon.js](/reflections/guides/babylon), [pixi.js](/reflections/guides/pixi). The [adapter comparison](/reflections/guides/adapters) lists what each one supports.
## Entry points
| Import | What it holds |
| ----------------------------- | ---------------------------------------- |
| `@pmndrs/reflections` | The three.js surface. Same as `/three`. |
| `@pmndrs/reflections/three` | three.js adapter. |
| `@pmndrs/reflections/core` | Engine-agnostic passes on a `GPUDevice`. |
| `@pmndrs/reflections/babylon` | Babylon.js adapter (experimental). |
| `@pmndrs/reflections/pixi` | pixi.js adapter (experimental). |
The package is ES modules only, with `sideEffects: false`.
## Requirements
- **WebGPU.** Current Chrome and Edge, and Safari Technology Preview, have it. There is no WebGL path.
- **Compute shaders and storage textures.** Everything WebGPU gives you by default.
- **More device limits than the defaults.** The G-buffer and the composite use more colour-attachment bytes and sampled textures than WebGPU's default limits allow. The next section shows how to ask for them. The ray-traced pass fits WebGPU's default of 8 storage buffers per stage in three's default setup (see [Troubleshooting](/reflections/guides/troubleshooting#a-texture-or-storage-limit-error)).
- **Optional features** the library uses when the adapter has them: `subgroups` (a faster tracer variant) and `timestamp-query` (per-pass GPU times).
## Ask for the right device limits
WebGPU gives you the default limits unless you ask for more. `reflectionsRequiredLimits(adapter)` returns the limits this library wants, clamped to what your adapter can do:
- up to 64 colour-attachment bytes per sample (the default is 32), so the G-buffer can carry the lit image and three's exact specular weights;
- up to 32 sampled textures per shader stage (the default is 16), so probe sets of several sizes fit next to a material's own maps;
- the limits the depth downsampler needs for six-level mip dispatches.
With three, pass them when you create the renderer:
```ts
export async function createRenderer(canvas: HTMLCanvasElement): Promise {
const adapter = await navigator.gpu.requestAdapter();
if (!adapter) throw new Error('WebGPU is not available');
const renderer = new THREE.WebGPURenderer({
canvas,
antialias: false,
// Asks for the most the adapter allows, up to what the library uses.
requiredLimits: reflectionsRequiredLimits(adapter),
});
await renderer.init();
return renderer;
}
```
If you create the `GPUDevice` yourself (raw WebGPU, the `core` entry, pixi), pass the same object to `adapter.requestDevice({ requiredLimits })`. On an adapter that cannot give the extra limits, the library turns the optional G-buffer targets off and falls back to estimates. It does not crash. See [Troubleshooting](/reflections/guides/troubleshooting) for the messages you may see.
## Bundlers
Vite, webpack 5 (and so Next.js) and esbuild need no special configuration. Without `@pmndrs/raytracer` and `@pmndrs/bvh` installed, webpack prints a "Module not found" warning for each and builds; ray tracing then stays off with one console warning. With Vite, if you link the package from outside your project, add its folder to `server.fs.allow`.
]]>
new FfxReflectionDenoiser(device, { roughnessThreshold: roughnessThreshold ** 2 }),
});
renderer.setAnimationLoop(() => reflections.render(camera)); // instead of renderer.render(scene, camera)
```
Tone mapping and the output colour space are the renderer's: set `renderer.toneMapping` as usual.
A complete page with a scene is [`examples/quickstart`](https://github.com/pmndrs/reflections/tree/main/examples/quickstart).
### What `Reflections.create` takes
| option | default | what |
| ------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `preset` | `'default'` | `'default'` is the package defaults. `'performance'` traces and denoises at half resolution. |
| `probes` | `true` | `true` bakes one probe over the scene's bounds. Pass a `ReflectionProbes` set you baked yourself, or `false` for the scene's environment alone. |
| `rayTracing` | `false` | `true` traces every visible mesh for the rays neither the screen nor the probe can answer (needs `@pmndrs/raytracer` and `@pmndrs/bvh`, see [Ray-traced fallback](/reflections/concepts/ray-traced-fallback)). An array limits it to those objects. |
| `denoiser` | none | A `TemporalDenoiser`, or a function `(device, { roughnessThreshold }) => denoiser`. FFX compares alpha, so square the threshold. |
| `settings` | none | Overrides over the preset (see the settings guide). |
Without a denoiser, glossy reflections are one noisy sample per 2x2 pixel quad. Use one.
Every piece is public on the object (`reflections.ssr`, `.hybrid`, `.probes`, `.pipeline`) for anything the options do not cover. After the scene or its environment changes, call `reflections.bake()` to re-capture the probe.
## Probes only
The cheapest path for an existing project: no extra passes. One baked probe, and every physical material reflects it (box-projected, prefiltered by roughness). It shows the scene as it was when baked and does not follow moving objects.
```ts
import { ReflectionProbe, ReflectionProbes, installCubeArraySupport, reflectionProbes } from '@pmndrs/reflections/three';
await installCubeArraySupport(renderer); // r187 cannot bind cube arrays yet; this adds it
const probes = new ReflectionProbes();
const room = new ReflectionProbe(12, 6, 12); // influence box: width, height, depth
room.position.set(0, 2.5, 0); // the capture point
probes.add(room);
scene.add(probes);
probes.bake(renderer, scene);
scene.environmentNode = reflectionProbes(probes);
```
`renderer.render(scene, camera)` stays as it is. See [`examples/quickstart/probes.html`](https://github.com/pmndrs/reflections/blob/main/examples/quickstart/src/probes.ts).
## Which materials get reflections
`MeshStandardMaterial` and `MeshPhysicalMaterial`, and their node versions. Basic, Lambert and Phong materials have no physically based specular term to replace, so they are left as three draws them.
## The denoiser
`denoiser/ffx` is a separate package ([`denoiser`](https://github.com/pmndrs/denoiser), version 2 or newer): a reflection denoiser written in WGSL, running on the renderer's device. It is what makes glossy reflections steady at rest and in motion. If you leave the option out, reflections still work and glossy surfaces are just noisier.
## Next
- Using React Three Fiber? See the [React Three Fiber guide](/reflections/guides/react-three-fiber). Babylon.js or pixi.js? See the [adapter comparison](/reflections/guides/adapters).
- Want to see it run? The [examples page](/reflections/getting-started/examples) lists every live example, and the [gallery](/reflections/examples/) opens them.
- To tune: every setting, its default and its cost is in the settings guide.
]]>
\[!NOTE] This page is generated from `examples/catalog.ts` by `pnpm docs:examples`. Edit the catalog, not this file.
The [example gallery](/reflections/examples/) has a card for every page below. Each page opens with a short brief: what it shows, what to try and what to switch off to see the plainer way. The examples need a browser with WebGPU.
## Showcase
The whole pipeline on real models, and the tools to judge it against a path tracer.
### Showcase
All the reflection sources on real models: a car concept, a toy car, a chess set on a mirror floor, and Sponza with a polished floor.
**What it shows.** The full package on real models: probes, screen-space reflections, the ray-traced fallback and the denoiser, combined per pixel, with the GPU time of each pass.
**Compare.** Press Off for the baseline, or untick a source's checkbox to see the image without it
**Try this.**
- Press Off, then On: the difference is every reflection the package adds
- Turn off Screen-space (SSR) and turn on the Ray-traced fallback, then the other way round
- Set Debug view to the source map to see which source each pixel took
[Open the live page](/reflections/examples/showcase/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/showcase/src/main.ts) · [Docs](/reflections/getting-started/introduction)
### Compare with a path tracer
Real-time reflections next to a path-traced reference of the same view, split by a draggable divider.
**What it shows.** How close the real-time reflections get to a path-traced reference of the same view, and where they differ.
**Compare.** The right side is the path tracer, the reference. Drag the divider to move between it and the left side.
**Try this.**
- Freeze the camera, wait for the path tracer to converge, then drag the divider
- Set the left side to three.js SSR and compare it with this package
[Open the live page](/reflections/examples/showcase/compare.html) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/showcase/src/compare.ts) · [Docs](/reflections/guides/performance-and-quality)
## Getting started
The smallest complete programs: reflections on a three.js scene in a few lines.
### Quick start
Reflections on an ordinary three.js scene: one `Reflections.create()` and `reflections.render(camera)`.
**What it shows.** The smallest complete program: an existing three.js scene gets screen-space reflections, a probe for what the screen cannot see, and the denoiser, all from one object.
**Compare.** The reflections checkbox. Unticked, three.js draws the scene without this package.
**Try this.**
- Untick the reflections checkbox: three.js draws the scene alone, with the probe as its environment
- Add `?rt=1` to the URL for the ray-traced fallback, or `?preset=performance` for half-resolution reflections
[Open the live page](/reflections/examples/quickstart/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/quickstart/src/main.ts) · [Docs](/reflections/getting-started/quick-start)
### Probes only
One baked reflection probe and your own `renderer.render()`: the cheapest way, with no extra passes.
**What it shows.** The cheapest reflections: one baked, box-projected probe that every material samples, with the render loop you already have.
**Compare.** The quick start page, which adds screen-space reflections and the denoiser on top of the probe
**Try this.**
- Orbit the camera: the reflections in the floor stay where they belong (that is box projection)
- Open the quick start in another tab: screen-space reflections add the sharp contact reflections a probe cannot hold
[Open the live page](/reflections/examples/quickstart/probes.html) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/quickstart/src/probes.ts) · [Docs](/reflections/concepts/reflection-probes)
### React Three Fiber
The quick start in React Three Fiber v10, with a `useReflections()` hook.
**What it shows.** The same reflections in React Three Fiber: a plain scene and one hook.
**Try this.**
- Orbit around the spinning knot: its reflection on the floor follows it (that is screen-space reflections)
- Add `?rt=1` or `?preset=performance` to the URL
[Open the live page](/reflections/examples/r3f/) · [Source](https://github.com/pmndrs/reflections/tree/main/examples/r3f/src) · [Docs](/reflections/guides/react-three-fiber)
## Features
One thing each, over a baseline you can switch back to.
### Box-projected probe
One baked probe in a room, projected onto the walls, so reflections stay put as you move.
**What it shows.** Why a probe is box-projected. Without it, the windows and walls reflected in the glossy floor sit in the wrong place and slide as the camera moves.
**Compare.** Untick Box projection. The same probe is then looked up by direction only, so reflections behave as if infinitely far away.
**Try this.**
- Untick Box projection and orbit: the window reflections slide across the floor
- Switch the view to Floor and toggle Box projection again
- Turn on the volumes: the projection box is the room's walls
[Open the live page](/reflections/examples/features/probes/box-projection/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/probes/box-projection/main.ts) · [Docs](/reflections/concepts/reflection-probes)
### Two rooms
A probe in each room and one in the doorway, blended by their influence boxes: each room reflects itself.
**What it shows.** Why a level needs more than one probe: each room reflects its own walls and light, and the doorway probe blends one room into the other without a seam.
**Compare.** Untick One probe per room. One probe, captured in the warm room, is then projected onto the whole building.
**Try this.**
- Untick One probe per room: the cool room's floor and the mirror ball now show the warm room
- Turn on Show blend weights, then pick Across the doorway: the colours mix where the boxes overlap
- Watch the mirror ball roll through the doorway: its reflection hands over from one room to the other
[Open the live page](/reflections/examples/features/probes/two-rooms/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/probes/two-rooms/main.ts) · [Docs](/reflections/concepts/reflection-probes)
### Live probes
Probes captured again while the scene runs, one per frame: a turning knot and two colour-cycling lights in two rooms.
**What it shows.** Probes that follow the scene. One probe is captured again each frame as the lights change colour and the knot turns, so the reflections stay current.
**Compare.** Untick Live capture. The same probes are then baked once at load and never updated.
**Try this.**
- Untick Live capture: the floor and the mirror ball keep the light colours from when the page loaded
- Set Probes per frame to all 3: the same image at three times the capture cost
[Open the live page](/reflections/examples/features/probes/live/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/probes/live/main.ts) · [Docs](/reflections/concepts/reflection-probes)
### Keep a mirror out of its own probe
`bake({ exclude })` keeps a moving mirror out of the live probe it reflects, so it does not paint itself onto the room.
**What it shows.** Why moving mirrors are kept out of probes. Captured, the knot is painted onto the wall and the floor, and the mirror floor shows a second, smeared knot where there is none.
**Compare.** Untick Exclude the mirror knot. The knot is then captured into the probe and painted onto the room.
**Try this.**
- Untick Exclude the mirror knot: a ghost knot slides across the floor's reflection of the wall
- Untick Move, tick Show the probe and orbit: the ghost is the knot as seen from the capture point (the mirror sphere), painted onto the wall
[Open the live page](/reflections/examples/features/probes/exclude/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/probes/exclude/main.ts) · [Docs](/reflections/concepts/reflection-probes)
### Screen-space reflections
Screen-space reflections on a polished floor, over a probe: the objects stand on their reflections.
**What it shows.** What screen-space reflections add over a probe: sharp reflections of everything on screen, including the objects a probe leaves out.
**Compare.** Untick Screen-space reflections. You then see the probe alone (three.js's lit image of the same frame).
**Try this.**
- Untick Screen-space reflections: the sphere and the box lose their reflections, and the wall keeps its own
- Raise Floor roughness: the reflection blurs with distance from the contact point, and the denoiser keeps it steady
- Pick At the sphere: the floor reflects the sphere's underside, which the camera cannot see (the probe fills it in)
[Open the live page](/reflections/examples/features/ssr/mirror-floor/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/ssr/mirror-floor/main.ts) · [Docs](/reflections/concepts/screen-space-reflections)
### What screen space misses
Off screen, behind the camera, hidden: what screen-space reflections cannot see, and the probes that fill it in.
**What it shows.** Where screen-space reflections run out: things off screen, behind the camera or hidden behind other objects. The probes fill those pixels so the image stays whole.
**Compare.** Untick Fill misses from the probes. You then see screen space alone, black wherever a ray found nothing on screen.
**Try this.**
- Untick Fill misses from the probes: the ring in the floor and the whole wall mirror go black
- Tick Tint the misses: magenta marks how much of each smooth pixel the probes filled
- Pick Behind the camera: the mirror shows the bars behind you only through the probe
[Open the live page](/reflections/examples/features/ssr/what-it-misses/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/ssr/what-it-misses/main.ts) · [Docs](/reflections/concepts/screen-space-reflections)
### Ray-traced fallback
Rays fill what screen space misses: reflections of things above the frame and behind the camera.
**What it shows.** What the ray-traced fallback adds over screen space plus probes: sharp reflections of things off screen, in the right place, including objects the probe never captured.
**Compare.** Untick Ray-traced fallback (`reflections.ssr.rayTracing = false`). The misses then take the probe instead.
**Try this.**
- Untick Ray-traced fallback and watch the wall mirror: the cylinder and the box vanish from it (the probe never saw them) and the bars go soft
- Switch the view to Wall mirror and toggle the fallback again
- Turn on the view that shows where each pixel's reflection comes from: blue is a traced ray, green is screen space, red is the probe
[Open the live page](/reflections/examples/features/rt/fallback/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/rt/fallback/main.ts) · [Docs](/reflections/concepts/ray-traced-fallback)
### Ray tracing moving meshes
`reflections.trace.refit()` each frame keeps the ray-traced reflections of moving meshes where the meshes are.
**What it shows.** Why moving meshes need `trace.refit()` each frame. Without it, rays still hit them where they stood at load, so their reflections lag or ghost.
**Compare.** Untick Refit. The BVH then keeps the pose it was built with, and the reflections go stale.
**Try this.**
- Untick Refit: the traced part of the knot's and the ball's reflections stays where they started
- Turn on Show traced pixels: those are the pixels a stale BVH gets wrong
- Untick Animate to hold a pose and compare
[Open the live page](/reflections/examples/features/rt/animated/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/rt/animated/main.ts) · [Docs](/reflections/concepts/ray-traced-fallback)
### The hybrid, explained
Probe, screen space, rays and the hybrid in one room: where each is right, where each breaks, and which source each pixel took.
**What it shows.** How the hybrid picks a source for each pixel: screen space where a ray hits, rays where it misses, the blurred probe for rough surfaces. It also shows why each source alone falls short.
**Compare.** Each source alone: probe only, screen space + probe, or rays for every pixel. Use the switch under the image, or "Reflections from".
**Try this.**
- Step through the situations and switch between the two methods under the image
- Turn on "where reflections come from" and tilt the view down at the floor
- In "Rough surfaces", drag the roughness cutoff to 1
[Open the live page](/reflections/examples/features/hybrid/explained/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/hybrid/explained/main.ts) · [Docs](/reflections/concepts/hybrid-resolve)
### Denoising glossy reflections
The denoiser on glossy surfaces, with a live flicker meter.
**What it shows.** What the denoiser does for glossy reflections. The tracer's one noisy sample per 2x2 block becomes a steady image, and the meter shows how steady.
**Compare.** Tick Denoiser off. You then see the raw signal: one ray per 2x2 block of pixels per frame.
**Try this.**
- Tick Denoiser off and watch the middle of the ramp (roughness 0.2 to 0.4) and the meter
- Switch the view to Floor strips: the chrome strips go from mirror to rough
- Orbit, let go, and watch the meter settle
[Open the live page](/reflections/examples/features/denoise/glossy/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/denoise/glossy/main.ts) · [Docs](/reflections/concepts/denoising-and-upscaling)
### Materials
How roughness, metalness and clear coat change reflections, and why basic, Lambert and Phong materials get none.
**What it shows.** Which materials get reflections, and how roughness, metalness and clear coat shape them. Basic, Lambert and Phong get none.
**Compare.** Tick Classic materials. The spheres switch to Phong, Lambert or Basic, while the floor strips stay standard.
**Try this.**
- Tick Classic materials: the spheres turn Phong and lose their reflections (the highlight is from the lights, not a reflection)
- Set the Blue row to Physical, clear coat: a sharp coat over a rough base
- Switch the view to Floor strips: chrome goes from mirror to rough
[Open the live page](/reflections/examples/features/materials/roughness/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/materials/roughness/main.ts) · [Docs](/reflections/guides/three)
### Animation and camera cuts
A camera path, moving objects and a camera cut with `resetHistory()`.
**What it shows.** A whole animated scene, with a camera path and moving objects, staying steady through the moves. `resetHistory()` runs at the camera cuts and only there.
**Compare.** Tick Reset history on camera moves. The denoiser then never gets past its first frame, and the glossy floor shows the tracer's raw noise while the camera moves. (Leaving out the reset at a cut barely shows, because the denoiser rejects history whose depth and normals disagree. A cut still needs it.)
**Try this.**
- Watch the floor through the camera moves and the cuts: it stays steady, with no shimmer
- Tick Reset history on camera moves: the floor sparkles until the shot ends
- Pause: the image holds still
[Open the live page](/reflections/examples/features/motion/animated/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/motion/animated/main.ts) · [Docs](/reflections/guides/flicker-and-stability)
### Presets
The `default` and `performance` presets (half-resolution reflections), with GPU time per pass.
**What it shows.** What the performance preset saves (the reflection passes run on a quarter of the pixels) and what it costs: softer reflections and jagged edges in mirrors.
**Compare.** Toggle Performance preset: it switches between the `performance` preset (half-resolution reflections) and `default`.
**Try this.**
- Tick Performance preset and read the GPU times in the panel
- Set the view to Mirror ball and toggle again: the ball's reflected edges are where half resolution shows
- Orbit near the floor: the rough floor barely changes
[Open the live page](/reflections/examples/features/perf/presets/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/perf/presets/main.ts) · [Docs](/reflections/guides/performance-and-quality)
### Upscaling
Temporal anti-aliasing and upscaling after the composite, with `@pmndrs/upscaler` and its jitter wired through.
**What it shows.** Rendering the scene and its reflections below the display size, then upscaling after the composite. Every reflection pass handles fewer pixels, and you get anti-aliasing with it.
**Compare.** Tick Upscaler off. Every pass then runs at the display resolution, with no anti-aliasing.
**Try this.**
- Tick Upscaler off: the image is at display resolution with no anti-aliasing (edges and the last shimmer return)
- Set Upscale to Performance (2x), orbit, then let go: this is a quarter of the pixels
- Set Upscale to Native AA: the upscaler works as temporal anti-aliasing only
[Open the live page](/reflections/examples/features/perf/upscaler/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/perf/upscaler/main.ts) · [Docs](/reflections/concepts/denoising-and-upscaling)
### Probes in your own TSL material
`sampleReflectionProbes` in a custom TSL material, here a water surface.
**What it shows.** Sampling the reflection probes from your own TSL material: a rippled water surface that reflects the room through `sampleReflectionProbes()`.
**Compare.** Tick Stock material. A glossy, flat MeshStandardMaterial then reflects the same probe.
**Try this.**
- Tick Stock material: a glossy MeshStandardMaterial replaces the water, using the same probe through three.js's lighting, flat
- Untick Ripples: the custom material becomes a fresnel mirror
- Orbit low over the pool: the fresnel brings the windows up at grazing angles
[Open the live page](/reflections/examples/features/custom/tsl/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/custom/tsl/main.ts) · [Docs](/reflections/guides/three)
### Device limits
What a plain `new WebGPURenderer()` costs: a second lit pass, and `traceError` when ray tracing does not fit.
**What it shows.** What changes on a renderer with WebGPU's default limits: a second scene draw for the lit image, estimated specular weights, and ray tracing turning itself off (with `traceError`) when it does not fit. Nothing fails.
**Compare.** Set Renderer to createReflectionsRenderer() (the page reloads). The image barely changes. What differs is the extra scene draw and the estimated specular weights, which the panel shows.
**Try this.**
- Read the panel, then set Renderer to createReflectionsRenderer(): one scene draw, with specular taken from the material
- On the plain renderer, set Ray tracing to the 9-buffer scene copy: the status line shows pass.traceError
[Open the live page](/reflections/examples/features/setup/device-limits/) · [Source](https://github.com/pmndrs/reflections/blob/main/examples/features/setup/device-limits/main.ts) · [Docs](/reflections/guides/troubleshooting)
## Engines
One page per adapter, each with the features that adapter has.
### three.js
three.js `WebGPURenderer` with every feature, on the two rooms that all the engine pages share.
**What it shows.** The three.js adapter with everything on: probes per room, screen-space reflections, the denoiser and, on a switch, the ray-traced fallback. The other engine pages draw this scene from the same views.
**Compare.** Turn Screen space off (probes only); every engine page has this switch. Or open another engine page at the same View.
**Try this.**
- Turn Screen space off: the floor keeps the probes' blurrier, box-projected reflections
- Turn the Ray-traced fallback on, set View to ball, and watch what the screen cannot see
- Open the Babylon.js or Raw WebGPU page at the same View and compare
[Open the live page](/reflections/examples/engines/three/) · [Source](https://github.com/pmndrs/reflections/tree/main/examples/engines/three) · [Docs](/reflections/guides/three)
### React Three Fiber
The two rooms as JSX, with every feature of the three.js page through the `useReflections` hook.
**What it shows.** Everything the three.js page has, in React: the rooms and their probes as JSX, and reflections from one hook.
**Compare.** Turn Screen space off (probes only). Or open the three.js page, which should look the same.
**Try this.**
- Turn Screen space off: probes only
- Turn the Ray-traced fallback on (the hook's component remounts with a BVH)
- Open the three.js page next to it at the same View
[Open the live page](/reflections/examples/engines/r3f/) · [Source](https://github.com/pmndrs/reflections/tree/main/examples/engines/r3f) · [Docs](/reflections/guides/react-three-fiber)
### Babylon.js
The two rooms built in Babylon.js: probes and screen-space reflections as frame-graph tasks.
**What it shows.** The engine-agnostic core on Babylon.js: the same probes and tracer as engines/three, wired into Babylon's frame graph, on the same two rooms.
**Compare.** Screen space off (probes only); and engines/three at the same View
**Try this.**
- Turn Screen space off: probes only, as on the three page
- Set Debug to radiance or confidence: what the tracer hands the composite
- Open engines/three at the same View: the difference is lighting, shadows and the missing denoiser
[Open the live page](/reflections/examples/engines/babylon/) · [Source](https://github.com/pmndrs/reflections/tree/main/examples/engines/babylon) · [Docs](/reflections/guides/babylon)
### Raw WebGPU
The probe set and the screen-space tracer on a bare `GPUDevice`, with no engine, on the two rooms.
**What it shows.** The core API with no engine, which is what every adapter wraps. A minimal renderer fills the frame contract, and the core's probes, tracer and denoiser do the rest.
**Compare.** Turn Screen space off (probes only). Or open the three.js page at the same View.
**Try this.**
- Turn Screen space off: probes only
- Set Show to lit, then reflection: the scene colour the tracer reads, and what the composite adds
- Open the three.js page at the same View
[Open the live page](/reflections/examples/engines/core/) · [Source](https://github.com/pmndrs/reflections/tree/main/examples/engines/core) · [Docs](/reflections/concepts/frame-contract)
## Lab
Developer pages: the checks and benches the repository runs on a real GPU. To read and poke at, not demos.
- [Screen-space test scenes](/reflections/examples/ssr/): Every test scene with every switch: screen-space reflections, rays, probes, the denoiser and the debug views. ([source](https://github.com/pmndrs/reflections/blob/main/examples/ssr/src/main.ts))
- [Probe parity page](/reflections/examples/probes/): The three.js reflection probe example running on this package's probes, captured live: every storage, lookup and capture option, and the probe checks. ([source](https://github.com/pmndrs/reflections/blob/main/examples/probes/src/main.ts))
- [Scene kit and G-buffer](/reflections/examples/scenes/): The test scenes and every target of the frame contract: depth, normals, roughness, motion and scene colour. ([source](https://github.com/pmndrs/reflections/blob/main/examples/scenes/src/main.ts))
- [Babylon.js adapter checks](/reflections/examples/babylon/): The mirror-wall scene on Babylon.js: the adapter's orientation, motion and environment-lighting checks. ([source](https://github.com/pmndrs/reflections/blob/main/examples/babylon/src/main.ts))
- [Screen-space tracer (core)](/reflections/examples/sssr-core/): The core tracer on exact analytic inputs, on raw WebGPU: debug views and variant parity. ([source](https://github.com/pmndrs/reflections/blob/main/examples/sssr-core/src/main.ts))
- [Probe set (core)](/reflections/examples/probe-core/): The core probe set and its radiance fallback on a bare GPU device. ([source](https://github.com/pmndrs/reflections/blob/main/examples/probe-core/src/main.ts))
- [BC6H encoder](/reflections/examples/bc6h/): The GPU BC6H encoder checked against the hardware decoder. ([source](https://github.com/pmndrs/reflections/blob/main/examples/bc6h/src/main.ts))
- [Probe layout bench](/reflections/examples/probe-bench/): Cube array, 2D array and octahedral layouts, with rgba16f, rgb9e5, rg11b10 and BC6H formats. ([source](https://github.com/pmndrs/reflections/blob/main/examples/probe-bench/src/main.ts))
- [Screen-space reflections bench](/reflections/examples/ssr-bench/): This package's screen-space reflections against three.js r187's `SSRNode`: error, flicker and GPU time. ([source](https://github.com/pmndrs/reflections/blob/main/examples/ssr-bench/src/main.ts))
- [Regressions](/reflections/examples/regressions/): GPU reproductions of bugs found in review, each seen failing before its fix. ([source](https://github.com/pmndrs/reflections/blob/main/examples/regressions/src/main.ts))
- [Tuning bench](/reflections/examples/showcase/bench.html): Every setting on one panel, two methods side by side, measured against the path tracer. ([source](https://github.com/pmndrs/reflections/blob/main/examples/showcase/src/bench.ts))
## Not on the site
**pixi.js + pixi-3d**, **Radiance cache study**: in the repository and the local gallery, left out of the public site (needs the closed pixi-3d beta; needs a local pathtracer checkout).
]]>
` from the denoiser's core. It receives the radiance, the hit distance, the guides (depth, normal, roughness, motion) and the camera. `FfxReflectionDenoiser` fits as is.
```bash
npm install denoiser
```
```ts
const hybrid = new HybridReflections(ssr, { denoiser });
hybrid.denoise = true; // toggle at any time
```
The denoiser is an optional peer and never a dependency. That keeps this package small and lets you swap in another denoiser that speaks the same interface.
> \[!NOTE] Without a denoiser, the resolve runs undenoised. That still works, but rough glossy surfaces and traced reflections shimmer much more. The [live examples](/reflections/examples/showcase/) run with it.
Match the denoiser's roughness gate to the tracer's. The tracer skips pixels rougher than `roughnessThreshold` (perceptual). The denoiser compares alpha, which is perceptual roughness squared. If you use the default of 0.447, give the denoiser `0.447 * 0.447`.
## Upscaling
Run the reflection passes at a lower render size and let an upscaler rebuild the display size. The G-buffer, reflections and denoiser all run at the render size, so every reflection pass gets cheaper with the pixel count. The upscaler needs motion vectors and jittered cameras: `ssr.render(scene, camera, { jitter })` takes the jitter.
At ratio 1 the upscaler works as temporal anti-aliasing, and that alone calms a lot of residual shimmer. See [Flicker and stability](/reflections/guides/flicker-and-stability).
Reflections can also run at **half resolution on their own** (`reflectionResolution: 'half'`, or the `performance` preset). That is a separate trade. The tracer and denoiser run on one pixel per 2x2 quad, and a joint bilateral filter upsamples the result. It saves more than most settings, at the cost of crisp mirror edges. The upscaler is the better first choice when you have to pick one.
## The trace seam
The ray-traced fallback does not care which BVH you use. A provider is a WGSL function that returns the first hit, plus a bind group. The shipped provider is built on `@pmndrs/raytracer`. See [Ray-traced fallback](/reflections/concepts/ray-traced-fallback).
## Live examples
- [Denoising glossy reflections](/reflections/examples/features/denoise/glossy/): the denoiser on and off, with a flicker meter.
- [Animation and camera cuts](/reflections/examples/features/motion/animated/): a moving camera and objects, and `resetHistory()`.
- [Upscaling](/reflections/examples/features/perf/upscaler/): render below the display size and upscale after the composite.
]]>
`, with a hook from the example that calls `Reflections.create`.
What the rows mean:
- **Probes.** Baked, prefiltered captures of the scene, blended by influence volume. [Reflection probes](/reflections/concepts/reflection-probes).
- **Bounce light from the probes.** Materials take their diffuse image-based lighting from the probes. three: `scene.environmentNode`. Babylon: a material plugin per PBR material. pixi-3d lights from its own environment.
- **Screen-space reflections.** The tracer that marches the depth buffer. [Screen-space reflections](/reflections/concepts/screen-space-reflections).
- **Ray-traced fallback.** Rays through a BVH for what the screen misses, through `@pmndrs/raytracer`. [Ray-traced fallback](/reflections/concepts/ray-traced-fallback).
- **Denoiser seam.** You pass a temporal denoiser (`denoiser/ffx`) and the adapter runs it on the traced signal. [Denoising and upscaling](/reflections/concepts/denoising-and-upscaling).
- **Presets.** Named bundles of settings, applied with `preset` or `applyReflectionsPreset`. [Performance and quality](/reflections/guides/performance-and-quality).
- **Hybrid resolve.** One object that picks the screen hit, the traced hit, the probe or the environment per pixel, and denoises the result. [Hybrid resolve](/reflections/concepts/hybrid-resolve).
- **One-call setup.** One `await Reflections.create(renderer, scene, options)` and one `reflections.render(camera)` per frame.
On Babylon and pixi the tracer takes the probes (and an environment slot) as its fallback, and a composite adds the result to the lit image. That is screen space with probes behind it. It is not the hybrid resolve.
## Which adapter do I need
- **three.js, with or without React.** The [three.js page](/reflections/guides/three) or the [React Three Fiber page](/reflections/guides/react-three-fiber). Start with `Reflections.create`.
- **Babylon.js.** The [Babylon.js page](/reflections/guides/babylon). You build a frame graph with the two reflection tasks.
- **pixi.js.** The [pixi.js page](/reflections/guides/pixi). It needs the pixi-3d closed beta.
- **Another engine.** Use `@pmndrs/reflections/core` on a `GPUDevice`. An adapter maps the engine's G-buffer, camera and conventions onto the frame contract, then reuses the core passes.
## Peer packages by adapter
| Adapter | Required | Optional |
| --------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| three.js, React Three Fiber | `three` `>=0.187.0` | `@pmndrs/raytracer` `^0.1.0` and `@pmndrs/bvh` `^0.1.0` for ray tracing, `denoiser` `^2.0.0` |
| Babylon.js | `@babylonjs/core` `>=9.35.0 <10` | none |
| pixi.js | `pixi.js` `>=8.22.0 <9`, and pixi-3d (closed beta) | `denoiser` `^2.0.0` |
All of them need a browser with WebGPU. There is no WebGL path.
Each engine has a live page on the same two rooms, so you can compare them at the same view: [three.js](/reflections/examples/engines/three/), [React Three Fiber](/reflections/examples/engines/r3f/), [Babylon.js](/reflections/examples/engines/babylon/) and [raw WebGPU](/reflections/examples/engines/core/). The pixi.js page needs the closed beta and is not on the site. See the [examples page](/reflections/getting-started/examples).
]]>
=0.187.0` | Always. |
| `@pmndrs/raytracer` | `^0.1.0` (optional) | `rayTracing: true`, the ray-traced fallback. |
| `@pmndrs/bvh` | `^0.1.0` (optional) | Install with `@pmndrs/raytracer`. |
| `denoiser` | `^2.0.0` (optional, not a peer) | A denoiser for glossy reflections: `denoiser/ffx`. |
```bash
npm install @pmndrs/raytracer @pmndrs/bvh denoiser
```
## Minimal setup
This is [`examples/quickstart`](https://github.com/pmndrs/reflections/tree/main/examples/quickstart) without its scene and controls. `Reflections.create` builds the G-buffer, the screen-space pass, a baked probe, the denoiser and the composite in a `RenderPipeline`.
```ts
// A WebGPURenderer with the device limits the passes need, already initialised.
const renderer = await createReflectionsRenderer({ canvas, antialias: false });
const reflections = await Reflections.create(renderer, scene, {
preset: 'default', // or 'performance'
rayTracing: false, // true needs @pmndrs/raytracer and @pmndrs/bvh
denoiser: (device, { roughnessThreshold }) => new FfxReflectionDenoiser(device, { roughnessThreshold: roughnessThreshold ** 2 }),
});
// Where you called renderer.render(scene, camera):
renderer.setAnimationLoop(() => reflections.render(camera));
```
The options are in the [quick start](/reflections/getting-started/quick-start#what-reflectionscreate-takes). After the scene or its environment changes, call `reflections.bake()`. Every piece stays public on the object: `reflections.ssr`, `.hybrid`, `.probes`, `.trace` and `.pipeline`.
For a cheaper start with no extra passes, bake probes only. See the [quick start](/reflections/getting-started/quick-start#probes-only). To build the frame yourself, see [first frame](/reflections/getting-started/first-frame) and the sections below.
## Device limits
The passes ask for more than WebGPU's default limits: up to 64 colour-attachment bytes per sample (the default is 32) and up to 32 sampled textures per stage (the default is 16). `createReflectionsRenderer` asks for them for you. To build the renderer yourself, pass `requiredLimits: reflectionsRequiredLimits(adapter)` to `WebGPURenderer` ([Installation](/reflections/getting-started/installation#ask-for-the-right-device-limits)).
The ray-traced pass binds 8 storage buffers per stage in three's default setup, which is WebGPU's default limit. It runs on a plain device. If a configuration needs more, the pass warns once, sets `pass.traceError`, and screen space and probes continue. See [Troubleshooting](/reflections/guides/troubleshooting#ray-tracing-is-off-on-this-device).
A plain `new WebGPURenderer()` works, with one console warning. Its default colour-attachment limit (32 bytes per sample) cannot hold the G-buffer and the lit image together (36), so the scene is drawn a second time for the lit image and three's specular weights are estimated. Use `createReflectionsRenderer`, or pass `requiredLimits: reflectionsRequiredLimits(adapter)`, to avoid the extra draw.
## Known gaps
- Basic, Lambert and Phong materials get no reflections, by design. Use a standard material.
- On three r187, probes need `installCubeArraySupport(renderer)` to use a real cube array. `Reflections.create` does it for you. Without it, probes use a 2D array.
- The ray-traced BVH is built once. Moving meshes need `reflections.trace.refit()` each frame. Changed geometry needs a new build.
- One `Reflections` per canvas.
- Without a denoiser, glossy reflections are noisy.
## Live example
The [quickstart](/reflections/examples/quickstart/) runs this page's setup. The [showcase](/reflections/examples/showcase/) runs the whole pipeline on real scenes, with each source switchable. [three.js](/reflections/examples/engines/three/) has every feature on the two rooms that all the engine pages share, and [Materials](/reflections/examples/features/materials/roughness/) shows which materials get reflections. The [examples page](/reflections/getting-started/examples) lists them all.
## The pieces
`Reflections` is built from these. Use them directly to wire the frame yourself.
| Piece | What it is |
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `Reflections` | The one-call setup: all the pieces below, in a `RenderPipeline`. |
| `ScreenSpaceReflectionsPass` | Renders the G-buffer and runs the screen-space tracer (and the ray-traced pass, with `trace`). |
| `HybridReflections` | Resolves the sources, runs the denoiser, and builds the composite. |
| `ReflectionProbes`, `ReflectionProbe`, `reflectionProbes()` | Baked probes and the TSL lookup node for `scene.environmentNode`. |
| `sampleReflectionProbes()` | The same lookup as a function you can call in your own TSL. |
| `FrameGBuffer` | The multi-render-target pass inside the SSR pass. Use it alone to read depth, normals and roughness. |
| `createRaytracerTraceProviderFromObjects()` | Builds the ray-traced provider (`@pmndrs/raytracer`) from three meshes. |
| `applyReflectionsPreset()` | Applies a named bundle of settings at run time. |
| `reflectionsRequiredLimits()` | The device limits to request. |
## The render loop
Each frame, in this order:
```text
ssr.render(scene, camera) // 1. G-buffer + trace
hybrid.update() // 2. resolve + denoise
pipeline.render() // 3. composite into your output
```
`ssr.render` replaces `renderer.render(scene, camera)` for the scene, because it renders the scene into the G-buffer. The composite node (`hybrid.composite().final`) is the lit image with the reflections in place. Put it in a `RenderPipeline`, or into your own post-processing chain.
## Resizing
The pass sizes its G-buffer from `gbufferOptions: { width, height }` (default: the renderer's size). When the canvas changes size, resize the G-buffer and reset the history so the denoiser does not blend frames of different sizes:
```text
ssr.gbuffer.setSize(width, height);
ssr.resetHistory();
hybrid.resetHistory();
```
## Several composites
`hybrid.composite()` can be called again for another place the reflections show, such as a debug view or a second camera's uv. Build the composites again after you change `reflectionResolution` (`hybrid.rebuild()`, then `composite()`), because they read different textures at half resolution.
## Camera cuts and jitter
Call `resetHistory()` on a camera cut or a teleport. For an upscaler or TAA, pass the jitter to `ssr.render(scene, camera, { jitter })`. The showcase's `DisplayAA` helper (`examples/shared/antialias.ts`) shows the whole wiring with `@pmndrs/upscaler`.
## Next
- [Performance and quality](/reflections/guides/performance-and-quality)
- [Flicker and stability](/reflections/guides/flicker-and-stability)
- [Troubleshooting](/reflections/guides/troubleshooting)
- [React Three Fiber](/reflections/guides/react-three-fiber)
- [Adapter comparison](/reflections/guides/adapters)
]]>
`. Everything `Reflections.create` does is available: probes, screen-space reflections, the ray-traced fallback, the denoiser, presets and the hybrid resolve. The package has no React code. A small hook of about thirty lines, copied from the example, wraps `Reflections.create`. See the [adapter comparison](/reflections/guides/adapters).
## Install
R3F v10 is on the `alpha` tag at the time of writing. The last tested version is `10.0.0-alpha.6`. You also need React 19.
```bash
npm install @react-three/fiber@alpha react react-dom three @pmndrs/reflections
```
| Package | Range | When |
| -------------------- | ------------------------------- | ---------------------------------------------- |
| `three` | `>=0.187.0` | Always. |
| `@react-three/fiber` | `10.0.0-alpha.6` tested | Always. |
| `@pmndrs/raytracer` | `^0.1.0` (optional) | `rayTracing: true`. |
| `@pmndrs/bvh` | `^0.1.0` (optional) | Install with `@pmndrs/raytracer`. |
| `denoiser` | `^2.0.0` (optional, not a peer) | `denoiser/ffx`, for steady glossy reflections. |
```bash
npm install @pmndrs/raytracer @pmndrs/bvh denoiser
```
## Minimal setup
Two things differ from a plain canvas:
1. The renderer needs the device limits the reflection passes ask for. R3F's `renderer` prop takes a factory, so pass `createReflectionsRenderer` through it.
2. The frame is drawn by `Reflections`, not by R3F's default render. A `useFrame` job in the `render` phase takes over.
### The `useReflections` hook
This is [`examples/r3f/src/useReflections.ts`](https://github.com/pmndrs/reflections/blob/main/examples/r3f/src/useReflections.ts):
```tsx
import { useEffect, useRef, useState } from 'react';
import { useFrame, useThree } from '@react-three/fiber';
import type * as THREE from 'three/webgpu';
import { Reflections, type ReflectionsOptions } from '@pmndrs/reflections/three';
export function useReflections(options: ReflectionsOptions & { enabled?: boolean } = {}) {
const { renderer, scene } = useThree() as unknown as { renderer: THREE.WebGPURenderer; scene: THREE.Scene };
const [reflections, setReflections] = useState(null);
const optionsRef = useRef(options);
optionsRef.current = options;
const enabled = options.enabled ?? true;
useEffect(() => {
if (!enabled) return;
let cancelled = false;
let made: Reflections | null = null;
Reflections.create(renderer, scene, optionsRef.current).then((r) => {
if (cancelled) r.dispose(); else { made = r; setReflections(r); }
}, (e) => console.error('useReflections:', e));
return () => { cancelled = true; made?.dispose(); setReflections(null); };
}, [renderer, scene, enabled]);
// A job in the 'render' phase takes over R3F's own render call; this draws the frame instead.
useFrame(({ renderer, scene, camera }) => {
if (reflections) reflections.render(camera);
else (renderer as THREE.WebGPURenderer).render(scene, camera);
}, { phase: 'render' });
return reflections;
}
```
`Reflections.create` is async (the cube-array check, the probe bake, the BVH), so the hook returns `null` until it is ready and draws the scene the plain way meanwhile. It builds once per renderer and scene. To rebuild with other options, remount the component with a `key`. If creation fails, the error goes to the console and the plain frame stays.
### The canvas
```tsx
import { useEffect, useState } from 'react';
import { Canvas, useThree } from '@react-three/fiber';
import * as THREE from 'three/webgpu';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
import { createReflectionsRenderer } from '@pmndrs/reflections/three';
import { FfxReflectionDenoiser } from 'denoiser/ffx';
import { useReflections } from './useReflections';
function Scene() {
const { renderer, scene } = useThree() as unknown as { renderer: THREE.WebGPURenderer; scene: THREE.Scene };
const [envReady, setEnvReady] = useState(false);
// The probe captures what the scene shows, so the environment has to be there first.
useEffect(() => {
scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
scene.background = scene.environment;
setEnvReady(true);
}, [renderer, scene]);
useReflections({
enabled: envReady,
denoiser: (device, { roughnessThreshold }) =>
new FfxReflectionDenoiser(device, { roughnessThreshold: roughnessThreshold ** 2 }),
});
return (
<>
>
);
}
export default function App() {
return (
);
}
```
## Device limits
`createReflectionsRenderer` asks the adapter for the limits the passes need. Keep it in the `renderer` prop. A renderer built without it can throw in `Reflections.create` for lack of colour-attachment bytes. The ray-traced pass fits WebGPU's default 8 storage buffers per stage in this setup. If a configuration does not fit, it warns once, sets `pass.traceError`, and screen space and probes continue ([Troubleshooting](/reflections/guides/troubleshooting#ray-tracing-is-off-on-this-device)).
## Known gaps
- R3F v10 is an alpha. The hook lives in the example, not in the package, and there is no `@pmndrs/reflections/react` entry.
- `enabled` is for anything the probe bakes that arrives late: an `` that is still loading, a model. Call `reflections.bake()` after the scene changes.
- Moving objects: screen-space reflections follow them. The probe is a snapshot, and with `rayTracing` the BVH holds the meshes as they were at build time (`reflections.trace.refit()` each frame updates the transforms of the same meshes).
- One `Reflections` per canvas.
## Live example
[`examples/r3f`](https://github.com/pmndrs/reflections/tree/main/examples/r3f) is the full page, and the [live version](/reflections/examples/r3f/) runs it. It takes `?rt=1` for the ray-traced fallback, `?preset=performance` and `?denoise=0`.
[engines/r3f](/reflections/examples/engines/r3f/) is the larger page: the two rooms written as JSX, with every feature of the [three.js page](/reflections/examples/engines/three/) behind the same hook.
]]>
\[!WARNING] The Babylon adapter is experimental. The API can change.
The adapter runs the core screen-space tracer and the probe set on Babylon's own device. It supports:
- **Probes.** `BabylonProbeSet` captures them with Babylon cube renders, plus an environment slot.
- **Bounce light from the probes.** `probeIrradiance(material, probes)` lights a PBR material's diffuse from the probes.
- **Screen-space reflections.** `ScreenSpaceReflections`, on a G-buffer from Babylon's geometry renderer.
- **A composite.** It adds the reflections to the lit image, with debug views.
- **Frame-graph tasks.** `FrameGraphReflectionsTask` and `FrameGraphReflectionsCompositeTask`.
It does not have the ray-traced fallback, the denoiser, presets, the hybrid resolve or a one-call setup. The [adapter comparison](/reflections/guides/adapters) has the full table. The adapter handles Babylon's conventions (handedness, Y-flipped targets, velocity, gloss and F0) when it builds the [frame contract](/reflections/concepts/frame-contract).
## Install
```bash
npm install @pmndrs/reflections @babylonjs/core
```
| Package | Range | When |
| ----------------- | -------------- | ------------------------------------- |
| `@babylonjs/core` | `>=9.35.0 <10` | Always. The tested version is 9.35.0. |
`three`, `pixi.js`, `@pmndrs/raytracer`, `@pmndrs/bvh` and `denoiser` are not used by this adapter.
## Minimal setup
The complete code is [`examples/babylon`](https://github.com/pmndrs/reflections/tree/main/examples/babylon). These are its reflection parts. Import from the Babylon entry:
```ts
import { FrameGraphReflectionsCompositeTask, FrameGraphReflectionsTask, BabylonProbeSet, ScreenSpaceReflections, stripSpecularIBL } from '@pmndrs/reflections/babylon';
```
### 1. The engine
```ts
export async function createEngine(canvas: HTMLCanvasElement): Promise {
// enableAllFeatures: subgroups for the tracer's faster variant. setMaximumLimits: four colour targets.
const engine = new WebGPUEngine(canvas, { antialias: false, enableAllFeatures: true, setMaximumLimits: true });
await engine.initAsync();
return engine;
}
```
### 2. Probes and the tracer
```ts
// The composite adds the specular IBL term back from the sources, so take it out of the materials.
materials.forEach((m) => stripSpecularIBL(m));
// One probe over the room, plus the environment as a slot.
const probes = new BabylonProbeSet(scene, { capacity: 1, sourceSize: 128, environment: [skybox] });
probes.setProbes([{ position: [0, 2, 0], influenceSize: [16, 4.2, 16], projectionSize: [16, 4.2, 12] }]);
await scene.whenReadyAsync();
await probes.bake();
const ssr = new ScreenSpaceReflections({ engine, probes });
```
A probe can capture from a point other than its influence box's centre (`originOffset`) and project onto a box offset from it (`projectionOffset`), as three's `ReflectionProbe` does: that lets a room's influence box reach below the floor, so the floor gets the probe's full weight, while the capture point and the walls stay where the room is.
For bounce light, give each PBR material the probes' irradiance. three's materials get it from `scene.environmentNode`; Babylon has no per-pixel environment hook, so a material plugin runs the probe lookup in the material's shader. It replaces the diffuse part of Babylon's image-based lighting, and Babylon still weights it as usual (albedo, specular energy, `scene.environmentIntensity`, ambient occlusion). It works with or without `scene.environmentTexture`.
```ts
for (const m of scene.materials) if (m instanceof PBRMaterial) probeIrradiance(m, probes);
```
Attach it before the first render. `bake()` captures with the probes switched off, so a capture never sees the probes' own light. Without the plugin, a scene with no environment texture gets direct light only: the rooms of `engines/babylon` read about 60 / 255 darker than three's.
Without a denoiser in this adapter, a glossy surface shows the tracer's raw samples, and they move every frame. Set `ssr.settings.frameIndex` (for example to 0) to fix the noise pattern, so a still view stays still. The adapter also lets every glossy ray march to the end (`minTraversalOccupancy: 0`; core's default stops rays early in a way that changes from frame to frame). Leave it at 0 unless you trade a still image for a faster tracer.
`BabylonProbeSet.bake()` needs `scene.activeCamera` to be set, because the captures take its near and far planes. `ssr.configure(width, height)` allocates the tracer's textures. Call it again, and rebuild the frame graph, when the size changes.
### 3. The frame graph
Build a frame graph the usual Babylon way: clear, shadows, a geometry renderer task that writes world normals, reflectivity and linear velocity, the sky. Then add the two reflection tasks and present the composite:
```ts
// The geometry task writes world normals, reflectivity and linear velocity. `sky` holds the lit colour and depth.
const trace = new FrameGraphReflectionsTask('reflections', graph, ssr);
trace.camera = camera;
trace.colorTexture = sky.outputTexture;
trace.depthTexture = sky.outputDepthTexture;
trace.worldNormalTexture = geometry.geometryWorldNormalTexture;
trace.reflectivityTexture = geometry.geometryReflectivityTexture;
trace.velocityTexture = geometry.geometryLinearVelocityTexture;
graph.addTask(trace);
const composite = new FrameGraphReflectionsCompositeTask('composite', graph, scene);
composite.camera = camera;
composite.sourceTexture = sky.outputTexture;
composite.depthTexture = sky.outputDepthTexture;
composite.worldNormalTexture = geometry.geometryWorldNormalTexture;
composite.reflectivityTexture = geometry.geometryReflectivityTexture;
composite.velocityTexture = geometry.geometryLinearVelocityTexture;
composite.radianceTexture = trace.radianceTexture;
composite.confidenceTexture = trace.confidenceTexture;
composite.hitDistanceTexture = trace.hitDistanceTexture;
graph.addTask(composite);
```
The geometry task needs `disableImageProcessing = true`, so the tracer and the composite get linear HDR. Feed the composite's `outputTexture` to your image-processing task. `examples/babylon/src/main.ts` has the whole graph.
## The parts
| Piece | What it does |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| `BabylonProbeSet` | Probes captured with Babylon cube renders, backed by the core probe set. Add the environment as a slot. |
| `ScreenSpaceReflections` | The core tracer on Babylon's device. With probes, misses and rough pixels take the probe radiance. |
| `FrameGraphReflectionsTask` | Runs the tracer inside a frame graph. |
| `FrameGraphReflectionsCompositeTask` | Adds the reflections to the lit image, with debug views (`COMPOSITE_VIEWS`). |
| `stripSpecularIBL(material)` | Takes the specular IBL term out of a PBR material, because the composite adds it back from the sources. |
| `probeIrradiance(material, probes)` | Lights a PBR material's diffuse IBL from the probes, per pixel (bounce light). WGSL only. |
## Device limits
The engine needs `setMaximumLimits: true` for four colour targets, and `enableAllFeatures: true` if you want the subgroup variant of the tracer. The adapter reads Babylon's `GPUDevice` and does not make its own. There is no ray-traced pass here, so the storage-buffer count from the three.js adapter does not apply.
## Known gaps
- No ray-traced fallback, no denoiser, no presets and no hybrid resolve. Probes and screen space only.
- No one-call setup like `Reflections.create`. You build the frame graph.
- Materials need `stripSpecularIBL`, and `probeIrradiance` for bounce light. Both work on PBR materials.
- The bounce light samples the probes along the normal at roughness 1, as three's does. It is not a cosine convolution like Babylon's own spherical harmonics.
- Experimental: names and options can change.
## Live example
[`examples/engines/babylon`](https://github.com/pmndrs/reflections/tree/main/examples/engines/babylon) builds the two rooms of the other engine pages in Babylon, with the three probes and screen space as frame-graph tasks; its [live page](/reflections/examples/engines/babylon/) sits next to the [three.js page](/reflections/examples/engines/three/) at the same views. [`examples/babylon`](https://github.com/pmndrs/reflections/tree/main/examples/babylon) is the source the snippets above come from, and its [live page](/reflections/examples/babylon/) takes `?ssr=0`, `?probes=0`, `?view=` and `?variant=workgroup`.
]]>
\[!WARNING] The pixi adapter is experimental, and it works with **pixi-3d** (`@pixi/3d`), which is in a closed beta and not on npm. This package never imports it. You need the beta to use the adapter. The live examples site does not include the pixi example.
pixi has no G-buffer, so the adapter builds the [frame contract](/reflections/concepts/frame-contract) from what a pixi-3d `View3D` provides (colour, depth, motion, camera) plus one extra pass for normals and material values. The adapter takes pixi textures and plain structural types, so it builds and type-checks without the beta.
It supports:
- **Probes.** `PixiProbeSet`, captured from pixi-3d renders, plus the view's hemisphere as the environment slot.
- **Screen-space reflections.** The core tracer on pixi's device.
- **The denoiser.** Pass any denoiser with the core `TemporalDenoiser` shape (`denoiser/ffx`) as `denoiser`.
- **A composite.** A pixi `Filter`, and `ReflectionsView`, a sprite that ties the parts together.
It does not have the ray-traced fallback, presets, the hybrid resolve or a one-call `Reflections.create`. See the [adapter comparison](/reflections/guides/adapters).
## Install
```bash
npm install @pmndrs/reflections pixi.js
npm install denoiser # optional
```
| Package | Range | When |
| ---------- | ------------------------------- | --------------------------------------------------------- |
| `pixi.js` | `>=8.22.0 <9` | Always. The tested version is 8.22.0. |
| `@pixi/3d` | closed beta | Always. Not on npm, and not a dependency of this package. |
| `denoiser` | `^2.0.0` (optional, not a peer) | A denoiser for glossy reflections. |
`three`, `@babylonjs/core`, `@pmndrs/raytracer` and `@pmndrs/bvh` are not used by this adapter.
## Minimal setup
The complete code is [`examples/pixi3d/arcade/main.ts`](https://github.com/pmndrs/reflections/blob/main/examples/pixi3d/arcade/main.ts). Import from the pixi entry:
```ts
import { PixiProbeSet, ReflectionsView, ScreenSpaceReflections as PixiScreenSpaceReflections, requestReflectionsDevice } from '@pmndrs/reflections/pixi';
```
### 1. The app, on a device with the right limits
```ts
export async function createApp(): Promise {
const app = new Application();
await app.init({
preference: 'webgpu',
gpu: await requestReflectionsDevice(), // a device with the limits and features the library uses
width: 960,
height: 540,
resolution: 1,
antialias: false,
});
return app;
}
```
### 2. The view
pixi-3d renders colour, depth (`DepthOutputPass`) and motion (`MotionVectorPass`). A fourth pass, `ReflectionsGBufferPass`, writes normals and material values. It is in `examples/pixi3d/shared/reflections.ts`, because the beta does not have it. Then:
```ts
// Optional: probes for what the screen cannot see. The example's ProbeCapture then fills them from six pixi-3d renders.
const probes = new PixiProbeSet(renderer, { capacity: 1, sourceSize: 128 });
probes.setProbes([{ position: [0, 1.2, -1.6], influenceSize: [30, 10, 30], fade: 2 }]);
const view = new ReflectionsView({ renderer, width: 960, height: 540, resolution: 1, probes, denoiser });
view3d.setSize(view.pixelWidth, view.pixelHeight); // pixi-3d renders at the frame's size
app.stage.addChild(view);
// Each frame, before pixi renders the stage:
const frame = () => {
renderer.render({ container: view3d as never, target: view.colorTarget });
view.render({ depth: depthPass.texture, motion: motionPass.texture, gbuffer: gbufferPass.texture }, view3d.camera);
};
```
Call `frame()` from a ticker at `UPDATE_PRIORITY.HIGH`, so it runs before pixi renders the stage. `view.ssr.denoise` turns the denoiser on and off. `view.debugView` picks a debug view.
## The parts
| Piece | What it does |
| -------------------------- | --------------------------------------------------------------------------------- |
| `requestReflectionsDevice` | Creates the device with the limits the library needs, for pixi's renderer to use. |
| `Pixi3DFrame` | The frame contract from a pixi-3d `View3D`'s outputs. |
| `PixiProbeSet` | The core probe set, captured from pixi-3d renders. |
| `ScreenSpaceReflections` | The core tracer on pixi's device. Takes `denoiser`. |
| `ReflectionsFilter` | The composite as a pixi `Filter`. |
| `ReflectionsView` | An all-in-one sprite that ties the parts together. |
## Device limits
`requestReflectionsDevice` asks the adapter for the optional features pixi can use (texture compression, subgroups, timestamp queries and more) and the limits from `reflectionsRequiredLimits`. Pass the result as pixi's `gpu` option. There is no ray-traced pass in this adapter, so the storage-buffer count from the three.js adapter does not apply.
## Known gaps
- Needs the pixi-3d closed beta. Without it the example shows a setup notice.
- No ray-traced fallback, no presets, no hybrid resolve, and no one-call setup. Probes, screen space and the denoiser.
- The G-buffer pass for normals and material values comes from the example, not the package.
- Experimental: names and options can change.
## Live example
The example `examples/pixi3d/arcade` is a neon arcade built with pixi-3d. It is not on the live site, because the beta cannot be bundled. To run it, unpack the beta tarball into `examples/pixi3d/vendor/`. The steps are in [`examples/pixi3d/README.md`](https://github.com/pmndrs/reflections/blob/main/examples/pixi3d/README.md), and `pnpm examples` serves it at `/pixi3d/arcade/`.
]]>
console.log(t)) // GPU ms per pass, from a few frames ago
```
It resolves without blocking the frame. The showcase's panel shows it live. Measure with the render loop stopped (`?manual` on the example pages) and compare numbers from the same machine and the same load.
## A reasonable order
1. Turn on the `performance` preset or lower the render size.
2. Keep the denoiser on.
3. If you use the ray-traced fallback, cap it (`maxTracedRaysPerFrame`) before removing it.
4. Look at the source debug view to see which pixels still cost rays.
5. Only then touch the smaller settings.
## Live examples
- [Presets](/reflections/examples/features/perf/presets/): `default` against `performance`, with GPU time per pass.
- [Upscaling](/reflections/examples/features/perf/upscaler/): render below the display size and upscale after the composite.
- [Compare with a path tracer](/reflections/examples/showcase/compare.html): how close the real-time image gets to a reference.
]]>
\[!NOTE] This page is generated from `docs/SETTINGS.md`, which is generated from the settings schema of the tuning bench (`examples/showcase/bench.html`, also on this site under `/examples/showcase/bench.html`). The notes name the work items they came from (W-numbers and D-numbers); they are the repository's internal ids, kept so each claim can be traced.
Every tuning knob the package and the examples expose, with its default, what it trades and, where one was measured, its GPU cost. The same list drives the tuning bench, `examples/showcase/bench.html`: each row is a control there and a URL key (`bench.html?=`, booleans as 1 / 0), so a link reproduces a view.
- **Default:** the package's default (what you get without passing the option). "examples:" is what the showcase and the bench use where that differs.
- **Apply:** _live_ changes without a reload; _rebuild_ is taken at construction (on the bench: the Rebuild button).
- **Cost:** measured GPU time with its source (docs/HANDOFF.md, docs/DIVERGES.md). Blank: not measured on its own. Small costs add up; a later "fast" preset will need them.
- **Applies to:** the bench's methods (ours raw / denoised / + RT, probes only, three SSR raw / + denoise / + FFX, path traced).
## Presets
Named bundles of the settings below, in core (`REFLECTION_PRESETS`, `reflectionsPreset(name, overrides)`): an adapter applies the tracer part to its pass and the denoiser part to its hybrid resolve, and settings you pass explicitly win key by key. three: `new ScreenSpaceReflectionsPass(renderer, { preset, settings })` and `new HybridReflections(ssr, { preset, denoiser })` at construction, `applyReflectionsPreset({ ssr, hybrid }, name, overrides)` at runtime (rebuild your composites when it returns `resolutionChanged`). Bench: `preset` (the first control). Measurements: docs/research/w77/.
| Preset | Sets | GPU cost | Trade-offs | Don't use it when | With the upscaler |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `default` | Nothing: every key a preset names goes back to what the app passed at construction, else to the package default. | | Full-resolution trace and denoise (the package defaults). | | At ratio 1.5 the reflections are already a small share of the frame (W77), so the upscaler is the bigger saving. |
| `performance` | `reflectionResolution: 'half'`: trace, RT and denoise at half size in each axis, joint bilateral upsample. No denoiser hit source (maintainer, 2026-11-13: flicker first); that stays its own switch (Denoiser group, `hitSource`). | Relative only, re-time on a quiet machine (W77: 1080p, ratio 1, RT, cone defaults, GPU shared with other runs, least-contended page, measured with the hit source on, which W53 puts at +0.35 ms): reflection passes about halve, carConcept 6.0 -> 2.6 ms, chess 4.0 -> 1.6, Sponza 3.3 -> 2.4, mirrorWall 10.7 -> 5.0, contact 12.4 -> 7.4. At ratio 1.5 about -1 ms; at ratio 2 nothing (its half-res sample + upsample passes eat the saving). | W77 bench vs the path tracer (960x540, ours-rt, ratio 1): carConcept frame MAD 7.8 -> 8.9, lip 41.8 -> 50.0, sill band 30.6 -> 57.9 (the half-res denoiser covers twice the screen area); chess 6.9 -> 7.2; Sponza unchanged. Orbit flicker of the reflection: carConcept 0.36 -> 0.41, chess 0.23 -> 0.25, Sponza 0.53 -> 0.55. Mirrors: jagged reflected edges (W75). A thin bright reflection loses most of its peak at r 0.05 and is lost at r 0.15 (line spread). | With an upscale ratio of 2 (no saving, thin features lost, carConcept door MAD +4); when the frame already upscales at 1.5 or more and reflections are a small share; mirror close-ups whose reflected edges must stay crisp; thin bright emitters (neon strips, specular lines) on glossy floors; RT scenes whose silhouettes over a mirror floor matter (the car sill: add hitSource 'hits' if its flicker is acceptable). | Use it at ratio 1. At 1.5 it still saves \~1 ms but stacks: a thin strip at r 0.05 is lost, mirrorWall orbit flicker +17 %. Not at 2. Given the choice, upscale 1.5 first (the whole frame shrinks) and keep full-res reflections. |
## Preset
A named bundle of the settings below (core `REFLECTION_PRESETS`, W77): see "Presets" above for what each one sets, costs and trades. Keys you set explicitly win over the preset.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ------- | -------- | ----------------------------------------------------------------------------------------------------------- | --------- | ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------- |
| Preset | `preset` | ScreenSpaceReflectionsPass({ preset }) + HybridReflections({ preset }); applyReflectionsPreset() at runtime | `default` | `default`, `performance` | rebuild | Sets the URL keys the preset names (performance: s.reflectionResolution half) wherever the URL doesn't set them; the controls of those keys keep showing their own value. Clearing a key returns it to the preset's value. | | ours |
## Anti-aliasing / upscaler
Display AA after the composite (examples/shared/antialias.ts, W36): @pmndrs/upscaler at ratio 1 acts as TAA and smooths the last fireflies. Same choice on ours and on three's SSR; the path tracer needs none.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ---------------------- | ------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------ |
| AA mode | `aa` | examples DisplayAA (mode) | examples: `upscaler`; examples-side; bench and showcase upscaler, compare page off | `upscaler`, `taa`, `off` | live | The upscaler accumulates up to 128 jittered frames: edges, normal-mapped highlights and the denoised reflections' last 1-3/255 shimmer settle (W36, W40). Off shows the raw per-frame image (what compare.html showed: aliased). | the upscaler's own passes show under GPU time (its timer); not in HANDOFF | ours + three SSR |
| Upscale | `upscale` | examples DisplayAA (ratio) | examples: `native` | `native`, `quality`, `balanced`, `performance`, `ultra` | rebuild | G-buffer, reflections and the denoiser run at the render size and the upscaler rebuilds the display size: every reflection pass scales with the pixel count; softer at higher ratios. Ours only: three's SSR side keeps ratio 1 (D3620). | | ours (incl. probes only) |
| Reactive mask | `reactive` | examples reflectionReactive (D4202) | examples: 0 | 0 .. 1 | live | Upscaler favours the current frame where reflections move with the pixel: less reflection ghosting on moving surfaces, more of their noise. 0 = off. | | ours (incl. probes only) |
| RCAS sharpness | `sharpness` | @pmndrs/upscaler settings.sharpness | 0.8; examples: 0 | 0 .. 1 | live | RCAS after the upscale. The pages run 0 (D4201): 0.8 sharpened each jitter phase differently, mirror-edge flicker at rest 0.16% -> 4.2% of px. | | ours + three SSR |
| Max accumulation | `accum` | @pmndrs/upscaler settings.maxAccumulation | 24; examples: 128 | 1 .. 256 | live | History length: longer is calmer at rest, ghosts longer in motion. 24 leaves the reflections' residual noise at rest (0.48% vs 0.02% px, W36). | | ours + three SSR |
| RCAS denoise | `aa.rcasDenoise` | @pmndrs/upscaler settings.rcasDenoise | off | on / off | live | Damps sharpening on lone luma outliers (noisy inputs); only matters with sharpness > 0. | | ours + three SSR |
| Auto pre-exposure | `aa.autoExposure` | @pmndrs/upscaler settings.autoExposure | on | on / off | live | Pre-exposure from the scene luminance for the invertible tonemap the history accumulates in; off uses the fixed pre-exposure below. | | ours + three SSR |
| Pre-exposure | `aa.exposure` | @pmndrs/upscaler settings.exposure | 1 | 0.1 .. 8 | live | Fixed pre-exposure (ignored while auto is on); divided out again, so it only conditions the accumulation. | | ours + three SSR |
| Lock thin features | `aa.lockThinFeatures` | @pmndrs/upscaler settings.lockThinFeatures | on | on / off | live | Protects stable sub-pixel features from history rectification (less shimmer on thin parts; can hold a stale value longer). | | ours + three SSR |
| Detect shading changes | `aa.detectShadingChanges` | @pmndrs/upscaler settings.detectShadingChanges | on | on / off | live | Ages the history where shading really changed (a light, a bake) so it re-converges instead of ghosting. | | ours + three SSR |
## Scene
What every method renders: scene, camera, floor, tone mapping, exposure, size.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ----------------------- | ---------------- | --------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------ |
| Scene | `scene` | | examples: `carConcept` | `carConcept`, `toyCar`, `chess`, `sponza`, `lineSpread`, `lineSpreadThin`, `grazing`, `cubeFloor`, `edgesFloor`, `plateFloor` | rebuild | Reloads every method on the new scene (downloaded assets; X0's lineSpread / grazing are procedural, W70). | | page |
| Camera | `pose` | | examples: `hero` | `hero`, `low`, `front`, `close`, `top`, `w50`, `e5`, `e15`, `e30`, `e60` | live | Camera preset (orbit freely after). The named Measure regions for carConcept are defined at `w50` (W50) and `hero` (W46). | | page |
| Debug view (ours) | `view` | examples showcase/src/debugViews.ts (the showcase's Debug view) | examples: `final` | `final`, `split`, `off`, `ibl`, `reflections`, `source`, `rtSource`, `confidence`, `ssrWeight`, `hitDistance`, `hitRadiance`, `signal`, `specular`, `denoiseDelta`, `probeSpecular`, `ao`, `specularOcclusion`, `traced`, `depth`, `depthEdges`, `normals`, `roughness`, `shadingRoughness` | live | What ours draws: the showcase's debug views plus depth / normals / roughness. Source: green SSR hit, blue traced hit, orange probe, magenta environment, grey rough (untraced). rtSource: blue traced hit, cyan traced hit coloured from the screen, magenta traced miss, orange over budget. denoiseDelta: red where the denoiser added light, blue where it took light away (x4). Measure reads whatever is shown. | | ours (incl. probes only) |
| Exposure | `exposure` | renderer.toneMappingExposure | per scene | 0.2 .. 3 | live | Display exposure, every method alike. | | every method |
| Tone mapping | `tone` | renderOutput(..., toneMapping) | examples: `agx` | `agx`, `neutral`, `aces` | rebuild | Display transform, every method alike. Measure's numbers are in this display space. | | every method |
| Render size | `size` | | examples: `960x540` | `960x540`, `1280x720`, `1920x1080`, `1280x1280` | rebuild | Each method's canvas (`?w=&h=`). W52 (D3643): the skirt halo is mostly a 960x540 effect (lip 48 vs PT 46 at 1920x1080). W50: at 960x540 the car has 2.4x fewer px across than the showcase's 1280x1280 shots, most of the "detail loss" seen there. | | page |
| Floor material | `floor` | | examples: `mirror` | `mirror`, `lacquer` | live | The stages' floor disc (not Sponza). The path tracer rebuilds. | | every method |
| Floor roughness | `floorRoughness` | | per scene (stages 0.03) | 0 .. 0.6 | live | Floor roughness, every method; ours re-bakes its probes. The path tracer rebuilds. | | every method |
| Polished floor (Sponza) | `floorPolish` | | examples: on | on / off | live | Sponza's polished override of its `Floors` material; off = the asset's rough stone. | | every method |
| Background blur | `bgBlur` | | examples: 0 | 0 .. 1 | rebuild | Backdrop blur (display only; lighting unchanged). The compare / bench show it sharp so every method shows the same backdrop (the PT blurs differently); the showcase uses 0.35. | | every method |
| Environment light scale | `envLight` | | examples: 1 | 0 .. 3 | rebuild | W58: scales the image-based light (scene.environmentIntensity): three's IBL, the probe bake and the path tracer's environment. 0 leaves the key light alone (with keyLight: what share of a look is the HDRI). | | every method |
| Background | `background` | | examples: `hdri` | `hdri`, `black` | rebuild | W58: black hides the backdrop the camera sees (backgroundIntensity 0); lighting and reflections keep the environment. | | every method |
| Key light scale | `keyLight` | | examples: 1 | 0 .. 3 | rebuild | Scales every directional / spot / point light (W45: what share of a reference is the key light). | | every method |
## Screen-space (SSSR)
`ScreenSpaceReflectionsPass.settings` (core `ScreenSpaceReflectionsSettings`), read every frame.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ------------------------------ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| Screen-space march | `ssr` | settings.maxTraversalIntersections = 0 when off | examples: on | on / off | live | Off: no screen-space march, every ray goes to the miss list (RT traces all of them on ours + RT; the rest take the probe). Judges what SSR adds. | | ours |
| Roughness threshold | `s.roughnessThreshold` | settings.roughnessThreshold | 0.447 | 0 .. 1 | live | Perceptual roughness above which a pixel skips the trace and takes the probe / environment only (D43). Higher traces rougher surfaces: more rays, more noise for the denoiser. The examples' denoiser gate follows it (W34). | SSR passes 0.81-0.91 ms at 1080p at the default (pyramid 0.17-0.21, classify 0.10-0.11, intersect 0.53-0.58; W6); scales with traced px | ours |
| Samples per quad | `spq` | settings.samplesPerQuad | 1 | `1`, `2`, `4` | live | Rays per 2x2 quad for glossy (non-mirror) pixels. More rays, less noise: spq 4 lowered denoised std 0.14 -> 0.10 on a 0.25 floor (W21). | intersect grows about linearly in glossy rays (0.53-0.58 ms at 1080p at 1, W6) | ours |
| Quad copy | `s.quadCopy` | settings.quadCopy | `always` | `always`, `sameSurface` | live | W58 (D3740): with samplesPerQuad < 4 a quad shares one ray. 'always' copies it to every glossy px of the quad, across a silhouette too: on carConcept the skirt's reflection lands on the mirror floor below it (bright 2x2 dashes, raw) and the floor's on the skirt, the stair-stepped raw edge the denoiser then spreads. 'sameSurface' gives px on another surface (depth > 5 %, normal > \~25 deg) their own ray. carConcept w50 960x540, lip / band MAD vs PT raw 18.6 / 14.0 -> 11.5 / 12.2, denoised 41.5 / 30.6 -> 34.4 / 26.9 (spq 4: 11.2 / 13.5, 34.3 / 27.7). | 1080p: classify +0.02, intersect +0.02, rt trace \~+0.2 ms (carConcept w50, W58) | ours |
| Max candidates | `s.maxCandidates` | settings.maxCandidates | 1 | 1 .. 8 | live | W80 (D5180): hits tried per ray. 1 = FFX (the first hit is validated once, a reject is a miss). More restarts the march past a rejected leaf cell (a thin foreground object, a back face) and keeps going, sharing the march-step budget; every leaf cell behind an object is another candidate, so it only gets through overlaps a few px wide, and it cannot find a surface the camera does not see. A 6 cm post in front of a wall (examples/ssr scene thinPost, 960x540): nothing changes up to 4, at 8 the wall class 0.944 -> 0.988 confident and misses -27 % at 1080p; the other examples scenes and carConcept do not move (lip / band MAD vs PT unchanged). | 1080p, intersect: mirrorWall 0.93 -> 1.06 / 1.16 / 1.21 ms at 2 / 4 / 8, thinPost 0.96 -> 1.25 at 8 (about +0.25 ms at 8); carConcept w50 within noise (W80) | ours |
| Reflection resolution | `s.reflectionResolution` | settings.reflectionResolution | `full` | `full`, `half` | rebuild | W75 (X5, D5080): 'half' point-samples the G-buffer at one pixel per 2x2 quad, traces (SSR + RT) and denoises there, and upsamples the residual (denoised - probe) with a joint bilateral filter (plane distance, normal, roughness). Fewer rays and a quarter of the denoiser's pixels; mirrors and thin edges lose resolution (step 1: everything at half res). carConcept w50 MAD vs PT denoised: band 30.6 -> 58.3, lip 41.5 -> 50.5 (raw +0.4..+2.4). | 1080p, AA off, rt (W75 phase 2): carConcept frame sum 14.0 -> 10.6 ms (rt trace 2.53 -> 0.89, denoise 1.94 -> 0.51, upsample +0.37, half-res sample +0.16); contact 11.2 -> 9.0; mirrorWall 8.2 -> 6.6 | ours |
| Ray reuse | `s.rayReuse` | settings.rayReuse | `copy` | `copy`, `ratio` | live | W73 (X3, D5040): what a glossy px without its own ray gets. 'copy' pastes its quad's ray (FFX). 'ratio' resolves every glossy px from its own ray, its quad's and s.rayReuseTaps neighbours within s.rayReuseRadius, weighted by its own BRDF along the direction to each neighbour's hit over that ray's pdf (SSSR 2015, DiligentFX); same surface only. The target: ratio at spq 1 about as quiet as copy at spq 4. Experiment; the FFX denoiser still runs after it. | one extra pass + 16 B/px record buffer (not timed yet: shared GPU) | ours |
| Ray reuse taps | `s.rayReuseTaps` | settings.rayReuseTaps | 8 | `4`, `8` | live | W73: neighbour taps of the ratio resolve besides the px's own quad. Only with s.rayReuse ratio. | | ours |
| Ray reuse radius | `s.rayReuseRadius` | settings.rayReuseRadius | 4 | 0 .. 16 | live | W73: tap radius in px at perceptual roughness >= 0.2, x sat(5 r) below (DiligentFX's 4 sat(5 r)). Wider is quieter and blurs more (the line-spread gate). Only with s.rayReuse ratio. | | ours |
| Ray reuse tap pattern | `s.rayReusePattern` | settings.rayReusePattern | `frame` | `frame`, `pixel` | live | W73 (D5046): the ratio taps re-rotated per pixel and frame (the resolve's error moves every frame) or fixed per pixel (it stays put, for the denoiser's temporal pass). Only with s.rayReuse ratio. | | ours |
| Ray reuse: mix hits and misses | `s.rayReuseMixSources` | settings.rayReuseMixSources | off | on / off | live | W73 (D5047): off (default), the ratio resolve reuses only rays of the px's own hit source (screen hit vs miss, D3660). On, it also averages the hit / miss pattern, but the confidence then is a share of hits and the depth-aware blend (h.depthAware, D2400) hands the hits the whole weight: carConcept door raw 1.04 -> 1.38 linear (SSR only). Use with h.depthAware 0. | | ours |
| Quad base rotation | `s.quadBaseRotation` | settings.quadBaseRotation | `fixed` | `fixed`, `frame`, `pattern` | live | W71 (X1 #1, D5000): which px of a 2x2 quad traces when samplesPerQuad < 4. 'fixed' keeps the copy's 2x2 grid in place (it can show under TAA / the upscaler and drift in blocks at rest); 'frame' / 'pattern' move it every frame, so the history averages it out. Composes with Quad copy 'sameSurface'. | classify +0.06 ms at 1080p (pattern: 0.154 -> 0.211, contact + RT; intersect / rt trace within noise; W71) | ours |
| Max march steps | `s.maxTraversalIntersections` | settings.maxTraversalIntersections | 128 | 0 .. 256 | live | Hi-Z march steps per ray: fewer is cheaper and sends long rays to the miss list (probe or RT); 0 = SSR off. | | ours |
| Min occupancy | `s.minTraversalOccupancy` | settings.minTraversalOccupancy | 0 | 0 .. 64 | live | Glossy rays stop once this few lanes of their subgroup still march (FFX's early exit, FFX: 4): higher ends long tails earlier (cheaper, more misses). Mirrors ignore it. W101 (D5560): 0 by default. Subgroup membership follows the ray list's atomic order, which changes every dispatch, so with the exit a still frame traces differently each time: at 4, quickstart rest flicker 0.30-0.32 % of px (0 gives 0.24-0.25), engines/three rest 0.0078-0.0081 / 255 (0 gives 0.0072-0.0075), contact orbit std +5 %; 0 also finds hits the exit dropped (contact: image 0.18 / 255 mean vs a 0.10 noise floor). | 0 vs 4, 1080p intersect: +0.05-0.14 ms on glossy scenes (contact, Sponza, carConcept; +10-21 % of the pass, 2-6 % of the tracer), mirrorWall 0; half res +0.03-0.06 ms (W101) | ours |
| Thickness | `s.depthBufferThickness` | settings.depthBufferThickness (THICKNESS_HYBRID) | 0.2; showcase scenes set their own (kit.thickness) | 0 .. 0.5 | live | Hit acceptance thickness in view-space units. Thicker accepts rays that pass behind objects (streaks, the dark band under carConcept's sill, D2402); thinner cuts holes (FFX's 0.015 holes the sphere, D4303). Room scale 0.2 is too thick for a car (W11). | | ours |
| Thickness per alpha | `s.thicknessRoughnessFactor` | settings.thicknessRoughnessFactor | 10; showcase scenes set their own | 0 .. 20 | live | Thickness added per unit of the pixel's alpha: rough rays need less precision (D1001). | | ours |
| Thickness per ray length | `s.thicknessLengthFactor` | settings.thicknessLengthFactor | 0.01 | 0 .. 0.1 | live | Thickness added per world unit of ray length: far hits are coarser (D1001). | | ours |
| Thickness per view depth | `s.thicknessDepthFactor` | settings.thicknessDepthFactor (RT_THICKNESS_DEPTH_FACTOR) | 0; with RT on and the mode 'relative': 0.02 (W76) | 0 .. 0.1 | live | W71 (X1 #2, D5001): thickness += k x the hit's view depth, so one value scales from a toy car to a hall (with mode 'relative' it is the whole thickness: Diligent's distance / viewZ < 0.025 is k 0.025). 0 = off. | intersect +0.008 ms at 1080p (add, k 0.01); relative: none measured (contact + RT, W71). Relative 0.01 sends 9-13 % more rays to the miss list. W76, the RT default (relative 0.02, rough: re-time on a quiet machine): traced rays Sponza +15 % (rt trace \~+0.1 ms at 1080p), mirrorWall +3 %, carConcept 0 | ours |
| Thickness depth mode | `s.thicknessDepthMode` | settings.thicknessDepthMode | `add`; with RT on: `relative` (W76) | `add`, `relative` | live | W71 (X1 #2, D5001): how Thickness per view depth combines. 'relative' drops the constant, per-alpha and per-length terms; it takes effect only once Thickness per view depth is above 0 (k 0 = off in both modes). | | ours |
| Most detailed mip | `s.mostDetailedMip` | settings.mostDetailedMip | 0 | 0 .. 4 | live | Pyramid mip glossy rays start on: higher is cheaper and coarser. Mirrors always use 0. | | ours |
| Hit colour | `hit` | settings.hitColor (+ historySource) | `current`; examples: `final` | `final`, `lit`, `current` | live | `current` (FFX, the package default) has no reflections in reflections: a mirror seen in a mirror is black (W9: 99.6% px). `final` reprojects last frame's final image (D69, D1002): mirror-in-mirror, one frame late, can ghost. | | ours |
| Hit specular (re-shade) | `reshade` | settings.hitShading | `reshade` | `reshade`, `off` | live | W44 (D3540): a hit keeps its screen diffuse and evaluates its specular along the ray. Fixes carConcept's reflected door (48 -> 100 vs PT 118, W50); with the lobe filter and the denoiser it is the halo under the door / skirt (lip 37 -> 80 vs PT 48, D3610). | intersect +0.003..0.017 ms at 1280x720 (D3540) | ours |
| Hit lobe filter | `lobeFilter` | settings.hitLobeFilter (DEFAULT_HIT_LOBE_FILTER) | 1 | 0 .. 2 | live | W45 (D3550): a hit's specular looked up wider by k x the pixel's alpha (filtered importance sampling): same mean, less variance, so the denoiser stops clipping rare softbox samples (RT door 111 -> 155). 0 = the hit's own roughness (W44); 1 default; 1.5 wider. W50, carConcept + RT: lip 53 at 0 vs 80 at 1 (PT 48), door 110 either way. Double-blurs the lobe (x1.41 alpha at 1). | part of the re-shade's +0.003..0.017 ms (one lookup at another lod) | ours |
| Lobe filter where hits mix | `s.hitLobeFilterMixed` | settings.hitLobeFilterMixed (+ traceSettings) | 1 | 0 .. 1 | live | W52 (D3641): the lobe filter x this where traced and screen-space hits mix (last frame's source around the pixel). W50's halo: lip 80 -> 56 at 0, but the skirt 50 -> 23 (PT 35), and it overshoots at 1080p (D3643: the halo is mostly a 960x540 effect). Below 1 the tracer is rebuilt once (one more sampled texture). | +0.07 ms (W52) | ours |
| Re-shade occlusion | `s.hitShadeOcclusion` | settings.hitShadeOcclusion (+ traceSettings) | `off` | `off`, `screen` | live | W52 (D3642): a re-shaded hit marches the depth buffer along R and darkens where blocked (the re-shade had no occlusion, W44). Wheel 43 -> 37 (PT 26); works without RT. Untuned. | intersect +0.04 ms (W52) | ours |
| Mirror bias | `s.mirrorBias` | settings.mirrorBias (DEFAULT_COMPENSATED_MIRROR_BIAS) | 0.5; W76: 0.5 with the cone + compensation (the defaults), else 0 | 0 .. 0.99 | live | D49: truncates the GGX lobe toward the mirror direction: less noise, a sharper (biased) reflection. W32 / W39: no gain with the denoiser on a still or orbiting camera; W40: 0.7 halves rest shimmer on the carConcept floor (0.31 -> 0.14/255). | free (one multiply in the sample) | ours |
| Hit colour filter | `s.hitColorFilter` | settings.hitColorFilter (DEFAULT_HIT_COLOR_FILTER; the tracer builds its variant async on the first 'cone' frame) | `cone`; W76: `cone` with compensation at mirror bias 0.5; `off` is the one switch back to the pre-W76 tracer (bit for bit) | `off`, `cone` | live | W72 (X2 #5, D5020): a screen-space hit reads its screen colour (the re-shade's diffuse) from an 8-level pyramid at log2 of the lobe cone's width in px where the ray hits: long rays blur, contacts stay sharp (SSSR 2015). Raw fireflies go (r 0.35 sphere p999 23.9 -> 3.2 x mean, grazing emissive wall raw MAD 32 -> 8 at 5 deg); no widening on the line spread (r 0.05 x1.24 -> 1.22) and no leakage at silhouettes, but alone it brings no lost glossy reflection back and the denoised grazing floor gets blurrier (gradient x0.79 -> 0.40). Use it with Compensate mirror bias. | W76 (rough, shared GPU: re-time on a quiet machine): hit colour pyramid pass 0.24-0.27 ms at 1080p, 0.43-0.63 ms at 1440p (carConcept, Sponza, mirrorWall, RT on, loop stopped, interleaved A/B); intersect within the noise. W72: +0.24-0.26 ms at 1080p | ours |
| Hit colour cone grazing shrink | `s.hitColorConeGrazing` | settings.hitColorConeGrazing (DEFAULT_HIT_COLOR_CONE_GRAZING) | 0 | 0 .. 1 | live | W76 (X1 #3 folded into the cone, D5100): the cone x mix(1, mix(sat(2 NdotV), 1, sqrt(roughness)), this) (SSSR 2015 slide 85 at 1), so a floor seen at a grazing angle reads a finer pyramid mip. X0 grazing (r 0.15 floor, cone + compensation 0.5): denoised gradient vs PT at 5 / 15 deg x0.53 / 0.53 at 0 -> x0.59 / 0.58 at 0.5 -> x0.67 / 0.63 at 1 (pre-W76 x0.79 / 0.75), denoised MAD at 5 deg 6.98 -> 6.50, at 15 deg 8.91 -> 9.24; 60 deg unchanged. But the line-spread gate's r 0.15 line (seen at 15 deg) narrows past +-10 %: x1.01 at 0 -> x0.91 at 0.5 -> x0.84 at 1 (AA on; AA off x0.96 / 0.86 / 0.93), so off by default. Only with the cone. (W71's hitLobeFilterGrazing, the same shrink on the lobe filter, was a no-op and is gone.) | part of the intersect (one normal load per cone hit); see Hit colour filter | ours |
| Hit colour cone scale | `s.hitColorConeScale` | settings.hitColorConeScale | 1 | 0 .. 4 | live | W72 (D5020): scales the cone of Hit colour filter (1 = the reflected GGX lobe's full width at half maximum, 2.57 alpha). Only with the cone on. 2 widens the line spread (r 0.05 x1.22 -> 1.33): keep 1. | free | ours |
| Compensate mirror bias | `s.mirrorBiasCompensate` | settings.mirrorBiasCompensate (DEFAULT_MIRROR_BIAS_COMPENSATE; the RT pass follows the tracer, mirrorBiasSplit) | on | on / off | live | W72 (X2 #6, D5021-D5022; needs Hit colour filter cone): Mirror bias f narrows the sampled lobe to alpha sqrt(1 - f) instead of truncating it, and the cone and the lobe filter (SSR and RT) supply alpha sqrt(f): less noise at the same total width. At f 0.5 the line spread's r 0.15 reflection, lost at the defaults, comes back at x0.99 of the PT (AA off x0.95) and r 0.05 narrows x1.24 -> 1.18; truncation (no compensation) brings it back at x0.55 (too sharp). Grazing denoised MAD -0.7..-1.0 at 5-15 deg but blurrier. f 0.7 x0.93 (AA off x0.88). | free on top of the cone (scales in the sample and the lobe filter); the default cone + compensation together: the cone's pyramid pass (W76, rough: re-time on a quiet machine) | ours |
| Miss fallback roughness | `s.fallbackRoughness` | settings.fallbackRoughness (+ traceSettings.fallbackRoughness) | `surface` | `surface`, `mirror` | live | D1806: where a ray misses, the probe at the pixel's own roughness (blurred, low noise) or at roughness 0 along the ray (FFX; the denoiser has to blur it). | | ours |
| Variance-guided tracing | `s.temporalVarianceGuidedTracing` | settings.temporalVarianceGuidedTracing | on | on / off | live | Extra rays where last frame's variance is high. No effect here: the seam passes no variance back to the tracer (W21). | | ours |
| Variance threshold | `s.varianceThreshold` | settings.varianceThreshold | 0 | 0 .. 1 | live | Variance above which variance-guided tracing adds rays (no effect without a variance input). | | ours |
| IBL factor (tracer) | `s.iblFactor` | settings.iblFactor | 1 | 0 .. 2 | live | Scales the tracer's own radiance fallback. The three adapter forces that fallback black (the composite adds the probe), so no visible effect here. | | ours |
| Temporal stability (tracer) | `s.temporalStabilityFactor` | settings.temporalStabilityFactor | 0.7 | 0 .. 1 | live | Carried in the tracer's uniform block for a denoiser; unused by these passes (the denoiser has its own, below). | | ours |
| Frame index (freeze noise) | `s.frameIndex` | settings.frameIndex | increments per dispatch | 0 .. 1023 | live | Fixes the blue-noise rotation: a still noise pattern to judge structure without the temporal part (the denoiser then sees the same samples every frame). | | ours |
## Ray tracing
The ray-traced fallback over the SSR miss list: provider, which misses are traced, and `ScreenSpaceReflectionsPass.traceSettings`.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| -------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------- |
| Ray-traced fallback | `rt` | pass.rayTracing | on | on / off | live | On the ours + RT method: traced rays for the SSR misses. Off shows the same instance without them (= ours denoised). | | ours-rt |
| Builder (@pmndrs/bvh) | `bvhBuilder` | createRaytracerTraceProviderFromObjects({ builder }) | `auto` | `auto`, `gpu-hploc`, `gpu-lbvh`, `tinybvh` | rebuild | Tree builder: build time and tree quality (trace cost); same hits. | | ours-rt |
| Raytracer hit shading (opt-in) | `rtShade` | trace.raytracerHitShading (pass.setRaytracerHitShading) | off | on / off | rebuild | W82 (T70, D5201): traced hits are shaded by @pmndrs/raytracer's one bounce (emission + one light sample with a shadow ray, diffuse + GGX) instead of the probe lookup; stochastic, so meant for the denoised frame. Off (default): the probes shade traced hits, as before. The traced pass binds 7 storage buffers with it (8 with probe hit shading; W89, D5450): WebGPU's default 8 suffice. | one light sample and its shadow ray per traced hit; not measured separately | ours-rt |
| Interpolated hit normals | `rtShadingNormals` | provider option shadingNormals | on | on / off | rebuild | D1700: traced hits shade with the vertex normals (smooth, as three shades on screen) instead of the face normal (faceted). | up to +0.07 ms at 1080p (D1700, measured on a former provider) | ours-rt |
| Glossy threshold (traced) | `s.missRoughnessThreshold` | settings.missRoughnessThreshold | 1 | 0 .. 1 | live | Only misses at perceptual roughness <= this go to the ray tracer (FFX hybrid sample: 0.469). Lower = fewer traced rays (cheaper); rougher misses keep the probe. | trace 0.357 ms at 174k misses -> 0.535 ms at 281k (1080p, W8) | ours-rt |
| Miss confidence | `s.missConfidenceThreshold` | settings.missConfidenceThreshold | 0.9 | 0 .. 1 | live | A ray goes to the miss list when its SSR confidence is below this: higher traces more edge-faded rays. | | ours-rt |
| Ray budget per frame | `t.maxTracedRaysPerFrame` | traceSettings.maxTracedRaysPerFrame | unlimited | 0 .. 2000000 | live | Caps the traced rays (D9); entries past it keep the probe. A fair share per tile, rotating (D1100). | | ours-rt |
| Rays per 8x8 tile | `t.maxRaysPerTile` | traceSettings.maxRaysPerTile | 64 | 1 .. 64 | live | Per-tile cap (D9, D56): spreads a capped budget over the screen. | | ours-rt |
| Max ray length | `t.maxRayLength` | traceSettings.maxRayLength | 100 | 0 .. 200 | live | World-unit cap at roughness 0 (FFX hybrid sample); shorter is cheaper and misses far content. | | ours-rt |
| Ray length falloff | `t.rayLengthRoughnessFalloff` | traceSettings.rayLengthRoughnessFalloff | 5 | 0 .. 20 | live | cap = maxRayLength x exp(-falloff x alpha): rough rays stay short. | | ours-rt |
| Origin offset | `t.normalOffset` | traceSettings.normalOffset | 0.003 | 0 .. 0.02 | live | Origin pushed along N by this x view distance: too small self-hits (acne), too large skips contact. | | ours-rt |
| Reuse on-screen hits | `t.reuseOnScreenHits` | traceSettings.reuseOnScreenHits | on | on / off | live | D55: a traced hit the camera sees takes the screen colour (re-shaded with the re-shade on, D3542) instead of the probe-lit hit shading. | | ours-rt |
| Hit shadow rays | `t.hitShadows` | traceSettings.hitShadows | on | on / off | live | D903: one shadow ray per directional light from each traced off-screen hit; off lights every hit unoccluded. | <= 0.03 ms on 3 of 4 scenes (D903); 'moving' 1080p +0.081 ms (D2601, the former @pmndrs/bvh wrapper) | ours-rt |
| Hit specular lobe | `t.hitSpecular` | traceSettings.hitSpecular | on | on / off | live | D3510: traced hits shade their specular lobe and coat (with D3513's one visibility ray); off = diffuse + emissive only. | | ours-rt |
| Hit lobe filter (traced) | `rtLobeFilter` | traceSettings.hitLobeFilter | the tracer's (Hit lobe filter) | 0 .. 2 | live | Overrides the lobe filter at traced hits only (the compare page's ?rtLobeFilter=): separates the W45 effect on RT hits from the screen-space ones. | | ours-rt |
| On-screen depth tolerance | `t.onScreenDepthTolerance` | traceSettings.onScreenDepthTolerance | 0.02 | 0 .. 0.1 | live | Relative view-distance tolerance for "the camera sees this hit": looser reuses more screen colour (cheaper shading, can pick a neighbour). | | ours-rt |
| IBL factor (traced) | `t.iblFactor` | traceSettings.iblFactor | 1 | 0 .. 2 | live | Scales the traced misses' fallback. | | ours-rt |
| Visibility ray on re-shaded hits | `t.hitShadeVisibility` | traceSettings.hitShadeVisibility | `offscreen` | `offscreen`, `all` | live | W52 (D3640): D3513's visibility ray along R for on-screen re-shaded traced hits too. Wheel 43 -> 41 vs PT 26 (carConcept); mirrors seen in mirrors go black where blocked (facingMirrors, D3542). Needs Hit shadow rays on. | rt trace +0.30 ms (W52) | ours-rt |
| Traced miss rate (glossy) | `t.tracedMissRate` | traceSettings.tracedMissRate (or settings.tracedMissRate; traceSettings wins) | `full` | `full`, `half` | live | W74 (X4, D5060): 'half' traces the glossy misses of every other 2x2 quad (a checkerboard flipping each frame); the others take their traced neighbours' result through core bilateralFill (plane distance, normal power, roughness, same source), or the probe where none fits. Half the glossy BVH rays; mirrors and near-mirrors stay full rate. | | ours-rt |
| Half rate from roughness | `t.tracedHalfRateMinRoughness` | traceSettings.tracedHalfRateMinRoughness (or settings.; DEFAULT_TRACED_HALF_RATE_MIN_ROUGHNESS) | 0.05 | 0 .. 1 | live | W74: perceptual roughness from which 'half' applies; smoother misses are all traced (mirror-like floors and paint keep their sharp reflections). | | ours-rt |
| Fill: plane tolerance | `t.fillPlaneTolerance` | traceSettings.fillPlaneTolerance (BilateralFillWeights.planeTolerance) | 0.01 | 0 .. 0.1 | live | W74: a neighbour farther than this x the view distance from the pixel's tangent plane takes no weight (silhouettes, steps). 0 = off. | | ours-rt |
| Fill: normal power | `t.fillNormalPower` | traceSettings.fillNormalPower | 16 | 0 .. 128 | live | W74: pow(dot(n_p, n_q), k): higher keeps the fill on one face (curved and normal-mapped surfaces fall back to the probe more). 0 = off. | | ours-rt |
| Fill: roughness tolerance | `t.fillRoughnessTolerance` | traceSettings.fillRoughnessTolerance | 0.1 | 0 .. 1 | live | W74: perceptual roughness difference at which a neighbour's weight reaches 0. 0 = off. | | ours-rt |
| Fill: accepted sources | `t.fillSourceMask` | traceSettings.fillSourceMask | 22 | 0 .. 31 | live | W74: RT_SOURCE codes a neighbour may have, one bit each: 22 = traced hit (2) + traced miss (4) + on-screen traced hit (16). +1 also takes screen-space hits, +8 capped entries. | | ours-rt |
| Fill: min weight sum | `t.fillMinWeightSum` | traceSettings.fillMinWeightSum | 0.01 | 0 .. 1 | live | W74: below this the pixel keeps intersect's probe fallback (as an entry past the ray budget). | | ours-rt |
| Fill: footprint (quads) | `t.fillFootprint` | traceSettings.fillFootprint | 3 | `3`, `2`, `4` | live | W74: quads gathered around the pixel's own; 3 reaches the 4 traced edge neighbours of the checkerboard, 4 also the next ring (wider, softer). | | ours-rt |
## Hybrid / composite
`HybridReflections` and its composite.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| -------------------------- | --------------------- | ----------------------------------------- | ------------- | --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------ |
| Depth-aware blend | `h.depthAware` | hybrid.depthAware.value | 1 | 0 .. 1 | live | D2400: keeps the probe off hits it lies behind (1); 0 = FFX's confidence blend (the wall pattern showed through the reflected sphere, W22). | | ours |
| SSR / RT amount | `h.amount` | composite().amount.value | 1 | 0 .. 1 | live | Share of the traced reflection in the composite: 0 = probes only, for an A/B on one instance. | | ours |
| Specular occlusion (GTAO) | `specOcc` | HybridReflections({ ao }) (examples GTAO) | examples: off | on / off | rebuild | Lagarde's specular occlusion from screen-space AO on the probe / environment part (D66, D4510). Darkens probe-filled creases; traced misses skip it (D3551); grainy without a blur (backlog). | 960x540 2.1 -> 2.3 ms wall per frame (D4510; GTAO included) | ours (incl. probes only) |
| Denoiser motion convention | `h.denoiserMotion` | HybridReflections({ denoiserMotion }) | `ndc` | `ndc`, `uv` | rebuild | A convention, not a tuning knob: match your denoiser (the wrong one misreprojects and smears). | | ours denoised, ours + RT |
| Denoiser roughness space | `h.denoiserRoughness` | HybridReflections({ denoiserRoughness }) | `perceptual` | `perceptual`, `alpha` | rebuild | A convention: match the denoiser's `roughnessIsPerceptual`. | | ours denoised, ours + RT |
## Denoiser
`FfxReflectionDenoiser` (denoiser/ffx) behind the denoise seam. Its options are taken at construction: the bench rebuilds it on change (history drops).
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ------------------------------ | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | --------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------ |
| Denoise | `denoise` | hybrid.denoise | on | on / off | live | Off shows the raw signal (ours raw). The FFX denoiser loses 26-46% of a heavy-tailed glossy signal's energy (D3550) and spreads bright screen hits over dark traced neighbours (the W50 halo). | denoised hybrid 0.9-1.4 ms over raw at 1080p (HANDOFF, Performance) | ours denoised, ours + RT |
| Temporal stability | `tsf` | new FfxReflectionDenoiser(device, { temporalStabilityFactor }) | 0.7 | 0 .. 1 | live | History clip box scale: higher is calmer, ghosts more. | | ours denoised, ours + RT |
| Roughness gate (alpha) | `dn.roughnessThreshold` | FfxReflectionDenoiser({ roughnessThreshold }) | 1; the examples pass the tracer's threshold squared (0.1998) | 0 .. 1 | live | Pixels with alpha >= this pass through undenoised. The examples gate at the tracer's threshold (rougher px carry the probe only, no noise; D1402). | | ours denoised, ours + RT |
| Current-frame statistics | `dn.currentFrameStatistics` | FfxReflectionDenoiser({ currentFrameStatistics }) | on | on / off | live | false reproduces FFX v1.1.4 exactly (its one-frame-off statistics: dark speckles on disocclusion, a black first frame). | | ours denoised, ours + RT |
| Miss ray length | `dn.missDistance` | FfxReflectionDenoiser({ missDistance }) | camera far | 0 .. 200 | live | Ray length the reprojection assumes for misses (hit distance 0). | | ours denoised, ours + RT |
| Keep hit sources apart | `hitSource` | hybrid.denoiserHitSource = true; FfxReflectionDenoiser({ separateHitSources, missesMatchAnySource }) | `0` | `0`, `hits`, `all` | live | W77 (maintainer: not in the performance preset): with RT it lowers silhouette error but raises flicker there. carConcept w50 sill band at half res MAD 57.9 -> 39.3, but the band's orbit flicker 1.16 -> 2.94 (reflection region 0.41 -> 0.51); at full res band 30.6 -> 23.2, band flicker 0.90 -> 1.32; chess, Sponza, the ssr scenes unchanged; no effect without RT. The denoiser stops blending bright screen-space hits into dark traced ones (the W50 halo: carConcept lip 80 -> 59 with hits, 52 with all, PT 48, at 960x540; at 1080p the halo is mostly gone anyway). hits: no regression on chess / toyCar / Sponza. all: boils where rays flip between hit and miss (std p99 x4-10). Both show a 2x2 stair step at source edges (D3663). | +0.35 ms (hits) / +0.51 ms (all) at 1080p, \~0 at 960x540 (W53) | ours denoised, ours + RT |
| Hit-distance weight | `hitDistW` | FfxReflectionDenoiser({ hitDistanceWeight }) | 0 | 0 .. 16 | live | Neighbours weighted by relative hit distance, exp(-k \|t_p - t_q\| / (t_p + t_q)); no extra input. 8 separates the lip as well as the source (50.6) but boils everywhere the hit distance varies (std p99 x5-10). 0 = off. | +1.3 ms at 1080p for k 8 (W53) | ours denoised, ours + RT |
| Black samples keep the history | `keepBlack` | HybridReflections.denoiserKeepHistoryOnBlack (default true) -> FfxReflectionDenoiser({ keepHistoryOnBlack }) | `1` | `0`, `1` | live | W78 (D5145): FFX's resolve writes 0 to the output and the history wherever a frame's prefiltered radiance is black, so a sparse glossy reflection over a dark environment never builds up (the line-spread gate's r 0.15 / 0.3 losses). On, black samples accumulate like any other. | | ours denoised, ours + RT |
| Variance-guided tracing input | `variance` | HybridReflections.denoiserVariance = true; settings.temporalVarianceGuidedTracing / varianceThreshold | `0` | `0`, `1` | live | W85 (T36, Denoiser #25): last frame's denoiser variance goes back to the tracer, which traces the quad's other pixels where it is above Variance threshold (s.varianceThreshold; FFX samples use 0, documented range 0 to 0.01). Extra rays after disocclusion and in noisy glossy areas. | | ours denoised, ours + RT |
| BRDF weights from roughness | `brdfMin` | FfxReflectionDenoiser({ brdfMinAlpha: r \* r }) | 0.1 | 0 .. 0.447 | live | W78: the BRDF / pdf weights only from this perceptual roughness up; smoother px keep FFX's weights (near-mirrors: the ratio is so peaked the taps barely average, orbit flicker +40-70 % on carConcept's r 0.03 floor). | | ours denoised, ours + RT |
| BRDF / pdf prefilter weights | `brdf` | ssr.settings.sampleDirection = true; hybrid.denoiserSampleDirection = true; FfxReflectionDenoiser({ brdfWeights, brdfAlphaScale }) | `off` | `off`, `replace`, `combine` | live | W78 (X3 phase B, D5140-D5145): each neighbour's sample in FFX's prefilter weighted by this px's GGX BRDF x cos along the direction to that sample's hit, over the sample's pdf (SSSR 2015's ratio estimator, W73's weights inside the denoiser instead of a pass in front of it). The tracer hands each px's direction and pdf through the seam (a tracer rebuild on an on / off flip). | | ours denoised, ours + RT |
## Probes
`ReflectionProbes` and its `bake()` options. A change re-bakes (Rebuild).
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| -------------------------------- | ---------------------- | ------------------------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------ |
| Reflection probes | `probes` | scene.environmentNode = reflectionProbes(probes); HybridReflections({ probes }) | examples: on | on / off | rebuild | Off lights with the plain environment (three's PMREM): misses read the HDRI instead of the local capture. | | ours (incl. probes only) |
| Resolution | `probeRes` | probes.bake(renderer, scene, { resolution }) | 256 | `64`, `128`, `256`, `512`, `1024` | rebuild | Face size (D23, D62): 256 for mirror-grade surfaces, 128 for many probes / mobile. Near-mirror floors read the HDRI blurred at small sizes (W21). | memory per probe \~1.0 / 4.2 / 16.8 MB at 128 / 256 / 512; bake 3 probes 2.0 -> 4.0 ms from 128 to 256 (D23) | ours (incl. probes only) |
| Bounces | `bounces` | probes.bake(renderer, scene, { bounces }) | 2 | 1 .. 4 | rebuild | D4300: captures that see other probes' reflections; 1 halves the bake where no mirror faces another. | bake mirrorWall 1 probe: 2.5-3.5 ms at 1, 3.6-4.9 at 2 (256 px, D4300) | ours (incl. probes only) |
| Storage | `probeStorage` | probes.layout | `auto` | `auto`, `cube-array`, `cube2d` | rebuild | Hardware cube arrays (W20 shim) vs the 2D-array layout with its seam fix: same look within 1/255. | | ours (incl. probes only) |
| Probe layout (Sponza) | `probeLayout` | examples probeLayouts.ts (W61) | examples: `shipped` | `shipped`, `few`, `medium`, `many`, `manyCell`, `mixed`, `oneSize128`, `oneSize256`, `twoSize`, `twoSizeFew`, `mixedDown` | rebuild | W61: probe layouts at an equal memory budget (Sponza only): a few large or mixed sizes beat a grid of small ones. | | ours (incl. probes only) |
| Car interior probes (carConcept) | `carProbes` | examples showcase/src/carProbes.ts (W55) | off | `off`, `wheels`, `cabin`, `both`, `cabinGlass` | rebuild | W55: small probes inside carConcept beside the stage probe, boxes from the car's geometry (wheel bounds less the body paint; the cabin grown from the seats to the glass). The wells and the cabin then reflect their own capture instead of the open studio (D3680, D3681). | | ours (incl. probes only) |
| Car interior probe size | `carProbeRes` | ReflectionProbe.resolution (D4700) | examples: `128` | `64`, `128`, `256` | rebuild | W55: face size of the carProbes probes; the stage probe keeps Resolution. A size other than the stage's is a second atlas (a mixed-size set). | | ours (incl. probes only) |
| Distance-based roughness | `pr.distanceRoughness` | probes.distanceRoughness | on | on / off | rebuild | Lagarde 2014 (D53): a glossy lookup is sharp near the projection box, as an SSR hit there would be. | lookup within the run's noise at 1080p (D53) | ours (incl. probes only) |
| Roughness lerp of the direction | `pr.roughnessLerp` | probes.roughnessLerp | off | on / off | rebuild | Lagarde 2014 (D53): rough lookups lose the box parallax. Narrowed the SSR-to-probe step but moved every showcase stage away from the PT (W26). | | ours (incl. probes only) |
| Roughness to mip | `pr.lodMapping` | probes.lodMapping | `alpha` | `alpha`, `r187` | rebuild | D101: 'alpha' halves the error below r = 0.3 against a GGX reference (p99 at r .05: 35.4 -> 21.9 / 255 at 256 px). | | ours (incl. probes only) |
| Box projection | `pr.boxProjection` | probes.boxProjection | on | on / off | rebuild | Off: infinite-distance lookups (no parallax); the stages project onto a far box anyway. | | ours (incl. probes only) |
## Materials (examples)
Example-side material options, not package API: roughness from normal variance (specAA, W46) and the W45 experiments.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ----------------------------------- | ------------------- | -------------------------------------- | ----------- | ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------ |
| Roughness from normal variance | `specAA` | examples specAA.ts (strength; 0 = off) | examples: 1 | 0 .. 3 | live | W46 (D3570): raises each normal-mapped material's roughness by its normal map's lost variance (Toksvig, vMF), as the path tracer sees the flakes. carConcept door / skirt MAD 35.7 / 19.0 -> 8.0 / 9.4; it is also what makes the paint lighter: off reads darker. Ours re-bakes. | \~0.1-0.15 ms of three's render passes at 1280x720 (D3570) | ours + three SSR |
| specAA at traced hits | `specAAHits` | examples specAAHitMaterial | on | on / off | rebuild | Traced hits take the adjusted roughness too (one value per mesh, D3571); off keeps them at the authored roughness. | | ours-rt |
| Glossy mask from adjusted roughness | `maskSpecAA` | Measure | off | on / off | live | Measure's glossy mask from the specAA roughness instead of the authored one (the default keeps specAA on / off comparable over the same px). | | ours (incl. probes only) |
| Paint roughness override | `paintRoughness` | | authored | 0 .. 1 | rebuild | W45: every clear-coated material at this roughness, normal map dropped (what a plain paint lobe sees). The path tracer too. | | every method |
| Glass (isolation) | `glass` | | authored | `authored`, `noShadow`, `black`, `hidden` | rebuild | W54: isolates what the eye sees through transmissive glass (carConcept's cabin): black keeps only the glass's own reflection, hidden only the cabin behind it, noShadow lets the key light through as the path tracer does. Every method alike, the path tracer too. | | every method |
| Geometry roughness (three) | `geometryRoughness` | examples geometryRoughness.ts (W56) | three | `three`, `off`, `0.5`, `0.25` | rebuild | W56 (D3720): three r187 adds the screen-space derivative of the view normal to every standard material's roughness (getRoughness); off / scaled re-assigns three's roughness after its setupVariants. Reaches three's lit term, the G-buffer's shading roughness (the composite's probe term) and the bake; never the path tracer. Any other scale by URL (?geometryRoughness=0.75). | | ours + three SSR |
## three SSRNode (reference)
three r187's stock SSRNode, its TemporalReproject + RecurrentDenoise, and denoiser/three's ffxReflections: the three SSR methods only.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ----------------------------------- | ---------------------------- | -------------------------------------------------------------- | --------------------------------------------- | --------- | ------- | --------------------------------------------------------------------------------- | -------- | ------------- |
| SSR mirror bias | `mirrorBias` | SSRNode.mirrorBias | 0; examples: 0.5 | 0 .. 1 | live | three's lobe truncation (the example's 0.5): less noise, sharper. | | three SSR |
| SSR max distance | `ssrMaxDistance` | SSRNode.maxDistance | 1; example: scene far / 4 (D2301) | 0 .. 50 | live | March length in world units; the example's 0.4 is for its 0.1-scaled dungeon. | | three SSR |
| SSR thickness | `ssrThickness` | SSRNode.thickness | 0.1; example: our scene thickness x 3 (D2301) | 0 .. 1 | live | Hit acceptance thickness (three's units). | | three SSR |
| SSR quality | `th.quality` | SSRNode.quality | 0.5; examples: 0.25 | 0 .. 1 | live | Step density: higher is finer and costlier. | | three SSR |
| SSR intensity | `th.intensity` | SSRNode.intensity | 1 | 0 .. 3 | live | Scales the reflection. | | three SSR |
| SSR max luminance | `th.maxLuminance` | SSRNode.maxLuminance | 10; examples: 35 | 0 .. 100 | live | Clamp against fireflies (biased dark on bright reflections). | | three SSR |
| SSR edge fade | `th.screenEdgeFade` | SSRNode.screenEdgeFade | 0.2 | 0 .. 1 | live | Fades hits near the screen edge. | | three SSR |
| SSR environment intensity | `th.environmentIntensity` | SSRNode.environmentIntensity | 3.1416; example: the scene's (D2300) | 0 .. 4 | live | Scales the environment its misses sample (the example's 3.14 is for its scene). | | three SSR |
| SSR step exponent | `th.stepExponent` | SSRNode.stepExponent | 2; examples: 3 | 1 .. 5 | rebuild | Step distribution along the ray. | | three SSR |
| SSR resolution scale | `th.resolutionScale` | SSRNode.resolutionScale | 1 | 0.25 .. 1 | rebuild | SSR at a fraction of the resolution: cheaper, blockier. | | three SSR |
| SSR binary refine | `th.binaryRefine` | SSRNode.binaryRefine | off | on / off | rebuild | Binary search at the hit: sharper contact, more steps. | | three SSR |
| SSR edge fade to black | `th.screenEdgeFadeBlack` | SSRNode.screenEdgeFadeBlack | off | on / off | rebuild | Fade to black instead of the environment at the edge (indoor scenes). | | three SSR |
| Reproject max frames | `th.rp.maxFrames` | TemporalReprojectNode.maxFrames | 16; the example's | 1 .. 64 | live | History length of three's reprojection. | | three-denoise |
| Reproject clamp | `th.rp.clampIntensity` | TemporalReprojectNode.clampIntensity | 0.25; the example's | 0 .. 1 | live | History clamp strength: higher ghosts less, flickers more. | | three-denoise |
| Reproject flicker suppression | `th.rp.flickerSuppression` | TemporalReprojectNode.flickerSuppression | 1; the example's | 0 .. 2 | live | Damps temporal flicker. | | three-denoise |
| Hit-point reprojection | `th.rp.hitPointReprojection` | TemporalReprojectNode.hitPointReprojection | on; the example's | on / off | live | Reprojects by the reflected hit's motion (reflections move unlike their surface). | | three-denoise |
| Denoise lumaPhi | `th.dn.lumaPhi` | RecurrentDenoiseNode.lumaPhi | 0.75; the example's | 0 .. 4 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise depthPhi | `th.dn.depthPhi` | RecurrentDenoiseNode.depthPhi | 20; the example's | 0 .. 100 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise normalPhi | `th.dn.normalPhi` | RecurrentDenoiseNode.normalPhi | 0.3; the example's | 0 .. 2 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise roughnessPhi | `th.dn.roughnessPhi` | RecurrentDenoiseNode.roughnessPhi | 100; the example's | 0 .. 200 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise radius | `th.dn.radius` | RecurrentDenoiseNode.radius | 1.5; the example's | 0 .. 4 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise alphaPhi | `th.dn.alphaPhi` | RecurrentDenoiseNode.alphaPhi | 5; the example's | 0 .. 20 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise strength | `th.dn.strength` | RecurrentDenoiseNode.strength | 0.725; the example's | 0 .. 1 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise adapt | `th.dn.adapt` | RecurrentDenoiseNode.adapt | 0.5; the example's | 0 .. 1 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise flickerSuppression | `th.dn.flickerSuppression` | RecurrentDenoiseNode.flickerSuppression | 1; the example's | 0 .. 2 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise adaptiveTrust | `th.dn.adaptiveTrust` | RecurrentDenoiseNode.adaptiveTrust | 1; the example's | 0 .. 2 | live | three's recurrent denoiser weight (edge-stopping phi / filter radius / blend). | | three-denoise |
| Denoise smooth disocclusions | `th.dn.smoothDisocclusions` | RecurrentDenoiseNode.smoothDisocclusions | on; the example's | on / off | live | Blurs freshly disoccluded px harder. | | three-denoise |
| FFX temporal stability (three side) | `th.ffx.tsf` | ffxReflections(..., { denoiser: { temporalStabilityFactor } }) | 0.7 | 0 .. 1 | rebuild | As ours', on three's SSR + FFX. | | three-ffx |
| FFX roughness gate (three side) | `th.ffx.roughnessThreshold` | ffxReflections(..., { denoiser: { roughnessThreshold } }) | 1 | 0 .. 1 | rebuild | As ours' (alpha); ffxReflections denoises every px by default. | | three-ffx |
## Path tracer (reference)
@pmndrs/pathtracer + OIDN, the ground truth Measure compares against.
| Setting | URL key | API | Default | Range | Apply | Trade-off | GPU cost | Applies to |
| ------------------ | ------------- | --------------------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------- |
| Max samples | `ptMax` | WebGPUPathTracer.maxSamples | 8 | 1 .. 512 | live | Traces to this many spp, then denoises once with OIDN and idles. Measure sets its own (Reference samples). OIDN biases sub-8-bit differences: raise it or show raw for those (D2305). | | pathtraced |
| Show raw (no OIDN) | `ptRaw` | | off | on / off | live | The noisy accumulation instead of the denoised frame. | | pathtraced |
| Bounces | `ptBounces` | WebGPUPathTracer.maxBounces | 8 | 1 .. 16 | rebuild | Light bounces of the reference. | | pathtraced |
| OIDN | `ptDenoise` | | on | on / off | rebuild | Off: never load OIDN (raw accumulation only). | | pathtraced |
| Clear coat | `ptClearcoat` | | on | on / off | rebuild | Off drops the clear-coat layer (the old WebGL tracer rendered it black, D2303). | | pathtraced |
## What changes when ray tracing is on
Turning the ray-traced fallback on (`ScreenSpaceReflectionsPass({ trace })`, `setTraceProvider()`, `rayTracing`; in core, `missesTraced: true` on the tracer's dispatch) changes these defaults. **An explicit value always wins**: set the field to keep the RT-off value. The bench shows the effective value of an unset field.
| Setting | URL key | Default | With RT | Why |
| ------------------------ | ------------------------ | ------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Thickness per view depth | `s.thicknessDepthFactor` | 0 | 0.02 | W76 (maintainer's call on X1 #2, D5001): the relative test at 0.02 x view depth stops thin geometry turning into a slab (lineSpreadThin x4.25 -> x1.45..x2.2 of the PT's width) and is flat on carConcept, toyCar, chess, Sponza with RT (within 0.15 MAD); the rays it rejects go to the RT pass. Without RT they would take the probe (Sponza +1 %, more misses), so the default stays 0 there. `thicknessDepthFactor: 0` (or mode 'add') restores the old test. |
| Thickness depth mode | `s.thicknessDepthMode` | `add` | `relative` | W76: with Thickness per view depth, the RT default (relative 0.02), only while both are unset. An explicit 'add' keeps the pre-W76 thickness with RT on (the factor then defaults to 0); an explicit factor alone keeps 'add' too. |
Behaviour of the RT path that differs from RT off (no setting to miss, listed for completeness):
| What | Why |
| ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The tracer runs with `missesTraced: true` | The three adapter sets it while its traced pass runs; it is what switches the RT defaults above on in core (`resolveScreenSpaceSettings`). A direct core user sets it on the tracer's dispatch. |
| On-screen traced hits are re-shaded without a visibility ray | D3542: as the screen-space re-shade (no BVH there); with the ray a mirror seen in a mirror went black in stripes. `traceSettings.hitShadeVisibility: 'all'` adds it (D3640). Off-screen traced hits keep D3513's ray. |
| Specular occlusion skips traced misses | W45 (D3551, D4513): a traced miss left the scene unblocked, so Lagarde's AO guess would occlude it twice. Untraced pixels keep it (`specOcc`). |
| Lobe filter where hits mix (`s.hitLobeFilterMixed` < 1) acts | D3641: it reads last frame's hit source, which only the traced pass writes; without RT it changes nothing. |
| `rayReuse: 'ratio'` leaves traced pixels alone | D5043: the resolve runs before the traced pass, which overwrites the miss list's pixels; screen and traced hits never mix in it. |
| The traced lobe filter follows the tracer's lobe split | D5021 / W76: with the cone + compensation defaults a traced hit's specular is filtered by hitLobeFilter x alpha x sqrt(mirrorBias) (the share the narrowed sample leaves out); `traceSettings` can override it. |
## Not exposed
| Option | Why |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `settings.fallbackColor` | The three adapter forces the tracer's constant fallback black (the composite adds the probe); a constant colour is meaningless there. |
| `traceSettings.fallbackColor, hitColor, hitShading` | The adapter passes black and the tracer's own `hitColor` / `hitShading` (Hit colour / Hit specular above). |
| `trace option `lights\`\` | Constructor-only (`ScreenSpaceReflectionsPass({ trace: { provider, lights } })`); the examples attach the provider later with `setTraceProvider`, so the default (on) stays. |
| `ReflectionProbes.refitClamp, frameIrradiance` | Only with a frame-irradiance re-fit, which the showcase scenes don't run. |
| `@pmndrs/upscaler debugView` | A debug overlay, not a tuning knob. |
]]>