Vibe Masterpiece — Procedural Code-Video, WebGL2 Fine-Art & Voiceprint Skill
Turn an AI coding agent into a director, technical artist, audio DSP engineer, and voiceprint supervisor that produces cinema-grade 1080p / 2K deterministic videos (window.render(t)) without AI-video temporal warping or raster slop.
1. Style Router — Pick the Right Paradigm First
Before writing any code, select one unified visual paradigm and one locked palette for the entire film. Read 01_style_matrix_and_recipes.md for exact hex palettes, matTex channel tables, and composition rules:
| Style ID | Archetype | Aspect & Spec | Engine | Signature Visual & Technical DNA |
|---|---|---|---|---|
napoleon | Imperial Obsidian & Gold Rim (拿破仑风) | 9:16 (1080×1920 @ 30fps) | Canvas2D Dual-Buffer | Obsidian silhouettes (fillAndRim), headVeil backlight separation, lon/lat ink-wash conquest maps with 0.0b ballistic war-pieces, bowed-head push-in awakening, $C^\infty$ sabre slash transitions. |
wellington | Cold-Iron & Scarlet Engraving (威灵顿风) | 9:16 (1080×1920 @ 30fps) | Canvas2D + Kinematics | Analytical 2-bone equine IK (solveIK2D + Muybridge gallop/rear), concentric 12-spoke artillery recoil & parabolic shrapnel, triptych split panels, 3D hollow infantry squares, recurring physical anchor prop. |
saladin | Samarkand Illuminated Watercolor (萨拉丁风) | 16:9 2K (2560×1440, 1.5× SSAA) | WebGL2 Dual-Texture | Cold-press rag-paper heightfield (wetness > 0.58 organic bleed vs wetness <= 0.35 micro-chiseled dry gouache), 12-tap dual-ring velvet glow, 24K hammered Damascus gold-leaf (Tazhib), Shamsa star transitions. |
bismarck | Prussian Oil-Gouache & 24K Foil (俾斯麦风) | 9:16 2K (1440×2560, 1.5× SSAA) | WebGL2 Dual-Texture | Sculpted oil-gouache portraits, burnished Solingen steel & 24K gold-leaf glyphs, Krupp cannon supersonic shockwave refraction wipe + sabre wipe, museum oil-painting vs procedural side-by-side tribute, strict 315px bottom safe zone. |
caocao | Han Lacquer, Hemp-Paper & Embodied POV (曹操第一人称连载风) | 9:16 2K (1440×2560, 1.5× SSAA) | WebGL2 + Voiceprint Drama | 6-color Han mineral lacquer palette (zero blue-purple AI slop), 70% anatomical 1st-person POV hands (palm -> prop -> thumb occlusion) + 30% 3rd-person chiaroscuro (zero laser eyes), blink / sabre / ink semantic transitions, dual-role monologue/dialogue seals & bamboo choice UI. |
han_wendi | Oriental Cinnabar & Bamboo-Slip Chronicle (汉文帝风) | 9:16 (1080×1920 @ 30fps) | Canvas2D + Stroke FX | Swinging 12-string 旒 crown beads, stroke-by-stroke brush calligraphy, shattering archaic penalty glyphs, slide-in primary-source bamboo slips, period-vessel data visualization (grain discs, coin strings, terracotta granaries). |
minimal | Minimalist Dark Knowledge & Data Curve (极简几何知识流) | 16:9 (1920×1080 @ 30fps) | Canvas2D / SVG | Near-black vignette (82–94% dark), single amber/cyan accent, 4-layer information density (conclusion headline + procedural geometry/particles + axis/counter callouts + bottom caption; active pixel ratio >= 3.5%). |
2. Quick CLI Reference
All tools live under scripts/ and work out of the box with node (Playwright) + python3 (numpy, scipy, Pillow) + ffmpeg:
SKILL_DIR="/path/to/vibe-masterpiece-skill"
# 1. Scaffold a new project with pre-wired Canvas2D or WebGL2 engine
bash "$SKILL_DIR/scripts/new_project.sh" my_project "项目标题" --style bismarck
# 2. Extract 0.005-BPM beat grid, DROP/VACUUM bars, and 60Hz audio_env.js
python3 "$SKILL_DIR/scripts/audio/analyze_bgm.py" path/to/bgm.mp3 --project-dir my_project
# 3. Sculpt in-place low-point drumless muffle (ZERO section cutting!) or find loop bars
python3 "$SKILL_DIR/scripts/audio/sculpt_audio.py" hpss-pause \
--input my_project/music/full_backup.wav --output my_project/music/full.wav \
--t-low 79.51 --t-deep 81.55 --t-pickup 83.22 --t-drop 83.59
python3 "$SKILL_DIR/scripts/audio/sculpt_audio.py" correlate-bars \
--input my_project/music/full.wav --bpm 117.725 --phase 0.002
# 4. Instant keyframe visual QA (3-5s; supports headless WebGL2 via SwiftShader)
cd my_project/video
node "$SKILL_DIR/scripts/render/render_par.mjs" index.html check/preview --preview 0.5,4.8,12.2,24.5
# 5. Parallel master MP4 render + 1.5x Lanczos BT.709 downsample + 30-tile sheet + QA gate
node "$SKILL_DIR/scripts/render/render_par.mjs" index.html out/final.mp4 \
--duration 150.0 --audio music/full.wav --workers 8 --sheet check/final_sheet.png
For multi-act POV dialogue dramas (caocao paradigm), use the generalized voiceprint toolkit in scripts/voiceprint/:
purify_voice_corpus.py: 192-dCAMPPlusspeaker cosine filter +pyin$f_0$ check + zero 3-gram overlap stem pairing.train_qwen3_dual_lora.py:<6.5 GBVRAM Dual-Loss (talker+code_predictor) Hybrid LoRA SFT forQwen3-TTS-12Hz-1.7B-Base.npc_voiceprint_sts_pipeline.py: Cross-act NPC voiceprint lock +Qwen3-VoiceDesign -> Seed-VC STSextreme acting transfer +faster-whisperrecall gate.
3. Standard 6-Stage Production Pipeline
Stage 1: Fact Verification & Acoustic Beat Mapping
- Verify every date, troop count, institutional number, and primary-source quote (zero fabricated quotes).
- Run
analyze_bgm.pyon the BGM; inspectmusic/beatmap.jsonandresearch/audio_overview.pngforDROPdownbeats,VACUUMcliffhangers, andactive_sub_beats(3.5beighth-note pickups). - If the dramatic arc needs longer breathing room, run
sculpt_audio.py correlate-barsto extend at zero-crossings (similarity >= 0.98), then re-runanalyze_bgm.py.
Stage 2: Beat-Locked PLAN.md & Anchor Object Design
- Draft
PLAN.mdbefore coding scenes:- Cold Open (
0s .. FirstDrop): Concrete visual/sensory hook in the first 2 seconds (前2秒强钩子), building intoFirstDrop. - Act I–II: Rise, institutional pillars (progressive bar-by-bar sub-beats, never static holds
>6s), borderless cartographic conquests (0.0bbar-downbeat slams), and multi-angle battlefields (never boxed insidestrokeRectspreadsheet frames). - Act III (
Low-Point -> Climax): In-place HPSS muffled push-in or POV choice vacuum -> pickup spark -> explosive drop return. - Finale: Recurring physical anchor object payoff (e.g., King's Shilling -> Waterloo Silver Medal) + dialectical legacy + solemn memorial.
- Cold Open (
Stage 3: 20–28s Style Sample (sample_v1.mp4) Gate
- For a new protagonist or style, render a 20–28s sample spanning
FirstDropfirst, inspect keyframes viaread_file, and align aesthetics with the user before scaling to 2–4 minutes. - For voiced multi-act dramas, export 3 short MP3 audition clips (
01_opening_drop,02_npc_climax_ducking,03_outro_swell) and ear-audit viaread_filebefore any 2K video render.
Stage 4: Modular Procedural Engineering
- Keep each
.jsmodule<700lines (figures.js,map_warfare.js,scenes_act1.js, etc.). - Read the exact reference manual for your chosen tech stack:
- Canvas2D / Kinematics / Anatomy: 02_canvas2d_laws_and_kinematics.md
- WebGL2 Dual-Texture Shaders (
artTex + matTex): 03_webgl2_dual_texture_shaders.md - Beat Sync, HPSS & 3-Track Drama Mixing: 04_audio_beat_and_hpss_sculpting.md
- Voiceprint SFT, NPC Lock & Extreme Acting STS: 05_voiceprint_lock_and_acting_sts.md
Stage 5: Mandatory Dual-Frame --preview Gate
Before full rendering, run --preview and visually inspect PNGs with read_file:
- Protagonist & Garments: Consistent crown/cockade insignia across all acts;
headVeilseparating head from bright skies; Chinese historical robes strictly交领右衽(y-collar, left lapel overlapping right). - Directional Physics (
hitT - 0.08s&hitT + 0.02s): Canvas2D+Ypoints down! Sample both pre-impact and impact frames on every strike, throw, falling shutter, or war-piece jump to confirm motion direction and zero label overlap. - Safe Zone: On
9:16vertical videos, keepy = 1605 .. 1920(315pxbottom zone) 100% clear of subtitles/stamps so platform UI never covers captions.
Stage 6: Parallel Master Render & Delivery QA
- Run
render_par.mjswith--sheet check/final_sheet.png(runsqa_video.pyautomatically). - Inspect
check/final_sheet.pngviaread_file, verify zero low-density accidental blackouts, and generateUPLOAD.mdwith platform titles and a<300-character primary-source citation note.
4. Non-Negotiable Determinism & Anti-Slop Laws
- Pure Function of Time
t: Exposewindow.render(t)(seconds) and setwindow.__ready = trueafterdocument.fonts.ready. Strictly zeroMath.random()(userng(seed)),requestAnimationFrame,setTimeout,Date.now(), or CSS transitions. - WebGL2 Buffer Preservation: Always create WebGL2 contexts with
preserveDrawingBuffer: trueand finish frames withgl.flush(); gl.finish();so headless multi-worker screenshots never capture blank buffers. - Sharpness Separation in WebGL2: Foreground characters, faces, eyes, hands, horses, and armor MUST write
wetness <= 0.35inmatTex.r(pin-sharp dry gouache micro-chisel); reservewetness = 0.60..0.95strictly for skies, mist, water, and ink washes. - Zero Blue-Purple AI Slop: Never default to
225°–300°neon blue-purple gradients or mixed raster clipart. Lock one historical mineral/oil/engraving palette from frame0to the final frame.