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
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ To go back: restore `pnpm-workspace.yaml` and `pnpm install --offline` (or onlin
the PLY); Mitsuba `bitmap` reads v as glTF does (verified with an asymmetric marker texture; `MITSUBA_FLIP_V` in the exporter).
- pbrt `imagemap filter "bilinear"` still picks a mip level from ray differentials scaled by max(1/8, 1/sqrt(spp)); Mitsuba bilinear is
level 0 only. Keep reference textures at most ~8 texels per pixel (or compare with Mitsuba) so pbrt stays on level 0.
- Per-slot uv transform (P1.4c1): a scene whose textures carry `uvTransform` has `TextureLayout.transforms` and 3 vec4u per texture slot; every kernel and scene copy must agree (a layout without it reads the one-vec4 records at the wrong stride). `rtTexRecord` returns the base record with the table index of the matrix in `.w`
(the mip count, read by no shader), so any new WGSL that reads a record must pass it back to `rtTexSampleRecord` / `rtTexLodOf` untouched and never read `.w` itself. Keep `bake` for reference scenes: pbrt / Mitsuba exports throw on a `uvTransform`. A normal map's tangent turn assumes a conformal mesh uv map (V501). `node bench/runner/run.ts --page texture-transform-check` is the check.
- Second uv set per slot (P1.4c1, `TextureInput.texCoord` 1, `uvSets: 'slot'` in the loader): slots read it through the module-scope privates `rtUv1` / `rtUv1Frame` that `rtSurface` writes (V600), so a lookup must follow the `rtSurface` of its own hit; ReSTIR and MaterialX refuse such a scene. `TextureLayout.uvSets` must match between the kernel and the scene copy (`PtMegakernel.setScene` throws), the set bits live in the slot record's last word (mip count: mask it with `0x3fffffff`, `unpackTextureSlot` does). A second uv set on a mesh is opt-in (`SurfaceLayout.uvs1`): a scene without it keeps its vertex stride. Mind the order of the GLTF texture entry keys: every further use of an image (another transform OR another set) gets `~n`, also when the first use had neither.
- Normal map frames: glTF green = image up = decreasing v; the bitangent is cross(n, t) x handedness. Verify any change with
`--page texture-check` (closed-form normal-map planes to 1e-7), not by eye.
- A texture bucket is one binding + one sampler (wrap mode is part of the bucket); 8 buckets by default, merged when more. WGSL has no
Expand Down
10 changes: 10 additions & 0 deletions DIVERGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,13 @@ 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. |
| V500 | 2026-12-02 | GitHub issue #52 (suggested a second vec4u in the texture slot record for the uv transform) | A scene with uv transforms stores THREE vec4u per slot (base record, then the 2x3 matrix as f32 bits and `(m4 m5, magnification, flags)`): six matrix floats do not fit one vec4u. `rtTexRecord` returns the base record with the table index of the matrix in `.w` (the mip count, which no shader reads), so no call site changes. A scene without transforms keeps the one-vec4 record. | simplification | slot records get a second compact form (f16 matrix, or a separate transform table indexed by a slot bit) if the table size ever matters (it is 48 B per texture) |
| V501 | 2026-12-02 | glTF 2.0 `KHR_texture_transform` (the spec transforms the uv; viewers differ on what happens to the tangent frame) | A normal map read through a uv transform has its tangent-space (x, y) turned by `normalMapFrameMatrix`: T' = (d T + c B) / det, B' = (b T + a B) / det from the transform (a b; c d), assuming the mesh's uv map is conformal (|dp/du| = |dp/dv|). Exact for rotation, uniform scale and flips (equal to baking the transform into the uvs, relMSE 2.7e-10); a non-uniform scale on a stretched uv map is approximate (the mesh frame does not carry |dp/du| and |dp/dv| separately). A texture with a transform that is read as a normal map AND as another map throws at scene-copy build. | simplification | the surface texture frame carries the uv-gradient lengths, or the maps are read with the true Jacobian |
| V502 | 2026-12-02 | glTF 2.0 `KHR_texture_transform.texCoord` / `textureInfo.texCoord` (every slot may read its own uv set) | The scene copy has one uv set per mesh (TEXCOORD_0 or the first slot's set at load time), so slots of one material that read different sets use the first slot's set and the loader notes it, as before this change. Only offset, rotation and scale are per slot. | simplification | a second uv set (TEXCOORD_1) in the surface data and a set bit in the transform record flags(done: V600-V604, `uvSets: 'slot'`) |
| V503 | 2026-12-02 | pbrt-v4 / Mitsuba texture mapping (references for textured scenes) | The native exports (`exporters/textures.ts`, `common.ts`) throw on a texture with `uvTransform`: pbrt's `imagemap` has no rotation and Mitsuba none at all, so a reference scene is loaded with `uvTransform: 'bake'` (uvs carry the transform, one per material), which is what they read. | simplification | the exporters bake per-slot transforms into per-slot uv sets (needs a second uv set on the mesh files) |
| V504 | 2026-12-02 | none (our texture storage, one array layer per texture input) | The same image used with two different transforms is two texture inputs and two layers (the loader keys them `t3`, `t3~1`): a slot record cannot name another slot's layer. A glTF that uses one image with many transforms stores it many times. | simplification | slot records may alias a layer (a layer index and a transform per use, separate from the image) if a real scene needs it |
| V600 | 2026-12-02 | Our own `rtApplyMaterialTextures(m, uv, footprint)` / `rtTexSampleRecord(r, uv, lod)` signatures (every integrator, ReSTIR, MaterialX call site passes ONE uv) | The second uv set (`TextureInput.texCoord` 1) reaches the lookups through two module-scope `var<private>` values, `rtUv1` (xy = uv1 at the hit, z = its uv density over the first set's) and `rtUv1Frame`, written by every `rtSurface` call that asks for `RT_SURF_UV` and read by `rtTexSampleRecord` / `rtTexLodOf` for a record whose bit 31 is set. The call sites (10, in four generators) are unchanged, so every kernel without a set-1 slot is byte-identical. The coupling is a hidden one: a lookup must follow the `rtSurface` of ITS hit with no other `rtSurface` between (true everywhere today; ReSTIR, which re-applies textures from a stored G-buffer, and MaterialX are refused with set-1 slots, V604). | simplification | a call site needs a surface that is not the last decoded one (ReSTIR with a uv1 in its G-buffer): then pass the second uv explicitly |
| V601 | 2026-12-02 | glTF 2.0 (every `textureInfo.texCoord` is its own `TEXCOORD_<n>`) | A mesh carries at most TWO uv sets (`SceneCopyMesh.uvs`, `uvs1`; 2 floats per vertex more, after the tangent) and only a mesh whose material needs it (`SurfaceLayout.uvs1`). The loader (`uvSets: 'slot'`) takes the first slot's set as `uvs` and the first other set a slot names as `uvs1`; a third set falls back to the first with a note. Default stays `uvSets: 'first'` (one set per material, as before). A slot that reads set 1 on a mesh without `uvs1` reads set 0 (glTF calls that file invalid). | simplification | a material with three sets shows up (none in the Khronos models read so far), or `uvSets: 'slot'` becomes the default |
| V602 | 2026-12-02 | glTF 2.0 normal textures (tangent space of the uv set the texture reads) | A normal map read from set 1 has its (x, y) turned from set 1's tangent frame into set 0's per triangle (`rtUvFrame`, twin `uvFrameMatrix`: T = dp/du projected on the plane of the GEOMETRIC normal, B = handedness x n x T, as `rtApplyNormalMap`), so the shading code keeps using set 0's frame. Exact for conformal uv maps (|dp/du| = |dp/dv|), like V501; a stretched map is an approximation. The cone footprint of a set-1 slot is the set-0 footprint times uvDensity1 / uvDensity0 (the shader has one cone width per hit); a degenerate set-0 triangle gives footprint 0 and level 0. | simplification | a model with a strongly non-conformal second uv set and a normal map on it; or a per-slot tangent from the file's `TANGENT` |
| V603 | 2026-12-02 | pbrt-v4 / Mitsuba texture mapping (references for textured scenes) | The native exports throw on a texture with `texCoord` 1 (`TextureDesc.texCoord`): both renderers read one uv set per mesh, so a reference scene is loaded with `uvSets: 'first'` (what they read) and a two-set material is not a reference. | simplification | never for pbrt (its `trianglemesh` has one `uv`); a Mitsuba reference could bake the second set into a second mesh copy |
| V604 | 2026-12-02 | Our own ReSTIR G-buffer (one uv per pixel) and the MaterialX graph (its own uv inputs) | A kernel whose texture layout has `uvSets` refuses ReSTIR (`ptRestirUnsupported`) and `integrator.materialx` (`ptShadingModulesWgsl`); `PtMegakernel.setScene` throws when the kernel and the scene copy disagree on `transforms` / `uvSets`. The web export (`exporters/gltf.ts`, `readGlbMeshes`) carries `TEXCOORD_1` for our own export only, and the `file` geometry attribute `uvs1` loads it (Tier 1 scenes have none yet). | simplification | ReSTIR stores uv1 in its G-buffer; a model needs both |
Loading
Loading