Repository navigation
P1.4c1: texCoord per texture slot (second uv set), depends on #103 - #128
Open
DennisSmolek wants to merge 2 commits into
Open
DennisSmolek wants to merge 2 commits into
DennisSmolek wants to merge 2 commits into
Conversation
TextureInput.uvTransform (2x3 matrix) goes into the slot record (3 vec4u in a scene that has one, TextureLayout.transforms; byte-identical scene copy and kernels otherwise). rtTexSampleRecord reads at M uv, the cone footprint is scaled by the matrix magnification, a normal map's tangent frame is turned. Loader option uvTransform 'bake' (default) | 'slot'; bench TextureDesc.uvTransform, MeshDesc.uv.matrix, alpha-card classification, exporters throw on it. Check page texture-transform-check; DIVERGES V500-V504. Part of #52. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a and the shader) TextureInput.texCoord 1 reads the mesh's second uv set (SceneCopyMesh.uvs1, opt-in per mesh: SurfaceLayout.uvs1). Bit 31/30 of the slot record's last word, TextureLayout.uvSets gates all kernel text (every existing kernel byte-identical). rtSurface writes rtUv1 / rtUv1Frame (V600), set-1 cone footprint and normal-map frame follow (V602). Loader uvSets 'first' | 'slot' (V601), bench TextureDesc.texCoord / MeshDesc.uv1, web export TEXCOORD_1, native exports throw (V603), ReSTIR / MaterialX refuse (V604). Page texture-texcoord-check. Part of #52. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #52 (P1.4c1, the per-slot
texCoordhalf). Depends on #103 (issue-52-texture-transform): this branch is cut from it, so the diff againstmainalso shows #103's commit until that merges; this PR's own commit is the last one.What changed
SceneCopyMesh.uvs1(glTFTEXCOORD_1), stored only when a mesh has it (SurfaceLayout.uvs1, 2 floats per vertex after the tangent,MESH_FLAG.HAS_UVS1). A scene without it keeps its vertex stride.TextureInput.texCoord1 sets bit 31 of the slot record's last word (bit 30: a normal map read from it);TextureLayout.uvSetsgates all kernel text, so every kernel without a set-1 slot is byte-identical (all 355node bench/size-snapshot.tsfiles,diff -rqempty). New variantstex-uvset146.9 KB,tex-xf-uvset147.8 KB, wavefront shade 35.7 / 36.6 KB.rtSurfacewrites two module-scope privates,rtUv1(uv1, and the set-1 / set-0 uv density ratio) andrtUv1Frame;rtTexSampleRecord/rtTexLodOfread them for a set-1 record, so none of the ~10 call sites changed (V600). The cone footprint comes from the right set, and a normal map on set 1 is turned into set 0's tangent frame per triangle (rtUvFrame, twinuvFrameMatrix, V602; exact for conformal uv maps).uvSets: 'first' | 'slot'(defaultfirst= today's behaviour; alsouvTransformis now passed throughloadGltf).slotkeeps the first slot's set asuvsand the first other set asuvs1, each texture entry says which it reads (V601). Also fixes a P1.4c1: KHR_texture_transform per texture slot in the shader #103 key collision: an image whose first use had no transform and whose second had one got the same keyt0twice.TextureDesc.texCoord,MeshDesc.uv1, web glbTEXCOORD_1(exporters/gltf.ts,readGlbMeshes),filegeometry attributeuvs1, alpha-card classification reads the slot's set. pbrt / Mitsuba exports throw ontexCoord1 (V603). ReSTIR and MaterialX refuse set-1 slots;PtMegakernel.setScenethrows on a kernel / scene-copy layout mismatch (V604).Verified (correctness only; load 36, best effort)
node bench/runner/run.ts --page texture-texcoord-check --no-lock --load-wait 0(7 s, M5 Pro, Chrome 158):rtSurfacevs the CPU twins on 2000 hits (three rotated instances, one with a mirrored uv1, one without a second set): uv / uv1 / density ratio / frame matrix within 1.3e-7; four slots' lookups within 5e-3 (limit 1e-2), lod 5e-7.Unit tests:
texture-texcoord.test.ts(new),gltf-scene.test.ts(loader),restir.test.ts;pnpm typecheckshows only the pre-existing@pmndrs/vdberrors; vitest on packages/raytracer, packages/pathtracer, bench/scenes, bench/exporters, bench/adapters passes (the 4@pmndrs/vdbfiles cannot load in a fresh worktree).For the maintainer
uvSetsfirstvsslot): needs a Tier 1 scene withtexCoord1. KhronosMultiUVTestis not inMANIFEST.json(not pinned here: needs the pin procedure); once it is,node bench/runner/run.ts --page texture-texcoord-checkplus its golden.DIVERGES V600-V604, TASKS P1.4c1 and a CLAUDE.md trap are updated.
🤖 Generated with Claude Code