agentcut 0.2.25 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -148
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -5
- package/dist/config.js.map +1 -1
- package/dist/studio/agents/claude.js +3 -2
- package/dist/studio/agents/claude.js.map +1 -1
- package/dist/studio/chat.js +1 -1
- package/dist/studio/chat.js.map +1 -1
- package/dist/studio/cli.js +40 -21
- package/dist/studio/cli.js.map +1 -1
- package/dist/studio/download.d.ts +24 -0
- package/dist/studio/download.js +234 -0
- package/dist/studio/download.js.map +1 -0
- package/dist/studio/host.d.ts +1 -2
- package/dist/studio/host.js +36 -8
- package/dist/studio/host.js.map +1 -1
- package/dist/studio/housekeeping.d.ts +2 -2
- package/dist/studio/housekeeping.js +18 -17
- package/dist/studio/housekeeping.js.map +1 -1
- package/dist/studio/mcp-guides.js +1 -18
- package/dist/studio/mcp-guides.js.map +1 -1
- package/dist/studio/proc.js +16 -6
- package/dist/studio/proc.js.map +1 -1
- package/dist/studio/proxies.d.ts +4 -0
- package/dist/studio/proxies.js +15 -6
- package/dist/studio/proxies.js.map +1 -1
- package/dist/studio/release-cursor.js +21 -21
- package/dist/studio/release-video.js +10 -10
- package/dist/studio/schema.d.ts +0 -1
- package/dist/studio/schema.js +0 -1
- package/dist/studio/schema.js.map +1 -1
- package/dist/studio/tools.d.ts +0 -4
- package/dist/studio/tools.js +32 -31
- package/dist/studio/tools.js.map +1 -1
- package/dist/studio/voice/kokoro-catalog.d.ts +56 -28
- package/dist/studio/voice/kokoro-catalog.js +56 -28
- package/dist/studio/voice/kokoro-catalog.js.map +1 -1
- package/dist/studio/voice/ming-catalog.d.ts +19 -0
- package/dist/studio/voice/ming-catalog.js +40 -0
- package/dist/studio/voice/ming-catalog.js.map +1 -0
- package/dist/studio/voice/ming.d.ts +12 -0
- package/dist/studio/voice/ming.js +397 -0
- package/dist/studio/voice/ming.js.map +1 -0
- package/dist/studio/voice/previews.d.ts +5 -0
- package/dist/studio/voice/previews.js +50 -0
- package/dist/studio/voice/previews.js.map +1 -0
- package/dist/studio/voice/registry.js +2 -0
- package/dist/studio/voice/registry.js.map +1 -1
- package/dist/studio/voice.d.ts +1 -1
- package/dist/studio/voice.js +5 -6
- package/dist/studio/voice.js.map +1 -1
- package/package.json +56 -56
- package/template/AGENTS.md +14 -14
- package/template/components/README.md +70 -70
- package/template/components/before-after/BeforeAfter.tsx +89 -89
- package/template/components/catalog.ts +107 -107
- package/template/components/cinematic/Device3D.tsx +324 -324
- package/template/components/cinematic/devices3d/display-model.ts +184 -184
- package/template/components/cinematic/devices3d/iphone-model.ts +643 -643
- package/template/components/cinematic/devices3d/macbook-model.ts +608 -608
- package/template/components/cinematic/devices3d/models.ts +657 -657
- package/template/components/cinematic/devices3d/runtime.ts +267 -267
- package/template/components/cinematic/math.ts +100 -100
- package/template/components/color/grade-effect.ts +650 -650
- package/template/components/color/grade.ts +512 -512
- package/template/components/color/looks.ts +154 -154
- package/template/components/countdown/Countdown.tsx +166 -166
- package/template/components/dot-trace-title/DotTraceTitle.tsx +181 -181
- package/template/components/dot-trace-title/meta.json +51 -51
- package/template/components/generate/GenerateReveal.tsx +381 -381
- package/template/components/hook-card/HookCard.tsx +554 -554
- package/template/components/index.ts +199 -199
- package/template/components/lib.ts +191 -191
- package/template/components/line-diagram/LineDiagram.tsx +205 -205
- package/template/components/line-diagram/meta.json +215 -215
- package/template/components/list-card/ListCard.tsx +104 -104
- package/template/components/live-clip.ts +75 -75
- package/template/components/looks.tsx +1447 -1447
- package/template/components/loops/LoopCanvas.tsx +132 -132
- package/template/components/loops/engine.ts +184 -184
- package/template/components/loops/library.ts +667 -667
- package/template/components/loops/library2.ts +777 -777
- package/template/components/motion-loop/MotionLoop.tsx +37 -37
- package/template/components/motion-loop/meta.json +311 -311
- package/template/components/props.ts +73 -73
- package/template/components/quote-card/QuoteCard.tsx +71 -71
- package/template/components/style-layer.tsx +233 -233
- package/template/components/styles.ts +113 -113
- package/template/components/types.ts +66 -66
- package/template/components/word-pop/WordPop.tsx +59 -59
- package/template/components/word-stack/WordStack.tsx +122 -122
- package/template/presets/charcoal-sketch/PROMPT.md +48 -48
- package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -34
- package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -376
- package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -73
- package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -119
- package/template/runtime/composition.tsx +1189 -1185
- package/template/runtime/helpers.tsx +230 -230
- package/template/runtime/index.tsx +22 -22
- package/template/runtime/types.ts +315 -315
- package/template/skill/SKILL.md +186 -351
- package/template/skill/references/broll.md +44 -44
- package/template/skill/references/browser-export.md +61 -61
- package/template/skill/references/cinematic.md +206 -206
- package/template/skill/references/color.md +79 -79
- package/template/skill/references/craft.md +54 -10
- package/template/skill/references/editing-styles.md +57 -57
- package/template/skill/references/feature-launch.md +5 -1
- package/template/skill/references/footage.md +72 -72
- package/template/skill/references/format.md +142 -142
- package/template/skill/references/how-to.md +0 -15
- package/template/skill/references/launch-direction.md +89 -0
- package/template/skill/references/loops.md +151 -151
- package/template/skill/references/mcp-external.md +19 -0
- package/template/skill/references/performance.md +93 -93
- package/template/skill/references/person-cutout.md +19 -19
- package/template/skill/references/presets.md +60 -60
- package/template/skill/references/product-launch.md +4 -1
- package/template/skill/references/release-capture.md +53 -0
- package/template/skill/references/sound.md +167 -155
- package/template/skill/references/style-spy.md +160 -160
- package/template/skill/references/website-howto.md +45 -45
- package/template/starter/.studio/chat.json +1 -1
- package/template/starter/layers.json +46 -46
- package/template/starter/notes.md +4 -4
- package/template/starter/project.json +13 -13
- package/template/starter/scenes/Title.tsx +38 -38
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# Archival b-roll
|
|
2
|
-
|
|
3
|
-
Agentcut has a catalog of public-domain shots cut from archive.org films (Prelinger industrial and
|
|
4
|
-
educational films, newsreels, home movies): 1930s–1970s, colour and black-and-white, silent, free to use
|
|
5
|
-
in any video, commercial included (brand logos seen in a shot are still trademarks). Use it for b-roll
|
|
6
|
-
under a voice-over, for backgrounds behind lyrics or captions, and for "archival" looks (retro tech ads,
|
|
7
|
-
documentary, nostalgic lyric videos). It also has a smaller set of modern AI-generated clips (tech, work,
|
|
8
|
-
cities, science, abstract); their film title says "AI-generated" and they aren't archival or public domain.
|
|
9
|
-
|
|
10
|
-
## Find shots
|
|
11
|
-
|
|
12
|
-
`agentcut_broll_search` searches by meaning: describe what the shot shows or what it should make the
|
|
13
|
-
viewer feel. Literal ("a clock on a wall", "assembly line", "crowd waving hats") and figurative ("waiting",
|
|
14
|
-
"progress", "lonely city at night") both work; try two or three phrasings for an important beat and pick
|
|
15
|
-
from the union. Filters: `color`, `backgroundOk` (calm, simple frames for text on top), `noPeople`, `calm`
|
|
16
|
-
(little movement), `minSeconds`. Search runs in the user's browser: the very first search downloads its
|
|
17
|
-
model once (about 110 MB) and can take a minute; after that it's instant.
|
|
18
|
-
|
|
19
|
-
Results describe each shot (from a vision model), its tags and mood, camera and motion, length and size.
|
|
20
|
-
Descriptions can be wrong: open the `thumb` of anything you're unsure of, and capture frames once placed.
|
|
21
|
-
Skip `textOnScreen` shots under captions (two texts fight) unless the sign is the point.
|
|
22
|
-
|
|
23
|
-
## Match footage to words (lyric and transcript videos)
|
|
24
|
-
|
|
25
|
-
1. `agentcut_transcribe` the voice or song; split it into lines or phrases.
|
|
26
|
-
2. For each line pick the image it calls for: the literal noun ("clock", "rain", "highway") or the feeling
|
|
27
|
-
when there's no noun ("I'm still here" → a lone figure, an empty street). Search, choose, and never use
|
|
28
|
-
the same shot twice; vary shot size (wide → close) between neighbours.
|
|
29
|
-
3. Cut a few frames before the key word (voice) or on the beat (music, `agentcut_analyze_audio`). Shots
|
|
30
|
-
run 1.5–14 s; use `trimStart` to start on the best moment and `playbackRate` 0.5–0.8 to hold a short shot
|
|
31
|
-
longer (archival footage takes slow motion well).
|
|
32
|
-
4. Lyrics or captions on top: prefer `backgroundOk` shots, keep text in the calm part of the frame, and
|
|
33
|
-
dim busy shots with a dark scene layer above the footage.
|
|
34
|
-
|
|
35
|
-
## Place and finish
|
|
36
|
-
|
|
37
|
-
- `agentcut_add_broll` copies picks into `assets/broll/` at full quality (the same file exports). Put them
|
|
38
|
-
on a video track: `"muted": true` (they're silent), `"fit": "cover"`.
|
|
39
|
-
- Most shots are 4:3 and SD (640×480). `cover` fills 16:9 and 9:16 by cropping: capture both variants and
|
|
40
|
-
check the subject stays in frame. They look softer than modern footage, so treat that as the style:
|
|
41
|
-
one consistent `grade` for every shot (e.g. mixing colour and black-and-white: `saturation: 0`,
|
|
42
|
-
`contrast: 1.15`), film grain or a vignette as a scene on its own track, sharp modern type on top.
|
|
43
|
-
- Write a credits list in `notes.md` from the `credit` lines `agentcut_add_broll` returns (film, year,
|
|
44
|
-
archive.org link). Public domain needs no credit, but the user may want to give one.
|
|
1
|
+
# Archival b-roll
|
|
2
|
+
|
|
3
|
+
Agentcut has a catalog of public-domain shots cut from archive.org films (Prelinger industrial and
|
|
4
|
+
educational films, newsreels, home movies): 1930s–1970s, colour and black-and-white, silent, free to use
|
|
5
|
+
in any video, commercial included (brand logos seen in a shot are still trademarks). Use it for b-roll
|
|
6
|
+
under a voice-over, for backgrounds behind lyrics or captions, and for "archival" looks (retro tech ads,
|
|
7
|
+
documentary, nostalgic lyric videos). It also has a smaller set of modern AI-generated clips (tech, work,
|
|
8
|
+
cities, science, abstract); their film title says "AI-generated" and they aren't archival or public domain.
|
|
9
|
+
|
|
10
|
+
## Find shots
|
|
11
|
+
|
|
12
|
+
`agentcut_broll_search` searches by meaning: describe what the shot shows or what it should make the
|
|
13
|
+
viewer feel. Literal ("a clock on a wall", "assembly line", "crowd waving hats") and figurative ("waiting",
|
|
14
|
+
"progress", "lonely city at night") both work; try two or three phrasings for an important beat and pick
|
|
15
|
+
from the union. Filters: `color`, `backgroundOk` (calm, simple frames for text on top), `noPeople`, `calm`
|
|
16
|
+
(little movement), `minSeconds`. Search runs in the user's browser: the very first search downloads its
|
|
17
|
+
model once (about 110 MB) and can take a minute; after that it's instant.
|
|
18
|
+
|
|
19
|
+
Results describe each shot (from a vision model), its tags and mood, camera and motion, length and size.
|
|
20
|
+
Descriptions can be wrong: open the `thumb` of anything you're unsure of, and capture frames once placed.
|
|
21
|
+
Skip `textOnScreen` shots under captions (two texts fight) unless the sign is the point.
|
|
22
|
+
|
|
23
|
+
## Match footage to words (lyric and transcript videos)
|
|
24
|
+
|
|
25
|
+
1. `agentcut_transcribe` the voice or song; split it into lines or phrases.
|
|
26
|
+
2. For each line pick the image it calls for: the literal noun ("clock", "rain", "highway") or the feeling
|
|
27
|
+
when there's no noun ("I'm still here" → a lone figure, an empty street). Search, choose, and never use
|
|
28
|
+
the same shot twice; vary shot size (wide → close) between neighbours.
|
|
29
|
+
3. Cut a few frames before the key word (voice) or on the beat (music, `agentcut_analyze_audio`). Shots
|
|
30
|
+
run 1.5–14 s; use `trimStart` to start on the best moment and `playbackRate` 0.5–0.8 to hold a short shot
|
|
31
|
+
longer (archival footage takes slow motion well).
|
|
32
|
+
4. Lyrics or captions on top: prefer `backgroundOk` shots, keep text in the calm part of the frame, and
|
|
33
|
+
dim busy shots with a dark scene layer above the footage.
|
|
34
|
+
|
|
35
|
+
## Place and finish
|
|
36
|
+
|
|
37
|
+
- `agentcut_add_broll` copies picks into `assets/broll/` at full quality (the same file exports). Put them
|
|
38
|
+
on a video track: `"muted": true` (they're silent), `"fit": "cover"`.
|
|
39
|
+
- Most shots are 4:3 and SD (640×480). `cover` fills 16:9 and 9:16 by cropping: capture both variants and
|
|
40
|
+
check the subject stays in frame. They look softer than modern footage, so treat that as the style:
|
|
41
|
+
one consistent `grade` for every shot (e.g. mixing colour and black-and-white: `saturation: 0`,
|
|
42
|
+
`contrast: 1.15`), film grain or a vignette as a scene on its own track, sharp modern type on top.
|
|
43
|
+
- Write a credits list in `notes.md` from the `credit` lines `agentcut_add_broll` returns (film, year,
|
|
44
|
+
archive.org link). Public domain needs no credit, but the user may want to give one.
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
# Browser export: what the renderer can draw
|
|
2
|
-
|
|
3
|
-
Captures (`agentcut_capture_frames`, `_contact_sheet`) and the export use Remotion's web renderer
|
|
4
|
-
(`@remotion/web-renderer`, encoding with Mediabunny). It walks the DOM and draws each element onto a canvas,
|
|
5
|
-
so it supports a **subset** of CSS. The live preview (Remotion Player) is a normal browser page and shows
|
|
6
|
-
everything — so a scene can look right in the preview and wrong in the export. Always judge by captures.
|
|
7
|
-
|
|
8
|
-
## Replace these
|
|
9
|
-
|
|
10
|
-
| Don't use | Use instead |
|
|
11
|
-
|---|---|
|
|
12
|
-
| `z-index` | order elements back to front in the DOM (later = on top) |
|
|
13
|
-
| `background: radial-gradient(…)` / `conic-gradient` | `<RadialGlow x y radius color opacity />` from `agentcut`, or an inline `<svg>` with `<radialGradient>` |
|
|
14
|
-
| `background-image: url()` | `<Img>` or an image clip |
|
|
15
|
-
| `mix-blend-mode`, `background-blend-mode` | pre-blended colors, opacity, or an SVG with the effect baked in |
|
|
16
|
-
| `backdrop-filter` (glass blur) | a semi-opaque fill + a blurred copy of the background behind it |
|
|
17
|
-
| `box-shadow: inset …`, shadow spread | an inner element with a gradient/border, or an outer shadow without spread |
|
|
18
|
-
| `object-position` | position the `<Img>` inside an `overflow: hidden` box with transforms |
|
|
19
|
-
| `perspective`, `transform-style: preserve-3d` | the cinematic `Stage` / `Plane` from `agentcut/components` (one `matrix3d()` per element, drawn through WebGL; see `cinematic.md`), or 2D transforms faking depth |
|
|
20
|
-
| `mask-image` with radial/SVG masks | linear-gradient masks, or `clip-path` shapes (`inset`, `circle`, `polygon`) |
|
|
21
|
-
| `clip-path: url(#svgClip)` | `clip-path: polygon(…)` / `circle(…)` |
|
|
22
|
-
| `OffthreadVideo`, `Html5Video`, `Html5Audio` | `<Video>` / `<Audio>` from `@remotion/media` (or video/audio clips) |
|
|
23
|
-
| `writing-mode`, wavy `text-decoration` | rotated boxes, SVG paths |
|
|
24
|
-
| fonts from CSS `@import` / `<link>` in scenes | `project.json` → `fonts` |
|
|
25
|
-
|
|
26
|
-
Supported and safe: flexbox/grid layout, `transform` (2D), `opacity`, `filter` (blur, brightness…; not in
|
|
27
|
-
Safari), `linear-gradient` backgrounds, `border-radius`, borders, outer `box-shadow`, `text-shadow`,
|
|
28
|
-
`clip-path` shapes, inline SVG (gradients, paths, filters inside the SVG), `<Img>`, canvas.
|
|
29
|
-
|
|
30
|
-
Text inside SVG `<text>` or `foreignObject` doesn't get project fonts: prefer HTML text.
|
|
31
|
-
|
|
32
|
-
## Checklist after writing a scene
|
|
33
|
-
|
|
34
|
-
1. `agentcut_status` → no build errors.
|
|
35
|
-
2. Capture its entrance, hold and exit in both variants.
|
|
36
|
-
3. Compare with what you meant. Missing glow, wrong stacking, hard edges where a blend was → one of the
|
|
37
|
-
properties above.
|
|
38
|
-
4. If an effect can't be done within these rules and the user wants it, say so: the "Render on this
|
|
39
|
-
computer" export (classic Remotion renderer) draws full CSS, but the captures won't show it.
|
|
40
|
-
|
|
41
|
-
Shader transitions (`@remotion/transitions` zoom-blur, film-burn, …) use WebGL: they render in the browser
|
|
42
|
-
but slowly; check a capture of a transition frame before relying on one.
|
|
43
|
-
|
|
44
|
-
## WebGL / three.js scenes
|
|
45
|
-
|
|
46
|
-
- Create the `<canvas>` **inside** the effect (`document.createElement("canvas")`, append it to a container
|
|
47
|
-
`<div ref>`), and remove it in the cleanup. Never call `renderer.forceContextLoss()` on a canvas React
|
|
48
|
-
keeps: the dev server mounts every component twice, and the second mount gets a dead context
|
|
49
|
-
("Cannot read properties of null (reading 'precision')").
|
|
50
|
-
- `preserveDrawingBuffer: true` so captures and the export can read the pixels; render synchronously for the
|
|
51
|
-
current frame (`useCurrentFrame()`), never in `requestAnimationFrame`.
|
|
52
|
-
- One renderer per scene, sized to the composition (`useVideoConfig()`), `setPixelRatio(1)`. Dispose
|
|
53
|
-
geometries, materials, textures and the renderer in the cleanup. Browsers allow ~16 live WebGL contexts.
|
|
54
|
-
- Keep the live preview smooth. The Player draws 30 frames a second on the page's main thread; when a
|
|
55
|
-
frame takes longer, it skips frames, and the user sees stutters and jumps. Use `usePreviewQuality()` from
|
|
56
|
-
`agentcut`: `renderer.setPixelRatio(q.pixelRatio)`, `shadow.mapSize.set(q.shadowMapSize, …)`,
|
|
57
|
-
and redraw big canvas textures (`needsUpdate`) only every `q.textureEvery` frames. Captures and the export
|
|
58
|
-
always get full quality.
|
|
59
|
-
- Call `renderer.compile(scene, camera)` at the end of setup so shaders compile while the scene is
|
|
60
|
-
premounted (clips mount 1 s early in the preview), not on its first visible frame.
|
|
61
|
-
- Capture a frame of every 3D scene in both variants before moving on.
|
|
1
|
+
# Browser export: what the renderer can draw
|
|
2
|
+
|
|
3
|
+
Captures (`agentcut_capture_frames`, `_contact_sheet`) and the export use Remotion's web renderer
|
|
4
|
+
(`@remotion/web-renderer`, encoding with Mediabunny). It walks the DOM and draws each element onto a canvas,
|
|
5
|
+
so it supports a **subset** of CSS. The live preview (Remotion Player) is a normal browser page and shows
|
|
6
|
+
everything — so a scene can look right in the preview and wrong in the export. Always judge by captures.
|
|
7
|
+
|
|
8
|
+
## Replace these
|
|
9
|
+
|
|
10
|
+
| Don't use | Use instead |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `z-index` | order elements back to front in the DOM (later = on top) |
|
|
13
|
+
| `background: radial-gradient(…)` / `conic-gradient` | `<RadialGlow x y radius color opacity />` from `agentcut`, or an inline `<svg>` with `<radialGradient>` |
|
|
14
|
+
| `background-image: url()` | `<Img>` or an image clip |
|
|
15
|
+
| `mix-blend-mode`, `background-blend-mode` | pre-blended colors, opacity, or an SVG with the effect baked in |
|
|
16
|
+
| `backdrop-filter` (glass blur) | a semi-opaque fill + a blurred copy of the background behind it |
|
|
17
|
+
| `box-shadow: inset …`, shadow spread | an inner element with a gradient/border, or an outer shadow without spread |
|
|
18
|
+
| `object-position` | position the `<Img>` inside an `overflow: hidden` box with transforms |
|
|
19
|
+
| `perspective`, `transform-style: preserve-3d` | the cinematic `Stage` / `Plane` from `agentcut/components` (one `matrix3d()` per element, drawn through WebGL; see `cinematic.md`), or 2D transforms faking depth |
|
|
20
|
+
| `mask-image` with radial/SVG masks | linear-gradient masks, or `clip-path` shapes (`inset`, `circle`, `polygon`) |
|
|
21
|
+
| `clip-path: url(#svgClip)` | `clip-path: polygon(…)` / `circle(…)` |
|
|
22
|
+
| `OffthreadVideo`, `Html5Video`, `Html5Audio` | `<Video>` / `<Audio>` from `@remotion/media` (or video/audio clips) |
|
|
23
|
+
| `writing-mode`, wavy `text-decoration` | rotated boxes, SVG paths |
|
|
24
|
+
| fonts from CSS `@import` / `<link>` in scenes | `project.json` → `fonts` |
|
|
25
|
+
|
|
26
|
+
Supported and safe: flexbox/grid layout, `transform` (2D), `opacity`, `filter` (blur, brightness…; not in
|
|
27
|
+
Safari), `linear-gradient` backgrounds, `border-radius`, borders, outer `box-shadow`, `text-shadow`,
|
|
28
|
+
`clip-path` shapes, inline SVG (gradients, paths, filters inside the SVG), `<Img>`, canvas.
|
|
29
|
+
|
|
30
|
+
Text inside SVG `<text>` or `foreignObject` doesn't get project fonts: prefer HTML text.
|
|
31
|
+
|
|
32
|
+
## Checklist after writing a scene
|
|
33
|
+
|
|
34
|
+
1. `agentcut_status` → no build errors.
|
|
35
|
+
2. Capture its entrance, hold and exit in both variants.
|
|
36
|
+
3. Compare with what you meant. Missing glow, wrong stacking, hard edges where a blend was → one of the
|
|
37
|
+
properties above.
|
|
38
|
+
4. If an effect can't be done within these rules and the user wants it, say so: the "Render on this
|
|
39
|
+
computer" export (classic Remotion renderer) draws full CSS, but the captures won't show it.
|
|
40
|
+
|
|
41
|
+
Shader transitions (`@remotion/transitions` zoom-blur, film-burn, …) use WebGL: they render in the browser
|
|
42
|
+
but slowly; check a capture of a transition frame before relying on one.
|
|
43
|
+
|
|
44
|
+
## WebGL / three.js scenes
|
|
45
|
+
|
|
46
|
+
- Create the `<canvas>` **inside** the effect (`document.createElement("canvas")`, append it to a container
|
|
47
|
+
`<div ref>`), and remove it in the cleanup. Never call `renderer.forceContextLoss()` on a canvas React
|
|
48
|
+
keeps: the dev server mounts every component twice, and the second mount gets a dead context
|
|
49
|
+
("Cannot read properties of null (reading 'precision')").
|
|
50
|
+
- `preserveDrawingBuffer: true` so captures and the export can read the pixels; render synchronously for the
|
|
51
|
+
current frame (`useCurrentFrame()`), never in `requestAnimationFrame`.
|
|
52
|
+
- One renderer per scene, sized to the composition (`useVideoConfig()`), `setPixelRatio(1)`. Dispose
|
|
53
|
+
geometries, materials, textures and the renderer in the cleanup. Browsers allow ~16 live WebGL contexts.
|
|
54
|
+
- Keep the live preview smooth. The Player draws 30 frames a second on the page's main thread; when a
|
|
55
|
+
frame takes longer, it skips frames, and the user sees stutters and jumps. Use `usePreviewQuality()` from
|
|
56
|
+
`agentcut`: `renderer.setPixelRatio(q.pixelRatio)`, `shadow.mapSize.set(q.shadowMapSize, …)`,
|
|
57
|
+
and redraw big canvas textures (`needsUpdate`) only every `q.textureEvery` frames. Captures and the export
|
|
58
|
+
always get full quality.
|
|
59
|
+
- Call `renderer.compile(scene, camera)` at the end of setup so shaders compile while the scene is
|
|
60
|
+
premounted (clips mount 1 s early in the preview), not on its first visible frame.
|
|
61
|
+
- Capture a frame of every 3D scene in both variants before moving on.
|