What does 2d-in-3d do?
Input: the user's voiceover audio file and its script text.
Output: out/final.mp4, vertical 1080x1920 at 30 fps, with the voiceover, a generated march score and effects, and burned word-by-word captions.
What changes every video: the story world, the sets, the cast and the props. What never changes: the look (lighting rig, grade, post chain), camera language, character style, pipeline and quality gate.
- Skill folder:
~/.claude/skills/2d-in-3d/, written$SKbelow. engine/core.js: renderer, look presets, lights, sky, builders, card system, post chain, motion blur,start()cards.js: character drawer with open part registriesindex.html,render.mjs,scene.example.js
scripts/new_project.py,fetch_polyhaven.py,align.py,captions.py,gate.py,sheet.py,finish.pyaudio.py: procedural march score with twist hit and drone, plus effects from a cue tablemix.py: voice + music + effects at measured levels
reference/look.md: measured numbers, presets, post chaincamera.md: moves and timeline rulescharacters.mdpitfalls.mdsound.md: music recipe, effect cue rules, mix targets
history.json: what each past video used, so the next one differs
Read reference/look.md and reference/camera.md before writing any scene. Read reference/sound.md before writing the cue table. Read pitfalls.md before the first test render.
Requirements (this machine)
- Node with
playwrightandthreein~/shorts/node_modules.- Put projects under
~/shorts/<slug>/so imports resolve.
- Put projects under
- Chromium headless shell from Playwright. It renders on the GPU through ANGLE D3D11 (RTX 2050 measured at about 0.22 s per frame).
- Python with
faster-whisper(modelsmall.enis cached),opencv-python,numpy,scipyandsoundfile.ffmpegandffprobemust be on PATH. - Downloads need the user's OK before they happen: Poly Haven assets, and any whisper model other than the cached
small.en.- State the names and approximate size when asking.
Process
1. Set up the project
python $SK/scripts/new_project.py ~/shorts/<slug>
- Copy the voiceover to
audio/vo.<ext>. - Save the script as
audio/script.txt.
2. Get word timing
python -I $SK/scripts/align.py audio/vo.wav audio/script.txt web/words.json
- This prints the sentences with start and end times.
- Check the "matched" count. Below 80 %, the script does not match the audio: ask the user.
3. Plan (write plan.md before any code)
-
World: one sentence on the setting. Make it different from the entries in
history.json. -
Sets: 2-4 locations. Each gets a key direction, a look preset and at least one warm practical.
-
Cast: new designs (see
reference/characters.md). Give each a signature colour. -
Shot table: one beat per sentence or phrase (see
reference/camera.md).- Columns: frames from
words.json, set, look, camera move, actors and expressions on the trigger word, props and FX. - At most 3 hard cuts per 10 s. Everything else is a camera move.
- Columns: frames from
-
Assets: search Poly Haven for the setting, then list the models and textures to fetch:
python -I $SK/scripts/fetch_polyhaven.py search models <keywords> python -I $SK/scripts/fetch_polyhaven.py search textures <keywords>- Prefer 8-16 models and 4-7 textures, about 30-60 MB at 1k.
- Ask the user before downloading, then fetch:
python -I $SK/scripts/fetch_polyhaven.py fetch web/assets --models a,b --tex c,d
4. Build web/scene.js
Replace the example completely. Structure:
import { THREE, setCast, start, mkSet, loadModels, place, pbr, std, glow, plane, add, bladeField, treeField, scatter,
fire, practical, onUpdate, V, path, num, lerp, ease, seg, shake, rng, fetchJSON, FPS } from './core.js';
setCast({ ... }); // new cast
const { words, sentences, duration } = await fetchJSON('words.json');
const at = (i) => Math.round(words[i].t0 * FPS); // frame of word i
await loadModels([...]); // Poly Haven models
const A = mkSet('village', 0, 0, { keyAz: 10, keyEl: 20 }); // sets far apart: x = 0, 3000, 6000...
// ground: pbr texture at high repeat; dense detail: bladeField / treeField / scatter / place(); fire()/practical() warm pools
start({ shots: [ { a, b, set, look, shutter, cam: (f) => ({ pos, look, fov, ap, yaw }), actors: (f) => [...], update: (f, t, cards, origin) => {} }, ... ] });
- The last shot's
bmust be at leastceil(duration * 30). - Shots must be contiguous: each shot's
bequals the next shot'sa. - The detail budget is what makes the video look rich.
- Every close shot needs: a textured ground, a foreground element, a midground of props, a background with fog, and sky.
- Every wide or aerial shot needs thousands of instances: blades, trees, buildings in grids, lights.
5. Test keyframes and look at them
node render.mjs test "<one frame per shot, plus each shot's first and last>"
python -I $SK/scripts/sheet.py test test/sheet.jpg
- Read
sheet.jpgand check:- characters are big enough and not cut off
- the disc (moon or sun) is in frame where it is wanted
- no blob or prop blocks the camera
- no character is missing
- there are warm and cool pools
- nothing is empty or flat
- Fix the problems and repeat. Use
--sub 1for fast previews of layout only.
6. Full render, then the quality gate
node render.mjs frames all
python -I $SK/scripts/gate.py frames --look <dominant look>
-
If sets use different looks, gate each shot range separately:
--range a-b --look x. -
Every hard metric must PASS before delivery. Fix the cause, not the number:
Failing metric Fix Low sharpness or edges more texture, props and instances; less DOF Low motion add camera moves, shake, character motion Frozen stretch something must move every second Contrast or saturation out of range adjust the shot's lookgrade overridesToo bright or too dark exposureK, practical intensity, fog -
Soft warnings (shadow %, colour temperature, cuts): fix them if cheap, otherwise report them.
7. Sound: score, effects, mix
- Write
audio/cues.jsonfrom the shot table (seereference/sound.md):keyandbpm- the
twistline: the first words of the reveal sentence, as{"phrase": "…"} - one effect cue per on-screen action, on its frame
- Generate and mix:
python -I $SK/scripts/audio.py .
python -I $SK/scripts/mix.py . audio/vo.wav
- Check the mix report: music must read voice -6.0 dB, and effect peaks must be ≤70 % of the voice peak.
8. Captions and final encode
python -I $SK/scripts/captions.py web/words.json captions.ass
python -I $SK/scripts/finish.py . audio/vo.wav
- Captions are one word at a time, white heavy font with black outline, at 70 % of frame height.
- Move them with
--yif a face sits there. - Check one frame of
out/final.mp4that has a caption.
9. Deliver and log
- Send
out/final.mp4andtest/sheet.jpg. - Report the gate table, comparing the video's numbers with the reference.
- Append to
$SK/history.json:{date, slug, world, sets, looks, cast: {name: colour/pattern/hair}, models, music: {key, bpm}}.
Hard rules
- Never reuse a previous video's world, cast or palette. Always read
history.jsonfirst. - Never change the post chain order, the card alpha trick, or the measured
night_moonvalues.- Tune per shot through
lookoverrides instead.
- Tune per shot through
- Never cut a whip-pan on both sides of a cut; use the incoming side only.
- Never deliver with a hard gate failure. If it truly cannot pass, say which metric failed and why.
- Characters are original designs. Never recreate a specific existing show's characters, logos or sets.
- Downloads (assets, models) need the user's OK first.