The .l2d format
Bundle
An .l2d file is a standard ZIP archive. Format identifier: layer2d/v1. JSON members are deflated; textures are stored uncompressed so the runtime can read them directly.
layer2d.json open manifestpack.json meshes, keyforms, physics, expressionstex/<id>.webp layer textures, eye masks, expression piecespreview.png optional portrait, 1200 × 1600 RGBASHA256SUMS.json digest for every other member
Required: layer2d.json, pack.json, SHA256SUMS.json, and every texture referenced by pack.json. Absolute paths, .. segments and duplicate entries are rejected.
Manifest
layer2d.json describes the avatar without parsing the runtime pack.
{ "format": "layer2d/v1", "id": "demo", "name": "Layer2D Demo", "version": "1.0.0", "license": "MIT", "entry": "pack.json", "texExt": "webp", "canvas": [1200, 2000], "stats": { "layers": 19, "expressions": 5, "chains": 2 }, "capabilities": { "obsAlpha": true, "springChains": true }, "preview": "preview.png"}
| Field | Type | Meaning |
|---|---|---|
format | string | Always layer2d/v1. Readers reject other values. |
id | string | Lowercase slug, unique per avatar. |
name | string | Display name. |
version | string | Avatar release version (semver). |
license | string | License identifier or summary for the artwork and rig. |
entry | string | Runtime pack path, normally pack.json. |
texExt | string | Primary layer texture extension: webp or png. |
canvas | [w, h] | Source canvas size in pixels. All mesh coordinates use this space. |
stats | object | layers, chains, samples, expressions, holds, outfits, exprPieces, vowels. Must match pack.json. |
capabilities | object | headYawSamples, headPitch2D, springChains, tailRig, obsAlpha, micLipSync, webcamTracking. |
preview | string | Optional portrait path. |
Runtime pack
pack.json holds everything the player draws and animates. Each entry in layers references tex/<id>.<texExt>; optional per-layer variants add companion textures.
| Key | Contents |
|---|---|
layers | Ordered draw list: mesh, depth, warp grid, toggles. Variants: _sheer, _hole, _up, _palm, _posed, _wipe, _open. |
samples | Head-yaw keyforms by angle. |
chains | Spring chains for hair locks, ears, tail, ribbons and tassels. |
expr | faces, pieces, holds, vowels and blink data. |
outfits | Named layer toggle sets. |
hairStyles | Alternate hair layer sets. |
Depth & physics
Hair is split into stacked strata — back, back sides, scalp cap, bangs, sides — each with a signed depth. Back hair carries negative depth, so head turns produce true parallax instead of crossfades. Hair opacity never fades during a turn.
Spring chains are multi-joint and solved per frame in the runtime, independent of frame rate.
Integrity
SHA256SUMS.json maps every member except itself to its SHA-256 hex digest. A valid bundle has an exact key match, matching digests, all referenced textures present, and manifest stats equal to the pack.
$ python -m rigkit.format validate demo.l2d
License
The layer2d/v1 specification is open and royalty-free. Anyone may read, write and ship .l2d files without fees. Each avatar declares its own artwork license in the manifest.