Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ To go back: restore `pnpm-workspace.yaml` and `pnpm install --offline` (or onlin
equal split per pixel on 6 of 8 scenes and differ by <= 3.2e-7 relative (1-3 ulp, relMSE 3e-17) on IORTestGrid (both schedulers) and env-sphere (wavefront): not addressing (every accessor is bit-exact
in `--page scene-copy packing=both`), a different compiled kernel contracts some float ops differently. `DEFAULT_SCENE_PACKING` is still `split`; `writeSceneCopy(device, buffers, copy)` rewrites a rebuilt copy
in place for either packing (the packed one rewrites the whole buffer: the data region moves when the table length changes).
- Chunked scene copy data (P1.4e, V515-V518; `packing: 'packed:3x25'` / `'split:3x25'`, `chooseSceneCopyPacking`, bench `pt_scene_chunk=<log2>`): the packing STRING carries K and N, so a kernel, `uploadSceneCopy` and `setScene` agree through the one value; a copy rebuilt with a different data length may need another K (= another kernel): `writeSceneCopy` returns false. Data word `i` is in chunk `i >> N`; appended WGSL goes through `rtApplyScenePacking(source, packing)` (not `rtPackSceneAccess` alone: `split:KxN` keeps `rtSceneTable` and only rewrites `rtSceneData[..]`). Every chunk is a storage binding: on Apple (10 per stage) Sponza's 21 MiB needs chunks of 2^21 words (K = 3: megakernel and wavefront fit; 2^20 gave "11 > 10"), and Cornell (324 data words) shows the straddle at 2^7. Forced small chunks on small scenes are the test (`--page scene-copy chunk=7`, 0 mismatches; renders per-pixel bit-identical); no real > 128 MiB scene was built.
- Optional integrator outputs (R10 hooks, R4 counters, AOVs; `integrator/outputs-wgsl.ts`): their template text must emit nothing (no blank line, no `\n`) when off. Two traps hit while adding them: a gated block ending in a
newline placed before the original newline adds a blank line (the megakernel stayed identical but the wavefront shade kernel grew by one `\n`), so put the leading `\n` inside the gate for end-of-line additions
(`x;${on ? `\n y;` : ''}`). `node bench/size-snapshot.ts` now writes the `wf-*` wavefront kernels too (`bench/kernel-variants.ts` `wavefrontKernelVariants`): `diff -r` two snapshot directories, ignore `Only in`.
Expand Down
4 changes: 4 additions & 0 deletions DIVERGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,7 @@ why, so each one can be revisited later. One row per divergence. Kinds: **platfo
| V343 | 2026-11-26 | Pharr, Wronski, Salvi, Fajardo 2024 (stochastic texture filtering, Listing 1 / S.1: one uniform reused across the axes by rescaling); Wronski, Pharr, Akenine-Moller 2025 (texel sharing between wave lanes) | `volumes.densityFilter: 'stochastic'` (V7.6): stochastic trilinear density, one texel per lookup. Differences: THREE draws from the tracking stream (one per axis) instead of one rescaled uniform; zero outside the grid without a read; no texel sharing between lanes; no tricubic. | Simplification (independent 24-bit draws keep each axis' probability exact to 2^-24 with no division by a small fraction, and need no change to the megakernel / wavefront stream protocol; the two saved PCG steps were not measured). Sharing: the 2025 paper's own supplement reports block artifacts for ray-marched volumes, and our lanes are not neighbouring pixels after the first vertex. |
| V345 | 2026-11-30 | Our own dense grid lookup and brick DDA (`ptVolDensity`, `ptDdaInit` / `ptDdaNext`, V3.2 / P5.v6) | `volumes.gridSource: 'nanovdb'` (VDB-P1.7) replaces both with `@pmndrs/vdb`'s WGSL (`vdbSample`, `vdbMajorantInit` / `vdbMajorantNext`) over the same voxels and the same cells. Two differences per path: the pool's walk never returns a zero-length segment at a cell corner (ours can, and `ptVolSampleBrick` / `ptVolTrBrick` stop on one), and the NanoVDB reader adds the eight taps in another order. Images are therefore not bit-equal to the dense kernel (77-86% of pixels are; relMSE 1e-15 to 1e-6 at equal seeds). The accessor was created per lookup in the first build; since pmndrs/vdb P1.16 (2026-11-30) the kernels keep one per ray segment, made at its first lookup, and the module caches the lower node (`cache: 'lower'`): the same values, images bit-identical to the first build's. | simplification / sibling | the timing A/B of the reader options (quiet pass, VDB-P1.10); cache `'lowerLeaf'` once VDB-P1.14 is understood |
| V344 | 2026-11-26 | pmndrs/upscaler defaults (`RuntimeSettings.autoExposure` on) | The NRC / Classroom chain (`nrc-pipeline`, hero) runs the temporal upscaler with `autoExposure: false`, `exposure: 1` (page control **Auto pre-exposure**, `?upAutoExposure=1` for the sibling's default). | Quality. On a dim interior (mean luminance 0.12) the metered pre-exposure lifts the image so the brightest denoised pixels (10-20) sit at the top of the upscaler's invertible tonemap, where its Catmull-Rom history resample overshoots and `tonemapInvert` turns that into values up to 139 while the camera moves (17 hot pixels per 1920 x 1080 frame, both arms; 0 and max 11 with it off; nothing with a still camera either way). Sharpness 0, locks off and shading-change detection off do not remove it; history 4 nearly does. Off also darkens less against the denoised frame (-4% vs -6..7%; N11.5). Numbers: TASKS N11.11; `bench/hero/README.md` "Bright specks while moving". The cause is in the sibling (unclamped bicubic history in tonemapped space): report there. |
| V515 | 2026-12-02 | Issue #51 (P1.4e) suggestion: a per-mesh chunk id in the table, a mesh never straddling a chunk | Chunked scene copy data (`packing: 'split:KxN' \| 'packed:KxN'`) picks the chunk by the WORD index: chunk `i >> N`, word `i & (2^N - 1)` (`rtSceneWord`, N a power of two, so a shift and a mask, no division). Nothing in the data layout moves: the words, every offset in the table and the light maps, the fingerprint and the CPU twins are those of the unchunked copy, a mesh larger than a chunk works and an index triple, a vertex or an env-map texel may straddle a boundary (each word is its own lookup). The price is a switch over K cases per data word read (the chunk bindings are separate variables, WGSL has no binding array), which a per-mesh id would pay once per mesh. | simplification | a quiet-pass A/B of unchunked vs chunked K=2/3 on Sponza (QUIET-PASS P1.4e) says the per-word pick costs more than a few %: then build the per-mesh id (needs a per-mesh data layout and a chunk id threaded through `rtSIndex` / `rtSVertex`) |
| V516 | 2026-12-02 | `SceneCopyPacking` as an enum of two | The chunk layout lives in the packing string (`'packed:3x25'` = header + table in `rtScene`, data in `rtSceneData0..2` of 2^25 words; `'split:3x25'` with `rtSceneTable`), `chooseSceneCopyPacking` picks K from the size and the device limit. Every place that already passes a packing (kernel options, `uploadSceneCopy`, `setScene`'s mismatch check, layout entries, storage-buffer counts, `rtApplyScenePacking` of appended text) carries it with no new option; `DEFAULT_SCENE_PACKING` stays `'packed'` and the unchunked kernel text and buffers are byte-identical (355 size-snapshot files). | simplification | an options object is wanted by an API user (then a parsed form behind the same string) |
| V517 | 2026-12-02 | Issue #51 (chunk the data buffer) | Only the DATA is chunked. The table (header, instances, meshes, materials, lights, texture slots; packed: plus the header vec4) must still fit one binding: it is ~100-200 B per instance / material / light, so 128 MiB is about a million lights or instances. `chooseSceneCopyPacking` and `uploadSceneCopy` throw a RangeError that names it. A chunked copy rebuilt with a different data length may need another K, which is a different packing and so a new kernel: `writeSceneCopy` returns false then. | simplification | a scene with over ~1M lights or instances |
| V518 | 2026-12-02 | Chrome / Dawn storage-buffer limit per stage (10 on Apple Metal) | Every chunk costs one storage binding (`sceneCopyStorageBuffers` = 1 + K), so the useful K is small: the megakernel (packed, Cornell) fits 5 chunks, the wavefront shade kernel (7 buffers packed) 3, and Sponza's 21 MiB needs 8 MiB chunks (K = 3) on a 10-buffer stage. `chooseSceneCopyPacking` refuses with the numbers (scene buffers + `otherStorageBuffers` over `stageLimit`) before a kernel is built; `PtMegakernel.create` / `PtWavefront.create` add the chunk count to Dawn's layout error. Chunking is for scenes past 128 MiB (K <= 3-4 at 128 MiB chunks); past ~4-5 chunks a bindless buffer table or one 2+ GiB binding (`maxStorageBufferBindingSize` raised through `requiredLimits`, the caps ask for up to 2 GiB) is the better tool. | platform | WebGPU gets binding arrays / buffer tables for storage buffers |
2 changes: 1 addition & 1 deletion TASKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ suggestion, pros/cons and the A/B that would settle it.
| P1.4c6 | Textured emitters in NEE: sample by the texture's luminance (a second alias/CDF per emissive texture) instead of BSDF-only | — | ⬜ | today a textured emitter is excluded from the light table (V52) Issue [#52](https://github.com/pmndrs/pathtracer/issues/52). |
| P1.4c7 | Textures on Windows: compile time of the textured kernel (DXC), the 16-texture limit with 8 arrays, `rgba8unorm-srgb` filtering precision on D3D12 | — | ⬜ Windows | **Audit 2026-11-26:** [#34](https://github.com/pmndrs/pathtracer/issues/34). add to the Windows handoff list |
| P1.4d | Environment map: copy + power/CDF; converter's `hdriRadiance` from the PFM mean | agent:envmap | ✅ | `packages/raytracer/src/scene/env-map.ts` (+ test): equirect texels, marginal/conditional CDF, f64 TS twins; map words in the scene copy `data` buffer after the light maps (no new binding), location in the env light record (words 8-10); `radiance` = sin θ-weighted map mean (power + constant fallback); converter option `hdriMap`. V48 |
| P1.4e | Chunk the data buffer past `maxStorageBufferBindingSize` (128 MiB) | — | ⬜ | `uploadSceneCopy` throws a clear error today Issue [#51](https://github.com/pmndrs/pathtracer/issues/51). |
| P1.4e | Chunk the data buffer past `maxStorageBufferBindingSize` (128 MiB) | agent:chunked-scene | ✅ opt-in (default unchanged) | `packing: 'split:KxN' \| 'packed:KxN'` (constants.ts), `chooseSceneCopyPacking` (K from size + device limit, refuses over the stage budget), `uploadSceneCopy` / `writeSceneCopy` / bind entries / layout entries, WGSL `rtSceneWord` chunk pick (V515-V518). Checks: `scene-chunked.test.ts` x2 + `bench/scenes/scene-chunks.test.ts`; `--page scene-copy chunk=7..11` 0 mismatches (both table placements, 5 chunks of 128 words on Cornell incl. surface decode across boundaries); renders `pt_scene_chunk=7` Cornell and `=21` (K = 3) Sponza, megakernel and wavefront, packed and split: ALL per-pixel bit-identical to unchunked (0 differing values of 0.8-2.8 M). Default kernels: 355 size-snapshot files `diff -rq` empty (packed and split). Open: timing of the per-word switch (QUIET-PASS P1.4e: `pt-mk-chunk` / `pt-wf-chunk`), a real > 128 MiB scene (none built; the chunk path is exercised with forced small chunks), per-mesh chunk id alternative (V515) only if the switch costs. Issue [#51](https://github.com/pmndrs/pathtracer/issues/51) (the other rows of it, P1.4b / P1.5a, are open). |
| P1.4f | A/B light selection (power vs uniform-per-kind vs capped infinite lights 0.25/0.5, plus pbrt-v4's rule) | — | ✅ default `pbrt` (D22) | relMSE at 1024 spp, 3 seeds (pbrt / power / kind / cap:0.25 / cap:0.5): Cornell, quad-light, env-sphere identical; sponza-white 9.33e-3 / 8.12e-3 / 9.33e-3 / 8.12e-3 / 8.12e-3; `lights-mix` (sun+sky key) 1.67e-5 / 2.10e-5 / 1.67e-5 / 2.44e-5 / 1.29e-5; `lights-mix-lamps` 1.30e-4 / 8.69e-5 / 1.30e-4 / 6.14e-5 / 8.69e-5. Means within 0.03% everywhere. `pbrt` = `kind` on all these scenes (one area kind). Maintainer chose the common rule over `cap:0.5`. Follow-up: a light BVH for the area share (P3/P4) |
| P1.4g | Light point sampling | agent:integrator | ✅ | `packages/raytracer/src/scene/light-sample.ts` (`rtSceneWgsl({ sampling: true })`): uniform area on emissive triangles, solid-angle pdf `dist²/(\|cos_l\| area)` (pmf applied by the caller), sun cone (delta at radius 0), uniform environment sphere. 26 CPU tests (E[1/pdf] = analytic quad solid angle; MC irradiance vs closed form to 2e-4). GPU `pt-check`: 0 mismatches, max rel 1.3e-5 |
| P1.4h | GPU checks for alpha mask/blend once a consumer reads them | — | ⬜ | Issue [#52](https://github.com/pmndrs/pathtracer/issues/52). |
Expand Down
Loading
Loading