Repository navigation
feat: offer a three.js renderer in Code Animation with vendored addons - #10476
Merged
Merged
Conversation
#10464) Code Animation can now be generated with a `three` renderer. The host vendors the installed three.js plus a fixed allowlist of addons (post-processing, RoundedBoxGeometry, shaders, RoomEnvironment, BufferGeometryUtils), hashes them in a dependencies.json, and supplies the import map itself, so a film writes `import * as THREE from 'three'` and never touches a CDN. - Frame-exact export stages the host import map and the vendored modules beside the page; the render containment already serves only files in that directory. - The sandboxed preview and Download HTML inline the same modules as data: URLs behind an import map (new GET /api/code-animation/vendor/three). - The prompt teaches the deterministic renderFrame(t) pattern for three plus the bloom-threshold, depth-of-field and shadow-map traps from the spatial lens work. - The existing renderers and their prompts are unchanged.
atomantic
force-pushed
the
claim/issue-10464
branch
from
October 7, 2026 10:02
1c4cb82 to
ec761a9
Compare
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.
Summary
Code Animation gains a
threerenderer. The host vendors the installed three.js (0.186.1) plus a fixed addon allowlist, hashes the files, and supplies the import map itself, so a film writesimport * as THREE from 'three'and never reaches a CDN.server/services/codeAnimation/threeVendor.js): post-processing passes,RoundedBoxGeometry, the bloom/copy/output/bokeh shaders,RoomEnvironment,BufferGeometryUtils. The loader fails closed if any vendored module imports a relative path outside the set. Hashes land in adependencies.json(same shape music-video documents record).vendor/*next toindex.html. The existing render containment already serves only files inside the staged directory withscript-src 'self', so no containment change was needed../vendor, so the client inlines the modules asdata:URLs behind an import map (newGET /api/code-animation/vendor/three); the CSP only gainsdata:for scripts, and only for three films. Download HTML is a standalone file.RENDERER_GUIDANCE.threeteaches the deterministic one-persistent-scenerenderFrame(t)pattern plus the bloom-threshold, depth-of-field and shadow-map traps from Authored Three.js music-video worlds need a cinematic post stack (depth of field, bloom, grade) #10460 / Give authored Three.js music-video worlds depth of field, bloom and a graded finish via ctx.lens #10461. Other renderers' prompts are byte-identical.Test plan
export.realBrowser.test.js: real Chrome runs a three film (EffectComposer + bloom + OutputPass + RoundedBoxGeometry) from the vendored files;renderFrame(0.25)called twice on the same page is pixel-identical (and differs from 0.75); the render is network-free; every vendored file's hash matches. Probed by dropping the vendor files — the test fails.npm run pregategreen.Closes #10464