Naked-eye 3D pop-out video (popout-3d)
A white 3:4 canvas, a photo window in the middle, and a subject that reaches out of the window toward the viewer. On a white feed the margins disappear into the page, so the subject seems to leave the picture.
Deliverables: output/video_3s.mp4 (1080x1440, 30 fps), output/cover.png (its last frame), and 文案.md (title options, post text, tags). Turning the video into a live photo happens on the phone, in a separate app or mini tool; this skill does not do it.
Reply in the user's language.
Workflow
0. Environment preflight
Paths below are written relative to this skill folder (<skill>); run them as python <skill>/scripts/... from anywhere. <workdir> is a new folder you create outside the skill folder for this job (absolute path), with a layers/ subfolder; scripts write their results to <workdir>/output/. Create it first.
python <skill>/scripts/check_env.py
If the status is not OK, run the printed commands (or use a virtual environment) before anything else.
1. Look at the input and propose a default plan
Inspect any picture the user gave. Then send one short confirmation block (skip it when the user already decided or asked you to choose):
- Subject and the thrust: what comes out of the window, toward the viewer (a paw, a hand offering a flower, the bow of a boat, a bundle of noodles). Motion toward the camera reads as 3D; motion sideways or upward reads much weaker.
- Art style and background place.
- What they will get: a 3-second video and cover; turning it into a live photo happens on their phone. Say this now, especially when they ask for a "实况图".
- Route (below) and the motion presets you plan to use.
| Route | When | What you do |
|---|---|---|
| A. Generate | this harness has an image-generation tool | generate subject and background |
| B. Hand off | no image tool | give copy-ready prompts and exact file paths from references/prompt-templates.md, then stop and wait |
| C. User artwork | user supplies a subject on transparency or a flat colour | keep their pixels; matte locally; background from them or generated |
Never degrade silently. If you cannot generate images, say so and switch to route B. A single photo with a busy background cannot pop out: ask for a subject cut-out or a flat-colour version, or offer to generate one.
2. Get the layers into <workdir>/layers/
Read references/prompt-templates.md first. Essentials:
- Draw a composition diagram and attach it to the subject prompt as a reference:
python <skill>/scripts/guide.py <workdir>/guide.png(add--mirrorto thrust at the lower right, and swap left/right in the prompt). - The subject must be complete: nothing cut off at the left or right edge. The thrusting part is large and close to the camera, the body recedes, the corners stay empty.
- Save the generated subject as
layers/subject_raw.<png|jpg|webp>and always runpython <skill>/scripts/matte.py <workdir>/layers/subject_raw.png <workdir>/layers/subject.png: it copies real transparency through unchanged, keys a flat chroma backdrop, and fails loudly on anything else. - Ask for a real transparent background. Trust what
matte.pyprints, not an image viewer (transparent pixels can hold colour that looks like a black backdrop or glow); fringes are checked oncutout_check.jpgafter the still. Some tools paint a fake checkerboard. If it is opaque, regenerate on a chroma colour picked by contrast: green by default, magenta if the subject has green, blue if it has both green and pink/magenta. When a yellow or orange subject was shot on blue, add--warm. - Background: no subject in it, with perspective depth, landscape or square, saved as
layers/background.<png|jpg>. It should read a step darker and cooler than the subject; for a warm theme (autumn, lanterns) darken the warm colours and let shadows go blue-grey. - Request layers separately; chat image tools often stop producing images after 3–4 in one conversation.
3. Check and repair the layers
- Cut off at the sides? Widen instead of regenerating the whole picture:
python <skill>/scripts/widen.py prepare→ ask the image tool to paint only the empty sides → runmatte.pyon the result →python <skill>/scripts/widen.py merge. The centre keeps the original pixels. Inspect both seams. - Hair or leaves with colour spill on a green screen:
matte.py ... --no-key-colour(only if the subject has no green at all). - Look at the thrusting part at full size (finger count, paw pads, claws, joints). If it is wrong, say so and regenerate before laying out.
4. Lay out, then get approval of the still
Write <workdir>/scene.json (schema in references/scene-schema.md; copy the closest example, see the table there), following references/layout-rules.md. Then:
python <skill>/scripts/run_pipeline.py --scene <workdir>/scene.json --stage still
The still is the last frame of the video, so particle effects (petals, rain, …) belong in scene.json already at this step. Look at output/still.png and output/cutout_check.jpg, fix every LINT WARNING you agree with, and show the still to the user. Do not render video until they accept it. Adjust only layout once they like the artwork; do not regenerate pictures they have approved.
5. Animate
Add motions per references/motion-presets.md. To pick regions, draw a grid over a layer and read coordinates in that layer's own pixels:
python <skill>/scripts/grid.py <workdir>/layers/subject.png <workdir>/grid.jpg
After the burst (settled_after, 1.8 s) only the parts that should move may move: faces, bodies, held objects, buildings and animal heads stay still (during the burst the whole subject may travel). List those under static_regions so the check can measure them.
python <skill>/scripts/run_pipeline.py --scene <workdir>/scene.json --stage render
python <skill>/scripts/run_pipeline.py --scene <workdir>/scene.json --stage verify
Then look at keyframes.jpg (clipping, stray outlines), edge_check.jpg (seams at the window edges during the burst) and motion_check.jpg (red = still moving after the burst; blue boxes = regions that must not). Clean means red only where you intended it (breathing, swaying parts, falling effects); verify fails a static region when more than 3% of its pixels change noticeably. Fix and re-render until clean. Report technical results and what you checked by eye separately, and say what you did not check.
6. Copy and hand-off
Write <workdir>/output/文案.md using references/copywriting.md. Deliver the video, cover and copy, then tell the user how to post: send the video to the phone, convert it to a live photo with a video-to-live app or mini tool (choose the last frame as the cover), set the note to private for a first look, and publish it themselves.
Files
scripts/:check_env.py,guide.py,matte.py,widen.py,grid.py,run_pipeline.py,engine.py,effects.py,fetch_examples.py.references/:prompt-templates.md,layout-rules.md,scene-schema.md,motion-presets.md,copywriting.md.examples/<name>/scene.json: five tuned scenes (cat,claude,town,whale,noodle). Their pictures live in the GitHub repository; iflayers/is missing, runpython <skill>/scripts/fetch_examples.py(optional — only needed to render the examples themselves).