Skip to content

feat(examples): S5 radiance cascades GI, upscaled instead of TRAA - #106

Merged
DennisSmolek merged 2 commits into
mainfrom
claude/three-rc-upscaler-integration-eab0ca
Nov 9, 2026
Merged

DennisSmolek merged 2 commits into
mainfrom
claude/three-rc-upscaler-integration-eab0ca

Conversation

@DennisSmolek

Copy link
Copy Markdown
Member

Summary

Ports zalo's real-time radiance cascades GI demo (mrdoob/three.js#35349) as showcase S5 (examples/s5-radiance-cascades) and swaps its traa() resolve for upscale(). The G-buffer and every GI pass run at 1/ratio and the upscaler reconstructs the display image.

  • Wiring mirrors the demo's TRAA wiring. The addon renders its own G-buffer inside the render pipeline (OnBeforeFrameUpdate in the Fn that returns the composite), so the pipeline-hook jitter lands on it. The composite is pinned to a render-size texture (convertToTexture(node, w, h)) and handed to upscale() with the G-buffer's depth and velocity.
  • Vendored addon, two marked [upscaler port] patches: a local isBackgroundDepth() (on three's dev branch, absent from r186) and an explicit renderSize for the G-buffer (null = original behaviour).
  • r186 TRAA shim (example only): r186 TRAA's depth history is depth24plus unless reversed depth, so copying the cascades' depth32float failed validation every frame. The example sets that private history depth to float so the TRAA comparison runs clean.
  • Probes are sized in render pixels by default, so probe work scales with the render size too; "display px" keeps world-space GI identical to native for a same-GI comparison.
  • Adaptive quality is off by default (it would trade quality for frame rate and hide the difference). A benchmark button times TRAA-native vs the upscaler (fps, GI GPU ms, upscale GPU ms).
  • Assets stream from pinned commits (Sponza from the PR's head commit, sky HDR from three r186, Draco from gstatic), so nothing binary is added.

Results

Headless Chrome, Apple Metal, vsync off, 1600×900, Sponza, still camera, fixed GI quality. Run from a worktree, so absolutes read slow; compare within the table.

Resolve Render fps GI GPU Upscale
TRAA, native 1600×900 77 11.9 ms —
Upscaler 2×, display-px probes 800×450 146 5.4 ms 0.6 ms
Upscaler 3×, display-px probes 533×300 187 4.3 ms 0.5 ms
Upscaler 2×, render-px probes (default) 800×450 214 3.1 ms 0.6 ms

Test plan

  • pnpm typecheck, pnpm lint, examples build
  • GPU: all three resolves render with no WebGPU/WGSL errors (headless CDP)
  • Debug views: motion vectors smooth under orbit, disocclusion thin silhouette outlines, accumulation age saturates when still
  • Try on Windows/NVIDIA (the addon needs 9 storage buffers per stage and large storage buffers; the page requests the adapter's limits)

Caveats

  • The Sponza URL points at zalo's PR head commit; if that PR merges, repoint it to mrdoob/three.js.
  • When three ships isBackgroundDepth and the TRAA depth fix (r187?), the patch and shim can go.

🤖 Generated with Claude Code

DennisSmolek and others added 2 commits November 9, 2026 11:27
Ports zalo's real-time radiance cascades demo (mrdoob/three.js#35349) and
swaps its traa() resolve for upscale(). The addon renders its own G-buffer
inside the render pipeline, so the pipeline-hook jitter lands on it; the
G-buffer and every GI pass run at 1/ratio and the upscaler reconstructs the
display image from the composite + G-buffer depth/velocity.

The addon is vendored with two marked patches: a local isBackgroundDepth()
(three's dev branch has it, r186 doesn't) and an explicit renderSize for the
G-buffer. The TRAA path sets r186 TRAA's depth history to float so it can
copy the cascades' depth32float. Assets stream from pinned commits.

GPU-verified headless (Apple Metal, vsync off, worktree, 1600x900, Sponza,
still camera): TRAA native 77 fps / GI 11.9 ms; upscaler 2x 146 fps / GI
5.4 ms + 0.6 ms upscale; 3x 187 fps; 2x with render-px probes 214 fps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Probes coarsen with the render scale, so the probe work scales with the
render size too (Sponza 2x, 1600x900: GI 5.4 -> 3.1 ms, 146 -> 214 fps;
probe memory drops with it). TRAA stays native. 'display px' remains a
toggle for a same-GI comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DennisSmolek
DennisSmolek merged commit 6a7d4ea into main Nov 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant