Repository navigation
feat(registry): add path-traced-3d example with raster preview and path-traced export - #7219
Merged
Merged
Conversation
…th-traced export An opt-in Three.js starter: previews with raster rendering and exports with three-gpu-pathtracer, from one scene file. three 0.180.0, three-gpu-pathtracer 0.0.24 and three-mesh-bvh 0.9.5 ship as one local, pinned ES module with their licences and a rebuild recipe, so renders make no network requests and 2D projects never load the tracer. Setup is one buildReady promise that awaits library readiness promises only and ends with a throwaway frame and a one-pixel readback. Frames are drawn in the hf-seek listener through waitUntil, each time from zero with a fixed sample count. Math.random is seeded while the scene and tracer are built, because object ids order light sampling and the tracer's noise textures come from it. Adds a skill reference and a docs guide for the setup and seek contract, the frozen clock, why scheduler.yield() waits hang, and sample/bounce cost. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 107 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 3 nits · head 9e29ef8d
- blocker (CI, file not in diff): required
CI › Test (cli 2/2)failspackages/cli/src/commands/docs.test.ts. That test expects everyregistry/examples/*dir to have a## <name>section inpackages/cli/src/docs/examples.mdcontaining its registry-item description. To fix it, add## path-traced-3d+Three.js scene with a fast raster preview and an opt-in path-traced export.That file isn't a generated catalog path, socheck-catalog-source-prallows the edit.
Scope / determinism audit
I read render.js against the unminified three-gpu-pathtracer 0.0.24 / three 0.180.0 sources. The determinism properties hold:
- Seeding: every order-sensitive
Math.randomconsumer is inside a seed window. Light, mesh and texture order sort byuuid, and the uuids come fromcreateScene(seed 1). Blue-noise and stratified textures are built in the tracer constructor (seed 2). Objects created later in per-seeksetScene(theGradientEquirectTexturebackground, per-mesh intermediate geometry) only get equality-compared, never sorted. - Compile wait:
isCompilingis exactlyBoolean(_pathTracer._compilePromise), and the library clears it in a.thenregistered before ours. So the awaited promise is always real and the loop cannot spin. This is still true in 0.0.28. - Sample count: tiles default to 3×3, so each
renderSampleadds 1/9 and the last tile rounds.samples < targettherefore runs exactlytargetfull passes.stableNoisereset restores identity strata, index 0, generator seed 0 andmaterial.seed = 0on every reset, so a time's pixels don't depend on history.renderDelay0 against the shim's constant-within-a-seekperformance.nowis safe. - BVH: it is built once at setup's
poseAt(0), and later seeks onlyrefit(). Every worker gets the same topology.
path-traced-3d.test.mjs passes locally (5/5). Windows render verification was still running when I posted. I skimmed the vendored bundle, verify-render.mjs and the lockfile; I didn't audit them.
— Genesis
Add the example's section to the CLI examples doc, which docs.test.ts requires for every registry example. Throw if the tracer reports compiling but exposes no compile promise, instead of spinning renderSample(). Say that three's object uuids set the tracer's sort order, that later-created objects need the seed too, and that Date and performance.now read the current seek time during a render rather than staying at 0. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This branch was successfully 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.
What
Adds
path-traced-3d, an opt-in Three.js starter. It previews with raster rendering and exports with a path tracer, from the same scene file. It also adds a skill reference (skills/hyperframes/references/path-tracing.md) and a docs guide (docs/guides/path-tracing.mdx).The
renderervariable israster(the default, for fast preview) orpath(for export).samplesandbouncesare also variables.three 0.180.0, three-gpu-pathtracer 0.0.24 and three-mesh-bvh 0.9.5 ship as one local ES module, with:
source/.There are no CDN imports, and 2D projects never load the tracer.
Why
Path tracing in HyperFrames already works with existing APIs:
window.__hf.buildReady,hf-seekwithwaitUntil, and composition variables. But it's easy to get wrong:scheduler.yield()never finishes anywhere. Yield continuations run ahead of timers, so the loop starves thesetTimeoutthat Three'scompileAsyncpolls with. Plain headless Chrome 152 hangs on a ten-line page that does this.Math.random.This starter and recipe show a deterministic, verified version of each.
Related work
How
assets/scene.jsbuilds the scene, andposeAt(t)is the only code that moves anything.assets/render.js:buildReadypromise. It awaitsrenderer.compileAsync(raster), or the tracer's compile promise behindisCompiling(path), in one commented helper. It draws one throwaway frame, because a renderer's first frame differs from later ones, then reads one pixel back.hf-seeklistener, registered withwaitUntil. Each new time restarts accumulation and traces exactlysamplespasses.renderDelayandfadeDurationare 0, anddynamicLowResis off.Math.randomseed.scheduler.yield(), and nothing starts a render loop.source/holds the repo-only files, which aren't installed:package.jsonand lockfile, plusbuild.mjs(a rebuild produces the same hash);path-traced-3d.test.mjs(intest:scripts), which checks the manifest, local-only imports, the bundle hash and pins, thatrender.jsuses no timers, animation frames or clock, and that a pose depends only on its time;verify-render.mjs, the render check.Test plan
path-traced-3d.test.mjs(5 tests) passes. The skill lint, core-skills and catalog-source-PR checks pass (64 tests).verify-render.mjs, run on a machine without a hardware GPU (software WebGL), at 320x180 and 2 samples per pixel in path mode:hyperframes checkpasses in path mode, so the async setup resolves.frame-adapters.mdx,types/3d.mdandruntimes.md.Notes
hyperframes init --example path-traced-3dstarts working once the catalog publication PR adds the example toregistry/registry.json.docs/docs.json, so the guide is linked from the frame-adapters page instead of the sidebar. A small follow-up can add the sidebar entry.--timeoutor--player-ready-timeout.🤖 Generated with Claude Code