Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

docs: the Breathe layer's two modes and how to choose, `sprite-gen breathe`, and the Sway layer under its new verbs; CHANGELOG `## Unreleased`

Soohong Kim48717a103f5a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e6346c5..f9cb656 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,70 @@
All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.
+## Unreleased
+
+**Upgrading from 2.45.3: Nothing that ran before gives other bytes.**
+Breathe without `mode` (or `mode: "pixel"`) is the same warp, the same bytes, and the same normalized sidecar.
+Its default did not change.
+`video-follow` and `video-follow-inspect` still run under those names and give the same files.
+Their records and file names on disk did not change.
+The record is still written under `follow`.
+The strip as cut is still `follow.source.png`.
+The inspection still writes `follow-inspect.*`.
+A tool that reads those names keeps working.
+Moving the written names to `sway` is a later change made together with the tools that read them.
+
+- **New: The Breathe layer adds `mode: "smooth"` for large illustrations and video frames.**
+ Set per row: `states.<state>.breathe = {"mode": "smooth", "depth": ..., "breaths": ...}`.
+ `pixel` stays the default.
+ The head and everything above the measured neck line stays in place, byte for byte, in every cell.
+ The figure's bottom stays put.
+ It reuses the automatic anatomy: rigid row, body axis, torso half width, and basis rows.
+ It also uses the neck's width, measured once on the row's first cell.
+ The whole row uses that placement.
+ The chest breathes from its centre.
+ It uses a round (cos^2) weight on the body axis at `chest_y` of the body below the neck.
+ The weight is `chest_rx` x torso half width wide, and `chest_ry` x the body below the neck tall.
+ The chest centre rises by `depth` x basis rows at the in-breath and puffs out by `depth_x`.
+ Two shoulder weights, on either side just below the neck, rise by `shoulder` x the chest's rise.
+ They rise `shoulder_lag` of a breath later.
+ The neck and the collar beside it hold still.
+ Whole rows do not move.
+ For a turned body: `chest_tilt` (degrees, clockwise on screen), `chest_bias` (-0.9 to 0.9, negative = the screen's left breathes more), and `chest_dir` (degrees from straight up, negative = up-left).
+ These default to 0; at 0, nothing changes.
+ One breath is a bump from rest (in-breath 40 %, out 60 %).
+ A cell at phase 0 is the source byte for byte.
+ Seams and joins between loops are untouched.
+ `breaths` is a whole number.
+ Refused, never silently clamped: `lag` on smooth (it would move the first cell), a stretch past the per-row strain cap (0.25) or a fold, opaque pixels pushed off the canvas, out-of-range values, and shape keys on a pixel row.
+ With the default shape nothing leaves the canvas.
+ A figure cut by the frame at its sides or bottom is not refused.
+ Defaults: `depth` 0.0085 (about 0.5 % of the frame height on a bust illustration), `depth_x` 0.028, `chest_y` 0.31, `chest_rx` 0.83, `chest_ry` 0.28, `shoulder` 0.5, `shoulder_lag` 0.08, and `chest_tilt`, `chest_bias`, and `chest_dir` 0.
+ Performance is about 0.2 s per 960 px frame.
+- **New: `sprite-gen breathe <frames> <out>` lays the Breathe layer over a folder of loop frames outside curation.**
+ This lays the Breathe layer (either mode) over a folder of loop frames that is not a curation run, such as a video loop's cells.
+ It takes the sidecar's values through the same checks and the same bake: `--mode`, `--depth`, `--depth-x`, `--breaths`, `--lag`, and `--rigid-row`.
+ It also takes the smooth shape flags: `--chest-y`, `--chest-rx`, `--chest-ry`, `--shoulder`, `--shoulder-lag`, `--chest-tilt`, `--chest-bias`, and `--chest-dir`.
+ The same values give the same bytes as a curation bake.
+ It writes the frames under their names and `breathe.json` (config, phases, the anatomy used) into a new folder all at once.
+ It refuses the source folder or a folder that is not empty.
+- **Output change: The curation webview does not preview a smooth row.**
+ The live preview mirrors the pixel warp only.
+ It shows the original frame with a notice.
+ Its row video export refuses.
+ Saving keeps a smooth sidecar exactly as written instead of filling pixel defaults.
+- **New: The follow-through is now the Sway layer, replacing `video-follow` with `video-sway`.**
+ `video-sway` and `video-sway-inspect` replace `video-follow` and `video-follow-inspect`.
+ Their Python modules are `sprite_gen.video.sway`, `sway_loop`, `sway_offsets`, and `sprite_gen.video.sway_inspect`.
+ `video-follow` and `video-follow-inspect` remain as aliases with the same results and their own name in messages.
+ A loop's record is read under `sway` or `follow`.
+ Behaviour is unchanged.
+- **New: `Anatomy` gains `origin` and `neck_span` values.**
+ It does not put these two values in the sidecar or the manifest.
+ `origin` records where the measured frame's figure sits.
+ `neck_span` records the neck's span on the rigid row.
+ Pixel Breathe does not use them.
+
## v2.45.3 - The seam check reads the frames that play when the body anchor spreads a sideways slide; such a cut passes again, as it did in 2.44.0
**Upgrading from 2.45.2: Every cut 2.45.2 passed, and every `--anchor motion-auto` run, gives the same bytes as 2.45.2.** Only `--anchor body` cuts that 2.45.2 refused because of the walk sliding sideways before the anchor can now pass, read on the frames that play. Refused cuts print the same error line as before, the report's `producer` field names the new version, and there are no restoration schema changes.
diff --git a/SKILL.md b/SKILL.md
index 7d86996..cbf2956 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -116,8 +116,8 @@ hold the arms still, and check the loop with `handed-check --state walk`.
| Continue or edit an existing clip | `video-extend`, `video-edit` | [video](docs/video.md) |
| A clip run left unfinished (its line or report names a `request_id`): ask for it again, never submit it again | `video-resume --request-id <id>` | [video](docs/video.md#sprite-gen-video-resume--ask-again-for-an-unfinished-generation) |
| Grok video sprites | `video-set` | [video-pipeline](docs/video-pipeline.md) |
-| A soft part of a walk loop follows the body (a chest, a belly): an ellipse in the first cell, after `video-cycle-align` — `--read-on <sha256>` where it was read on the cut the loop was aligned from; `--stretch-floor D` to keep a least area | `video-follow` | [video-pipeline](docs/video-pipeline.md#6-follow-through--video-follow) |
-| Where that ellipse is carried in every other cell, and what the move changes there (an arm crossing a chest moves with it; the stretch, the bend and the seam): a record and boards of every cell, nothing moved | `video-follow-inspect` | [video-pipeline](docs/video-pipeline.md#inspecting-a-follow-through--video-follow-inspect) |
+| A soft part of a walk loop sways with the body (the Sway layer; a chest, a belly): an ellipse in the first cell, after `video-cycle-align`, `--read-on <sha256>` where it was read on the cut the loop was aligned from; `--stretch-floor D` to keep a least area | `video-sway` (old name `video-follow`) | [video-pipeline](docs/video-pipeline.md#6-the-sway-layer--video-sway) |
+| Where that ellipse is carried in every other cell, and what the move changes there (an arm crossing a chest moves with it; the stretch, the bend and the seam): a record and boards of every cell, nothing moved | `video-sway-inspect` (old name `video-follow-inspect`) | [video-pipeline](docs/video-pipeline.md#inspecting-a-sway--video-sway-inspect) |
| A set's directions on one sheet, standing on one ground line (a 3×3 board, an engine import): rows in compass order S SW W NW N NE E SE from each loop's `--view`, one cell size, every row as cut, an optional centre picture (`--center`) at the rows' standing height; loops of different lengths are laid and said to differ (`same_length` false) — align the set first | `video-set-sheet` | [video-pipeline](docs/video-pipeline.md#7-one-sheet-for-a-set--video-set-sheet) |
| A walk or run that stops, from the clip's own start played backwards: a one-shot strip (`loop: false`, `hold_last: true`), GIF, WebP and report beside the loop, ending on the still as filmed; leaves the loop from the cell nearest the entry (`from_cell`), drift taken out across the frames by a straight share; a seam past 1.4 steps (`--seam-max`), a run-up that comes back to a pose it left (another motion, however short) or one over 1.5 cycles (`--run-up-max`) refused; ghost screen checked, cells placed and anchored to match the loop's pivot | `video-stop` | [video-pipeline](docs/video-pipeline.md#8-a-walk-or-run-that-stops--video-stop) |
| Compare the currently displayed loop with a final candidate, including after follow-through | `video-loop-compare` | [loop-comparison](docs/loop-comparison.md) |
@@ -132,7 +132,7 @@ hold the arms still, and check the loop with `handed-check --state walk`.
| Uniform background removal or imported sheets | `cutout`, `slice-sheet` | [sheet-slicing](docs/sheet-slicing.md) |
| Palette swap | `sprite-gen recolor-palette`, `sprite-gen recolor` | [recolor](docs/recolor.md) |
| Rig layer composition | `sprite-gen compose-layers` | [layer-tracks](docs/layer-tracks.md) |
-| Idle breathing | curation choice, baked by compose | [breathing](docs/breathing.md) |
+| Idle breathing as a post-processing layer (the Breathe layer): pixel (default, pixel art) or smooth (large illustrations, video frames: head fixed, chest breathes, shoulders follow; facing values for a turned body) | curation sidecar, baked by compose; or `sprite-gen breathe <frames> <out>` on a folder of loop frames | [breathing](docs/breathing.md) |
| Engine exports | `export-aseprite`, `export-pngs` | [engine-export](docs/engine-export.md) |
| Background recipe or repeating tile | existing `gen` / `cutout`, then optional `background-tile` | [asset-tools](docs/asset-tools.md#background-recipe) |
| Ground tile that repeats both ways | `gen` (opaque), then `background-tile --axis xy` | [asset-tools](docs/asset-tools.md#both-axes-a-ground-tile) |
diff --git a/docs/README.md b/docs/README.md
index b7cb32d..b8a576c 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -16,7 +16,7 @@ flowchart LR
direction LR
b1[video-canvas] --> b2[video] --> b3[video-frames] --> b4[video-loop]
b5[video-set] -.runs all four.-> b1
- b4 --> b6[video-cycle-align] --> b7[video-follow]
+ b4 --> b6[video-cycle-align] --> b7[video-sway]
b6 --> b8[video-set-sheet]
b7 --> b8
end
@@ -40,7 +40,7 @@ flowchart LR
| Pipeline / tool group / workflow | Entry doc | Verbs |
|---|---|---|
| **A · atlas rows** — one still becomes a runtime sprite sheet | [run-contract.md](run-contract.md) | `prepare` → `gen` / `gen-set` → `extract` → `compose-atlas`; optional `curation` and recompose |
-| **B · video → loop** — one still becomes transparent motion loops | [video-pipeline.md](video-pipeline.md) | `video-canvas` → `video` (or `video-prompt` and a video MCP on your agent) → `video-frames` → `video-loop`, `video-set`, `video-cycle-align`, `video-follow` (`video-follow-inspect` shows every cell of it and moves nothing), `video-set-sheet` (a set's directions on one sheet, on one ground line), `video-stop` (a walk or run that stops, from the clip's own start played backwards); `handed-check` for an item on one side |
+| **B · video → loop** — one still becomes transparent motion loops | [video-pipeline.md](video-pipeline.md) | `video-canvas` → `video` (or `video-prompt` and a video MCP on your agent) → `video-frames` → `video-loop`, `video-set`, `video-cycle-align`, `video-sway`, the Sway layer (`video-sway-inspect` shows every cell of it and moves nothing; old names `video-follow`, `video-follow-inspect`), `video-set-sheet` (a set's directions on one sheet, on one ground line), `video-stop` (a walk or run that stops, from the clip's own start played backwards); `handed-check` for an item on one side |
| **C · utilities** — imported images in, clean cuts out | [sheet-slicing.md](sheet-slicing.md) | `cutout`, `slice-sheet`, `ui-kit`, `unpack-atlas` |
| **D · post-processing** — finished sheets, refined | [recolor.md](recolor.md) | `recolor`, `recolor-palette`, `compose-layers`, breathing (compose, or `breathe` on a folder of frames), `export-pngs`, `export-aseprite` |
| **E · asset tools** — independent background, shadow and motion tools | [asset-tools.md](asset-tools.md) | `background-tile`, `shadow`, `inspect-motion` |
diff --git a/docs/breathing.md b/docs/breathing.md
index 5cf1a7c..5203201 100644
--- a/docs/breathing.md
+++ b/docs/breathing.md
@@ -1,7 +1,67 @@
-# 호흡(idle breathing) · 정지 자세 행 — 후처리 레이어 계약
+# Breathe 레이어: 호흡(idle breathing) · 정지 자세 행 — 스프젠 후처리 레이어 계약
> Owns: The idle-breathing post-process layer and the static-pose row recipe · Index: [docs/README.md](README.md)
+## 두 모드 — pixel 과 smooth
+
+Breathe 레이어는 큐레이션 사이드카의 행마다 `states.<state>.breathe`로 설정하는 후처리 레이어다. `mode` 값으로 `pixel`과 `smooth`를 지원한다.
+
+모드 선택 기준은 다음과 같다.
+- `pixel`: 기본값이다 (`mode` 키를 생략하거나 `"pixel"`로 지정). 픽셀 아트를 위한 모드로, 정수 행과 열 단위의 워프를 사용해 픽셀 그리드를 온전히 유지한다. 출력 바이트와 정규화된 사이드카는 기존과 동일하며 기본 동작도 바뀌지 않았다. 작은 스프라이트와 픽셀 아트에 적합하다.
+- `smooth`: 대형 일러스트, 채색된 캐릭터, 비디오 프레임에 사용한다. 픽셀 워프를 적용했을 때 몸통과 함께 머리 전체가 들리거나, 복제된 행이 셀 사이에서 깜빡임(flicker)으로 읽히는 문제를 해결한다.
+
+smooth 모드의 고정 영역과 동작 방식은 다음과 같다.
+- 머리와 강체 경계(해부학 측정이 찾은 목 라인) 위의 모든 픽셀은 모든 셀에서 바이트 단위로 제자리를 유지한다. 인물 하단 역시 제자리에 고정된다.
+- rigid row, body axis, torso half width, basis rows로 이루어진 pixel 모드의 자동 해부학 측정에 강체 경계상의 목 너비를 추가해 사용한다. 모든 측정은 행의 첫 셀에서 한 번만 수행되며 해당 셀의 배치가 행 전체에 그대로 쓰인다. 비디오 셀 사이에서 정수리가 1픽셀 흔들려도 경계는 움직이지 않는다.
+- 가슴은 목 아래 몸통의 `chest_y` 지점, 몸통 중심축에 위치한 원형 가중치(cos^2)를 중심으로 호흡한다. 가중치 너비는 몸통 반폭의 `chest_rx`배, 높이는 목 아래 몸통 높이의 `chest_ry`배다. 들숨 시 가슴 중심은 기준 행의 `depth`배만큼 상승하고, 가슴 중심에서 바깥쪽으로 `depth_x`만큼 부풀어 오른다.
+- 목 바로 아래 중심축 양쪽에 위치한 원형 어깨 가중치 두 개는 가슴 상승량의 `shoulder`배만큼, 가슴보다 `shoulder_lag` 호흡 주기만큼 늦게 올라간다. 측정된 너비 안쪽의 목과 목과 어깨 사이의 칼라(collar)는 움직이지 않는다. 행 전체가 통째로 오르내리지 않는다.
+- 한 번의 호흡은 정지 상태에서 솟아오르는 형태다 (들숨 40%, 날숨 60%). 위상 0의 셀이 원본과 바이트 단위로 일치하므로 루프의 이음매와 루프 간 연결부가 온전히 유지된다. `breaths`는 1부터 8까지의 정수로 루프 길이에 정확히 맞춘다.
+
+몸이 한쪽으로 돌아간 경우 다음 세 키를 조절한다.
+- `chest_tilt`: 가슴 가중치를 회전한다 (도 단위, 화면 기준 시계 방향).
+- `chest_bias`: 가슴 한쪽이 더 크게 숨쉬도록 조절한다 (-0.9에서 0.9까지, 음수는 화면 왼쪽).
+- `chest_dir`: 가슴 이동 방향을 수직에서 회전한다 (도 단위, 음수는 위쪽 왼쪽 방향).
+- 왼쪽을 바라보는 몸체에는 음수 값을 사용한다. 세 키의 기본값은 모두 0이며, 0일 때는 아무 변화가 없다.
+
+사이드카 키와 기본값, 허용 범위는 다음과 같다.
+
+| 키 | 기본값 | 허용 범위 | 설명 |
+|---|---|---|---|
+| `depth` | 0.0085 | 0.005에서 0.20 | 들숨 시 가슴 중심 상승 배율 (흉상 일러스트 기준 프레임 높이의 약 0.5%) |
+| `depth_x` | 0.028 | 0에서 0.20 | 가슴 중심에서 바깥쪽으로 부풀어 오르는 폭 |
+| `chest_y` | 0.31 | 0.05에서 0.95 | 목 아래 몸통 기준 가슴 중심 세로 위치 |
+| `chest_rx` | 0.83 | 0.2에서 3.0 | 몸통 반폭 대비 가슴 가중치 가로 배율 |
+| `chest_ry` | 0.28 | 0.05에서 1.5 | 목 아래 몸통 높이 대비 가슴 가중치 세로 배율 |
+| `shoulder` | 0.5 | 0에서 1.5 | 가슴 상승량 대비 어깨 상승 배율 |
+| `shoulder_lag` | 0.08 | 0에서 0.3 | 가슴 대비 어깨 상승 지연 주기 |
+| `chest_tilt` | 0 | -60에서 60 | 가슴 가중치 회전 각도 (도 단위, 시계 방향) |
+| `chest_bias` | 0 | -0.9에서 0.9 | 한쪽 가슴 호흡 편향 (-0.9에서 0.9, 음수는 화면 왼쪽) |
+| `chest_dir` | 0 | -90에서 90 | 가슴 이동 방향 각도 (도 단위, 음수는 위쪽 왼쪽) |
+| `breaths` | - | 1에서 8 | 루프에 들어맞는 정수 호흡 횟수 |
+
+거부 조건은 다음과 같다.
+- 허용 범위를 벗어난 값은 무시되지 않고 거부된다. pixel 행에 smooth 전용 형상 키(`chest_y`, `chest_rx`, `chest_ry`, `shoulder`, `shoulder_lag`, `chest_tilt`, `chest_bias`, `chest_dir`)를 지정해도 무시되지 않고 거부된다.
+- smooth 모드에 `lag`(pixel 모드의 진행파)를 지정하면 첫 셀을 움직이게 되므로 무시되지 않고 거부된다.
+- 행별 변형 한도(0.25)를 넘는 신장, 접히는(fold) 변위장, 불투명 픽셀이 캔버스 밖으로 밀려나는 경우는 조용히 한도 내로 자르지 않고 즉시 거부한다.
+- 기본 형상에서는 가슴 가중치가 몸체 내부에서 0으로 떨어지므로, 인물이 화면 가장자리나 하단에서 잘려 있어도 거부되지 않으며 픽셀이 손실되지 않는다.
+- 처리 속도는 960 px 프레임 기준 약 0.2초다.
+
+비디오 루프 셀처럼 큐레이션 실행이 아닌 프레임 폴더를 처리할 때는 독립 명령어를 사용한다.
+
+```bash
+sprite-gen breathe <frames> <out> [--mode pixel|smooth] [--depth D] [--depth-x D] [--breaths N] [--lag L] [--rigid-row R] [--chest-y ...] [--chest-rx ...] [--chest-ry ...] [--shoulder ...] [--shoulder-lag ...] [--chest-tilt ...] [--chest-bias ...] [--chest-dir ...]
+```
+
+`<frames>`는 파일 이름 순서대로 재생되는 PNG 프레임 폴더다. 사이드카와 동일한 검증과 베이크 처리를 거치므로 같은 값이면 동일한 바이트를 출력한다. 변환된 프레임들을 원본과 동일한 이름으로 저장하고, 적용된 설정과 위상 및 해부학 측정값을 담은 `breathe.json`을 새 폴더에 한 번에 작성한다. 원본 폴더를 덮어쓰거나 비어 있지 않은 폴더를 지정하면 쓰기를 거부한다.
+
+비디오 루프 셀 처리 예시는 다음과 같다.
+
+```bash
+sprite-gen breathe frames/ out_frames/ --mode smooth --depth 0.0085 --breaths 2
+```
+
+큐레이션 웹뷰 사용 시 제한사항이 있다. 웹뷰의 실시간 미리보기는 pixel 워프만 반영하므로 smooth 행은 미리보기를 지원하지 않는다. 웹뷰에서는 안내 문구와 함께 원본 프레임을 보여주며, smooth 행의 비디오 내보내기는 거부된다. 사이드카를 저장하면 smooth 설정은 작성한 내용 그대로 보존된다. 실제 결과는 compose 명령어(GIF, atlas) 또는 `sprite-gen breathe` 명령어로 확인해야 한다.
+
## What Breathe does (from the README, 2026-09-09)
A still idle reads as frozen. **Breathe** turns a single pose into a living loop — deterministic squash & stretch baked on top of your curated frames. No regeneration, no re-extraction, no extra art. One sidecar field:
diff --git a/docs/loop-comparison.md b/docs/loop-comparison.md
index 0a00925..3a22155 100644
--- a/docs/loop-comparison.md
+++ b/docs/loop-comparison.md
@@ -1,7 +1,7 @@
# Comparing delivered loops
`video-loop-compare` reads the **final strip and metadata**, including any
-`video-follow` changes. A loop report supplies provenance; its seam score and
+`video-sway` changes. A loop report supplies provenance; its seam score and
pass status do not describe later pixels and are never used as comparison scores.
```bash
@@ -83,7 +83,7 @@ flattening colour animation is not sufficient: it returns
`interpolation-fault-remains`. These are `unknown` unless another comparable
axis already proves a regression.
-`body_motion` reuses the common-body tracker from `video-follow`.
+`body_motion` reuses the common-body tracker from `video-sway`.
`top_band_motion` is the existing silhouette-top observation, which may follow
an accessory instead of a head. Both are descriptive; reducing their motion
is not scored as improvement. Rigid scale pumping is not inferred from a
diff --git a/docs/loop-repair.md b/docs/loop-repair.md
index 5b903d2..ac93c61 100644
--- a/docs/loop-repair.md
+++ b/docs/loop-repair.md
@@ -1552,10 +1552,10 @@ sprite-gen video-cycle-align --loop-dir set/front-walk/loop --loop-dir set/side-
cannot be made leaves the set as it was. The first alignment also records the strip as cut,
before anything is rewritten (`cycle_align.origin`: its file's sha256 — `follow.source.png`'s
where a follow-through moved it —, cell size, scale, crop origin, `sample_indices`, each cell's
- pixels by sha256, and the body's motion as `video-follow` reads it there, `reading`), and every
+ pixels by sha256, and the body's motion as `video-sway` reads it there, `reading`), and every
later alignment keeps it as it is. A loop aligned before this record existed has none, and gets
none: its cut is no longer there to read. With `cells_from` it lets a follow-through whose
- regions were read on the cut be carried to the aligned loop (`video-follow --read-on`,
+ regions were read on the cut be carried to the aligned loop (`video-sway --read-on`,
docs/video-pipeline.md section 6). Neither record changes a pixel of the strip, GIF or WebP.
- **Frames between are kept for later passes** (`--between-cache DIR`): every frame RIFE makes between
two source frames is stored in `DIR`. A later alignment given the same `DIR` takes a kept frame instead
@@ -1607,9 +1607,9 @@ only an item of a walk or run filmed in two or more directions is taken, any oth
filming), or as `video-cycle-align --foot` on the set's loops. A foot given for an item that failed,
or whose state was not aligned, is named in that state's `feet_unused` and a warning.
Cutting a loop again with `video-loop` removes its `cycle.source/`, so the next alignment reads
-the new cut. An alignment also clears a follow-through (`video-follow`, which moved the old
+the new cut. An alignment also clears a follow-through (`video-sway`, which moved the old
cells): `follow.source.png` and the strip's `follow` record are removed and the loop's row says
-`follow_cleared`; run `video-follow` again after it, with `--read-on` naming the strip the regions
+`follow_cleared`; run `video-sway` again after it, with `--read-on` naming the strip the regions
were read on.
How much RIFE that is, on the 2026-10-03 sets (the experiment's `finalize.py`): resampling to
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index 5fede81..1de8eb5 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -24,8 +24,8 @@ still ──video-canvas──▶ canvas.png ──video──▶ clip.mp4 ─
| `sprite-gen video-loop` | `sprite_gen/video/loop.py` | keyed frames → `cycle/`, `<name>.strip.png` + `.strip.json`, `<name>.gif`, `<name>.webp` + report |
| `sprite-gen video-set` | `sprite_gen/video/batch.py` | bases × states → one folder per item, `set.report.json`, `table.md` |
| `sprite-gen video-cycle-align` | `sprite_gen/video/align.py` | the loop directories of one walk or run, one per direction → one cycle length, each loop turned to start on a foot strike, + report ([loop repair](loop-repair.md) section 4) |
-| `sprite-gen video-follow` | `sprite_gen/video/follow.py` | a loop directory + an ellipse → the strip, GIF and WebP with that region following the body ([section 6](#6-follow-through--video-follow)) |
-| `sprite-gen video-follow-inspect` | `sprite_gen/video/follow_inspect.py` | a loop directory + the ellipses `video-follow` takes → a record of where each is carried in every cell and what the move changes there, and two boards of every cell; the loop directory is only read ([section 6](#inspecting-a-follow-through--video-follow-inspect)) |
+| `sprite-gen video-sway` | `sprite_gen/video/sway.py` | a loop directory + an ellipse -> the strip, GIF and WebP with that region swaying with the body (old name `video-follow`) ([section 6](#6-the-sway-layer--video-sway)) |
+| `sprite-gen video-sway-inspect` | `sprite_gen/video/sway_inspect.py` | a loop directory + the ellipses `video-sway` takes -> a record of where each is carried in every cell and what the move changes there, and two boards of every cell; the loop directory is only read ([section 6](#inspecting-a-sway--video-sway-inspect)) |
| `sprite-gen video-set-sheet` | `sprite_gen/video/set_sheet.py` | the loop directories of one set, each with its `--view` → one sheet: a row per direction in compass order, one cell size, one ground line, every row as cut, + a record and an optional centre picture; the loop directories are only read ([section 7](#7-one-sheet-for-a-set--video-set-sheet)) |
| `sprite-gen video-stop` | `sprite_gen/video/stop.py` | keyed frames + a walk or run loop → one-shot stop strip (`loop: false`, `hold_last: true`), GIF, WebP, report ([section 8](#8-a-walk-or-run-that-stops--video-stop)) |
@@ -1206,14 +1206,14 @@ refuses a lifetime.
Not measured on a clip model: the sentences for a motion of your own (`PLAY_TEXT`, `RETURN_TEXT`).
The once-return template is the one an attack is filmed with (`ACTION_COMMON_TEXT`).
-## 6. Follow-through — `video-follow`
+## 6. The Sway layer — `video-sway`
-A clip model draws a walk's body moving, but a soft part hanging off it (a chest, a belly, a
-pouch on a strap) mostly moves with the body as one piece, even when the prompt asks it to
-bounce. `video-follow` puts that follow-through back on a cut loop:
+A clip model draws a walk's body moving, but a soft part hanging off it (a chest, a belly, a pouch on a strap) mostly moves with the body as one piece, even when the prompt asks it to bounce. The Sway layer puts that sway back on a cut loop: a soft part of a looping body sways with the body's own motion, moving an ellipse of the strip as a damped mass on the body's bob, after `video-cycle-align`.
+
+`video-sway` replaces `video-follow` (in Python: `sprite_gen.video.sway`, `sway_loop`, `sway_offsets`). The old names (`video-follow`, `video-follow-inspect`, `sprite_gen.video.follow`, `follow_loop`, `follow_offsets`, `sprite_gen.video.follow_inspect`) still run, produce the same files, and print their old name in messages. The loop's record of a sway is read under the key `sway` or `follow`. This release still writes it under `follow`, the strip as cut is still `follow.source.png`, and inspection still writes `follow-inspect.json`, `follow-inspect.source.png`, and `follow-inspect.moved.png` with the same keys, so tools that read those names keep working. Moving written names to `sway` is a later change made together with the tools that read them.
```bash
-sprite-gen video-follow --loop-dir set/front-walk/loop --region 136,164,60,50 [--region …] \
+sprite-gen video-sway --loop-dir set/front-walk/loop --region 136,164,60,50 [--region ...] \
[--gain 2.5] [--on-fold refuse|lower] [--freq 2.4] [--zeta 0.6] [--board follow.png] \
[--read-on <sha256>] [--stretch-floor D]
```
@@ -1290,11 +1290,11 @@ sprite-gen video-follow --loop-dir set/front-walk/loop --region 136,164,60,50 [-
record is written too, so a run that fails on the way — an animation that fails its check, a
record that does not serialise — leaves the strip, GIF, WebP and record as they were.
`cycle/` is left as cut. The strip as it was is kept as `follow.source.png`; running
- `video-follow` again reads from it, so a second run never moves a moved strip. `--board` writes the cells before and after where the part
+ `video-sway` again reads from it, so a second run never moves a moved strip. `--board` writes the cells before and after where the part
sits lowest and highest, on white.
- **Order**: after `video-cycle-align`. An alignment rebuilds the strip from the cut, removes
`follow.source.png` and the `follow` record, and says so (`follow_cleared` in its loop row); a
- new cut with `video-loop` removes them too. Run `video-follow` again after either — with
+ new cut with `video-loop` removes them too. Run `video-sway` again after either — with
`--read-on` where the regions were read on the cut (below).
- A one-shot (`kind: one-shot`) is refused: the follow-through is a loop's steady state.
@@ -1302,7 +1302,7 @@ sprite-gen video-follow --loop-dir set/front-walk/loop --region 136,164,60,50 [-
The regions are where somebody looked: in the first cell of the strip they were read on. An
alignment turns a loop to start on a foot strike, so its first cell is another; given the same
-regions, `video-follow` reads the motion again from that cell 0 and the regions land on another
+regions, `video-sway` reads the motion again from that cell 0 and the regions land on another
place of the body, and a stretched loop moves them by a motion read anew. `--read-on <sha256>`
names the strip they were read on — its file's sha256, as cut, before any follow-through (64
lowercase hexadecimal digits; anything else is refused before anything is read):
@@ -1311,7 +1311,7 @@ lowercase hexadecimal digits; anything else is refused before anything is read):
The follow-through is the one without `--read-on`, byte for byte, and the record says so.
- **`transported`**: it is the cut this loop was aligned from. `video-cycle-align` records that cut
the first time it aligns the loop (`cycle_align.origin`: its sha256, cell size, scale and crop
- origin, each cell's pixels by sha256, and the body's motion as `video-follow` reads it there),
+ origin, each cell's pixels by sha256, and the body's motion as `video-sway` reads it there),
keeps it on every later alignment, and records where each cell of the new strip is from
(`cycle_align.cells_from`: `{"source": i}`, a frame of `cycle.source/`, or `{"between": [i, j],
"t": t}`, a frame made between two). Each cell is carried by the cut's reading of the cut's cell it
@@ -1354,53 +1354,49 @@ held or refused as the cut is.
The floor holds the stretch, and only the stretch: what a move also does to a line — it tilts it,
and where two regions overlap it bends it at their seam — lowers only as the gain lowers.
-`video-follow-inspect` writes all three (below).
+`video-sway-inspect` writes all three (below).
What carries a region into a cell is the lay of the body's outline (`carry_basis: {"reading":
"outline-lay", "region": "unverified"}`). Two strips whose alpha is the same in every cell are
carried alike, whatever moved inside the outline; whose pixels are inside a carried ellipse is not
read, and nothing here moves a region on a guess of it.
-### Inspecting a follow-through — `video-follow-inspect`
+### Inspecting a sway — `video-sway-inspect`
-The ellipse is given in the first cell, where somebody looked. Into every other cell it is carried
-by the body's motion, and there nobody looked: an arm that swings across a chest is inside the
-chest's ellipse in those cells and moves with it, and so does a sleeve of the chest's own colour,
-which no count of colours finds. The engine does not read what a pixel belongs to.
-`video-follow-inspect` writes what somebody needs in order to look, and moves nothing:
+The ellipse is given in the first cell, where somebody looked. Into every other cell it is carried by the body's motion, and there nobody looked: an arm that swings across a chest is inside the chest's ellipse in those cells and moves with it, and so does a sleeve of the chest's own colour, which no count of colours finds. The Sway layer does not read what a pixel belongs to. `video-sway-inspect` (old name `video-follow-inspect`) writes what somebody needs in order to look, and moves nothing:
```bash
-sprite-gen video-follow-inspect --loop-dir set/front-run/loop --region 136,164,60,50 [--region …] \
+sprite-gen video-sway-inspect --loop-dir set/front-run/loop --region 136,164,60,50 [--region …] \
[--gain 2.5] [--on-fold refuse|lower] [--freq 2.4] [--zeta 0.6] [--read-on <sha256>] [--stretch-floor D] \
--out-dir inspect/front-run [--scale 2] [--columns 8]
```
-- **Asked as `video-follow` is, answered by the same code.** It takes `video-follow`'s arguments
+- **Asked as `video-sway` is, answered by the same code.** It takes `video-sway`'s arguments
(all but `--board`), reads the strip as cut — `follow.source.png` where a follow-through was
- already written, the strip itself where none was — and solves it where `video-follow` does
+ already written, the strip itself where none was — and solves it where `video-sway` does
(`follow.read_request`, `follow.solve`): the carry, each region's gain, the offsets and the
- moved cells are computed in one place, and both commands read them there. What `video-follow`
+ moved cells are computed in one place, and both commands read them there. What `video-sway`
refuses it refuses in the same words under its own name, and then writes nothing.
- **The loop directory is read and never written**: not the strip, not its meta, and not the
- `follow.source.png` that `video-follow` keeps on its first run. An `--out-dir` at or under the
- loop directory is refused. Run before `video-follow`, it changes nothing `video-follow` writes.
+ `follow.source.png` that `video-sway` keeps on its first run. An `--out-dir` at or under the
+ loop directory is refused. Run before `video-sway`, it changes nothing `video-sway` writes.
- **What is inside an ellipse is not read.** Every region is written `ownership: "unknown"` in
every cell, the first included, from its centre to its rim; no cell is marked or held on a
guess. `solid_px` counts the body's silhouette under the ellipse (alpha ≥ 128), not whose
pixels they are. Saying which cells hold the part alone is for a person or a model that looks
at the board of the cells as cut, and for a second reader apart from the first.
- `video-follow` takes no such list: it moves every cell.
+ `video-sway` takes no such list: it moves every cell.
- **`follow-inspect.json`** (`kind: video-follow-inspection`, `schema_version: 2`):
| key | what it holds |
|---|---|
| `input_id` | one sha256 over what the answer is read from: the schema version, the strip's sha256, the meta's `cut_sha256`, the regions, the settings, the policy and the engine's version |
| `inputs.strip` | `file`, `sha256`, `bytes`: the strip as cut that was read |
- | `inputs.meta` | `file`, `sha256`, `bytes`: `<name>.strip.json` as read; `cut_sha256`: its sha256 without the `follow` record `video-follow` adds (keys sorted, no spaces); `follow_recorded` |
+ | `inputs.meta` | `file`, `sha256`, `bytes`: `<name>.strip.json` as read; `cut_sha256`: its sha256 without the `follow` record `video-sway` adds (keys sorted, no spaces); `follow_recorded` |
| `inputs.cut` | `frames`, `w`, `h`, `delay_ms`, as read from the meta |
| `inputs.regions`, `inputs.settings` | the ellipses in the order given; `gain`, `on_fold`, `freq_hz`, `zeta`, `read_on` and `stretch_floor` (null where not asked) |
| `inputs.policy`, `inputs.engine` | the way the motion is read and a region moved, by name (`follow.POLICY`) with the constants it is fixed by, and the ways a reading is carried (`transport`) and a floor kept (`stretch_floor`), by name; the engine's `name` and `version` |
- | `follow` | the follow-through as `video-follow` records it in the strip's meta, without `gif` and `webp` |
+ | `follow` | the follow-through as `video-sway` records it in the strip's meta, without `gif` and `webp` |
| `carry_basis` | `{"reading": "outline-lay", "region": "unverified"}`: what carries a region, and that whose pixels it holds is not read |
| `regions[i]` | `index`, `ellipse` as given, `radius_px`, `gain` (0 when held), `held`, `gain_limit`; over all cells the largest `reach_px`, `fold_ratio`, `bend` and `bend_deg`, the least `jacobian_min`, the sum of `changed_px`; `ring`, its colour on the boards |
| `seams` | per pair of moving regions that meet in some cell (`regions`: [i, j]), the largest seam: `jump`, `deg`, the `cell` and the point `at` (x, y) |
@@ -1409,7 +1405,7 @@ sprite-gen video-follow-inspect --loop-dir set/front-run/loop --region 136,164,6
| `boards` | `scale`, `columns`, `size`, `ground`; `source` and `moved`, each `file`, `sha256` (the PNG file) and `pixels_sha256` (its pixels) |
- **`carry_px`** is how far the cell's body lies from the first cell's, in whole pixels: what
- every region's ellipse is carried by in that cell, and what `video-follow` carries it by. It
+ every region's ellipse is carried by in that cell, and what `video-sway` carries it by. It
was written nowhere before; from the record's rounded offsets it cannot be worked back for a
strip of more than thirteen cells (the answer keeps six harmonics of the cycle).
- **`jacobian_min`** is the least area of the source that one pixel of the moved cell takes, over
@@ -1429,7 +1425,7 @@ sprite-gen video-follow-inspect --loop-dir set/front-run/loop --region 136,164,6
number as `fold_ratio`, named for what it does: at 1 a line tilts 45°, and a region `--on-fold
lower` lowered moves just under it. A round region moving along a radius has G = 1 − D, but a
region moving along its long axis keeps D high while G stays near 1, so neither stands for the
- other. And where two regions overlap, `video-follow` moves each pixel by the larger of their
+ other. And where two regions overlap, `video-sway` moves each pixel by the larger of their
weighted moves (by the larger weight where they move by one gain), so across the curve where the
two are equal the move's gradient jumps from one region's to the other's and a straight line
bends there: `seams`, the largest jump on that curve — the norm of the difference of the two
@@ -1439,7 +1435,7 @@ sprite-gen video-follow-inspect --loop-dir set/front-run/loop --region 136,164,6
three, not from `fold.ratio`; a floor lowers the bend and the seam only as it lowers the gain.
- **The record names what it was read from.** It holds no path, no time and nothing of the
machine: the same loop asked the same way writes the same record, byte for byte, anywhere.
- `input_id` is the same before and after `video-follow` is run on the loop, and another after a
+ `input_id` is the same before and after `video-sway` is run on the loop, and another after a
new cut, an alignment, a changed region or setting (`read_on` and `stretch_floor` among them), or
another engine version — what somebody
saw on one cut's boards is not evidence for another cut. `--scale` and `--columns` change the
@@ -1452,7 +1448,7 @@ sprite-gen video-follow-inspect --loop-dir set/front-run/loop --region 136,164,6
pixels just outside the ellipse — the first the move does not touch — so inside an ellipse the
cell shows whole (but for another region's ring crossing it), and at `--scale 2` or more no
cell pixel is covered whole. `follow-inspect.source.png` has the cells as cut;
- `follow-inspect.moved.png` has them as `video-follow` would write them, laid and ringed alike.
+ `follow-inspect.moved.png` has them as `video-sway` would write them, laid and ringed alike.
They are two files so that whoever says what is inside an ellipse can be given the cells as cut
alone, without the answer beside them.