Skip to content

Lucent 2: glTF loading, HDRI importance sampling, layered BSDF, denoiser, temporal reprojection - #1

Merged
clark719664 merged 3 commits into
mainfrom
lucent-2
Oct 22, 2026
Merged

clark719664 merged 3 commits into
mainfrom
lucent-2

Conversation

@clark719664

Copy link
Copy Markdown
Owner

What this adds

Load real scenes

  • glTF 2.0 / GLB parser written from scratch (no dependencies, runs under Node for tests): node hierarchies, indexed/strip/fan primitives, interleaved, normalized and sparse accessors, mirrored transforms.
  • PBR textures (base colour + alpha mask/blend, metal-rough, normal, emissive), KHR_texture_transform, and the transmission, ior, volume, clearcoat, sheen, emissive_strength, unlit extensions. Files requiring Draco, meshopt or KTX2 are refused with a clear message.
  • Drag-and-drop of a .glb, a .gltf with its files, a folder, or an .hdr; plus an Open file… picker.
  • Gallery of Khronos sample models paired with Poly Haven CC0 HDRIs, streamed on demand (both hosts send CORS headers), plus the built-in scenes.

Rendering

  • Radiance .hdr decoder and alias-table environment importance sampling with MIS; the procedural sky is baked into the same path.
  • Layered BSDF: GGX clearcoat over Charlie sheen (energy-compensated) over the GGX/Lambert base, one mixture pdf; IOR-driven F0; thin-walled and Beer–Lambert volumetric transmission; alpha any-hit in traversal.
  • Scale-independent ray offsets (Wächter & Binder 2019).

Interaction

  • SVGF-style à-trous denoiser on demodulated illumination with MRT albedo/normal/depth guides; its reach shrinks with spp and it fades out by 1024 spp.
  • Temporal reprojection while the camera moves, gated by depth/normal agreement and by surface glossiness so mirrors and glass don't smear.
  • Resolution drops only when frames exceed 40 ms (never below 50%, Catmull-Rom upsampling); auto samples per frame when still.
  • HUD with measured spp, spp/s and Mpaths/s.

Speed

  • BVH builder rewritten on typed arrays with an explicit stack; big models build on a Web Worker. Triangle data split into traversal (3 texels) and shading (4 texels) textures.

Measured (RX 7600, 1280×720, Chrome/ANGLE D3D11)

Scene Triangles Mpaths/s
Cornell Box 36 106
Car Concept 213,347 62
Toy Car 108,936 54
A Beautiful Game 1,499,072 49
Showroom 9,682 47

Bundle: 45.7 kB gzipped JS (+4.5 kB worker chunk), still zero runtime dependencies.

Checks

  • npm run lint, typecheck, test (69 tests, up from 36) and build pass locally.
  • Verified in a real browser: built site served from dist/ loads gallery models (including the 1.5M-triangle chess set through the worker) with a clean console.

Merging deploys GitHub Pages.

🤖 Generated with Claude Code

clark719664 and others added 3 commits October 21, 2026 22:47
- glTF 2.0 / GLB loader with PBR textures (base colour + alpha, metal-rough,
  normal, emissive), KHR_texture_transform and the transmission, ior, volume,
  clearcoat, sheen, emissive_strength and unlit material extensions.
  Drag-and-drop of files or folders, plus a file picker.
- Radiance .hdr environments with alias-table importance sampling and MIS;
  the procedural sky is baked into the same path.
- BSDF: clearcoat with its own normal, Charlie sheen with an energy LUT,
  IOR-driven F0, thin-walled and Beer-Lambert volumetric transmission,
  alpha cut-outs in the traversal.
- SVGF-style a-trous denoiser guided by MRT albedo/normal/depth buffers.
- Low-resolution preview while the camera moves; auto samples per frame.
- Gallery of Khronos sample models and Poly Haven HDRIs, on-screen HUD.
- Typed-array BVH builder, run on a worker for large models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Each sample reprojects its primary hit into the previous view and reuses
  that pixel's history when depth and normal agree, so orbiting refines the
  image instead of restarting at 1 spp. History is capped per pixel by how
  view-dependent the surface is: mirrors and glass reuse none.
- Per-pixel sample counts (4th accumulation target) drive the running mean
  and the denoiser's variance estimate; the RNG seed never repeats.
- Preview resolution starts at full, only drops when frames exceed 40 ms,
  never below 50%, ignores throttled frames, and upsamples with Catmull-Rom.
- Denoiser fades out by 1024 spp; HUD moved clear of the toast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New hero (Car Concept at 1024 spp) and gallery renders, denoiser
  before/after, measured performance table, updated architecture notes.
- Gallery entries can set ground colour/roughness and camera framing.
- GPU name in the stats panel is shortened from the ANGLE string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clark719664
clark719664 merged commit 66a700f into main Oct 22, 2026
2 checks passed
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
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