multiplane
OpenToonz-math parallax background builder with seamless FX loops and Lottie/runtime export.
Parallax background compiler that builds multi-depth vector scenes using OpenToonz perspective math, embeds seamless ambient FX loops, verifies coverage and motion, and exports both Lottie and native SwiftUI/Compose runtime JSON.
git clone https://github.com/BestRoiMedia/anim-toolkit.gitWhy we built it
Multi-layer parallax rooms easily suffer from edge gaps during camera pans, planes crossing behind the camera lens, or visibly repetitive FX loops. We built multiplane to validate depth math, enforce art coverage margins, and output both a single preview/playback Lottie and a lightweight runtime JSON for native mobile engines.
Architecture & how it works
Given a layer spec JSON, multiplane computes OpenToonz's TStageObject::perspective factor p = 1000 / (1000 + cam.z - Z) for each plane, supporting NoScaleZ sizing and cover: full|x edge checks. It composites vector or PNG planes with seamless periodic FX loops from toonz_engine/fx (candle, rain, fog, embers, dust), runs onion.py and raster verification gates (BEHIND_CAMERA, COVERAGE, FX_SEAM, FX_POP, FX_LOOP, LAYER_MOTION, LOTTIE_MISMATCH, REPEAT, SIZE), and emits a scene Lottie plus <name>.runtime.json with exact safe camera bounds.
Key capabilities
- OpenToonz-accurate perspective depth math and NoScaleZ plane scaling
- Automated edge-coverage validation (COVERAGE) that reports exact missing pixel margins
- Seamless periodic ambient FX precomps with prime/LCM loop alignment checks
- Keyed blob-particle export (~6x smaller Lottie payloads) alongside frame-based FX
- Dual export: full <name>.lottie.json and native SwiftUI/Compose <name>.runtime.json
Usage example
python3 anim/multiplane/multiplane.py doctor
python3 anim/multiplane/multiplane.py validate ./scene_spec.json
python3 anim/multiplane/multiplane.py build ./scene_spec.json --out ./out/room
python3 anim/multiplane/multiplane.py k --z -300 --cam-z -60