Denoising and upscaling
One stochastic ray per pixel is noisy. The library does not hide that: it makes the noise cheap and hands it to a denoiser. Several sibling libraries from the same group do the other jobs, so each one stays small.
The denoise seam
HybridReflections takes any object shaped like a TemporalDenoiser<SpecularInputs> 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.
pnpm add denoiserconst 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.
Without a denoiser, the resolve runs undenoised. That still works, but rough glossy surfaces and traced reflections shimmer much more. The live examples 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 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.
Live examples
- Denoising glossy reflections: the denoiser on and off, with a flicker meter.
- Animation and camera cuts: a moving camera and objects, and
resetHistory(). - Upscaling: render below the display size and upscale after the composite.