Vitryne

File format

The .vtry project file format: layout, parts, validation and migrations.

In short: a .vtry file is a zip (or a folder) holding a JSON manifest and one JSON part per thing: the project, its garments (pieces, seams, placement), fabrics, appearances, the avatar and an optional cached drape. Every state is validated by Rust and by JSON Schemas. Where to start:

Status: approved design (2026-10-13), implemented by packages/vitryne-engine/format (reading, writing, validation, migrations) and vitryne-pattern (project: a file to the engine; convert: garment.toml + DXF to a file). Version 2 (2026-10-16) adds appearances (fabric colour); a version 1 file is a valid version 2 file. Version 3 (2026-10-18) lets a fabric name its default appearance, and a fabric file carry the appearances its fabrics use; a version 2 file is a valid version 3 file.

A Vitryne file holds a garment project: pattern pieces, how they’re sewn, where they start around the body, the fabrics and their colours, the avatar and the simulation settings, plus optionally a cached drape so the file opens without simulating. This document is the specification; the JSON Schemas in format/schema/ are its machine-readable part, and assets/examples/ holds three complete projects (T-shirt, trousers, hoodie).

Each section gives the rules, then Why for the choices that weren’t obvious.

Contents: Principles · Files and kinds · Container · Conventions · Project · Garment · Fabric · Appearance · Avatar · Simulation settings · View · Simulation cache · Versions and migrations · Extensions and future features · Interop · From garment.toml · Cloud storage · In the engine · Decisions

Principles

  1. The file is the design, not a dump of the engine. It describes a garment the way a pattern maker would (pieces, notches, seams, grain, fabric properties in physical units), so it stays valid when the solver changes. Engine-specific tuning lives in one clearly fenced object.
  2. Old files always open. Every format change comes with a migration, and the reader runs them in order.
  3. Nothing is lost. A reader keeps what it doesn’t understand (unknown fields, extensions, parts) and writes it back.
  4. Readable and diffable. Structure is JSON, one entity per part, so a change to a fabric is a small diff in one file. Binary only where the data is large (meshes).
  5. Derived data is a cache. A drape can always be thrown away and recomputed.
  6. Interop is not the format. DXF-AAMA comes in and glTF/OBJ go out through converters; the format doesn’t mirror either.

Files and kinds

One container format, four kinds of file. The kind is in the manifest; the extension is only a hint for people and operating systems.

KindExtensionMedia typeHolds
project.vtryapplication/vnd.vitryne.project+zipproject.json, its garments, fabrics, appearances and avatar, optional view and caches
garment.vtrygapplication/vnd.vitryne.garment+zipone garment and the fabrics and appearances it uses (no avatar)
fabric.vtryfapplication/vnd.vitryne.fabric+zipone or more fabrics and the appearances they use (a fabric library)
avatar.vtryaapplication/vnd.vitryne.avatar+zipone avatar

Why one format for all four: one reader, one set of migrations, one extension mechanism, and copying between kinds is copying parts. A garment file is a project minus the project root and avatar. Why separate extensions anyway: distinct icons, double-click opens the right thing, and an “import fabric” dialog can offer only .vtryf. Why not .vit: Valentina/Seamly2D, open-source pattern software with the same audience, already uses .vit for measurement files.

Sizes, for scale (the T-shirt example): the garment part is 41 KB of JSON (6.6 KB deflated), a fabric 0.5 KB, the avatar mesh 482 KB. A .vtryf or .vtryg is a few KB; a project is dominated by its avatar.

Container

A file is a zip archive (PKWARE APPNOTE; Deflate or Store; ZIP64 allowed; UTF-8 names; no encryption):

mimetype                          the media type, ASCII, no newline
manifest.json                     kind, format version, list of parts
project.json                      kind project only
garments/<id>.json                one per garment
fabrics/<id>.json                 one per fabric
avatars/<id>/avatar.json          one per avatar, with its mesh:
avatars/<id>/body.glb
sources/<id>.<ext>                optional: imported originals (role source)
cache/<key>.glb                   optional: cached drapes (role cache)
view.json                         optional: camera
  • mimetype is the first entry, stored uncompressed, with no extra field, so the media type sits at byte 38 of the file and identifies it without unzipping (the EPUB and ODF trick).
  • Every other file is listed in manifest.json parts with its path and media type, and normally its sha256. Readers warn on a hash mismatch but still open the file, so hand edits work. Writers compute fresh hashes.
  • Entity parts live at fixed paths: a garment with id X is garments/X.json. References in the JSON are ids; the path follows from the id.
  • Compression: writers deflate JSON and store binaries (.glb is already compact, and stored entries can be read without inflating). vitryne-format writes fixed timestamps, so the same document always gives the same bytes.
  • Paths: relative, /-separated, no .., case-sensitive.
  • Folder form: the same layout unzipped, in a directory named like the file (tshirt.vtry/), is a valid file too. The repository keeps examples this way so their JSON is diffable; tools/format/build-examples.sh regenerates them and writes the zips.

Why a zip of parts: like .docx and .3mf, it is one file for users, and any tool can open it. Per-part JSON gives small diffs and maps directly onto cloud object storage (each part a content-addressed object, see Cloud storage). One big JSON file would carry meshes as base64 (+33%) and rewrite everything on every save. SQLite isn’t diffable or easy to inspect.

manifest.json

{
  "format": "vitryne",
  "kind": "project",
  "formatVersion": 1,
  "minReaderVersion": 1,
  "generator": "vitryne 0.1.0 (web)",
  "parts": [
    {
      "path": "project.json",
      "mediaType": "application/json",
      "sha256": "6bb97a4a…"
    },
    {
      "path": "avatars/01a1…/body.glb",
      "mediaType": "model/gltf-binary",
      "sha256": "…"
    },
    {
      "path": "cache/sha256-4f2c….glb",
      "mediaType": "model/gltf-binary",
      "role": "cache"
    }
  ],
  "extensionsUsed": [],
  "extensionsRequired": []
}

role is cache for derived data that may be deleted at any time, source for kept originals. See Versions and migrations and Extensions for the other fields.

Conventions

Units

QuantityUnit
Every length in a JSON part, 2D or 3Dmillimetre
Anglesradian
Areal densitykg/m²
Stretch and shear stiffnessN/m
Bending rigidityN·m
Frictiondimensionless
Binary parts (glTF)metre (the glTF rule), declared by their media type

The one exception is simulation.engine (see Simulation settings), which uses the engine’s own units.

Why mm everywhere in JSON: one rule to remember. Patterns are drafted and exchanged in mm and 523.5 reads better than 0.5235; the 3D numbers in JSON are few (placement, avatar regions) and gain nothing from metres. The large 3D data is binary glTF, which must be metres and is uploaded to the GPU as is. Why physical units for fabric: the same fabric must behave the same at 5k and 20k vertices and in a future solver; per-edge spring constants are an engine detail.

Coordinate systems

  • 2D (pattern): each piece has its own frame, x to the right, +y towards the top of the garment (the neck of a shirt, the waist of trousers), seen from the right (outer) side of the fabric. Outlines run counter-clockwise.
  • 3D (avatar space): right-handed, +Y up, the avatar faces +Z, the wearer’s left is +X, feet at y = 0. The same axes as glTF.

Identifiers

  • Every entity, and every point or line something can refer to, has an id: a UUID (RFC 9562), lowercase and hyphenated, unique within the file. Writers create version 7 (time-ordered); readers accept any version.
  • References are always ids, never array positions or names. Names are labels for people.
  • Copying an entity into a file that already has its id (pasting the same garment twice) gives the copy fresh ids, and updates the references inside it.

Why UUIDs: they survive edits, re-imports, copying between files and, later, merging edits from several people, with no central counter. Why version 7: time-ordered keys index well in Postgres (cloud storage). The cost: v7 reveals when an id was created. The other cost: a seam is no longer "front:3-5" but two UUIDs, so the JSON is harder to read by hand. Nodes carry names for that, and tools print them (the example’s seams are readable through the node names).

Numbers and JSON

  • JSON is UTF-8, no BOM, numbers are IEEE doubles. Writers round lengths to 0.001 mm and keep other values at full precision.
  • Writers emit camelCase names, and indent JSON (2 spaces, [x, y] pairs on one line) so that diffs are line-based. Readers don’t care about formatting.

Project

project.json, kind project only (schema):

{
  "id": "01a13cdb-cc01-7c75-b193-e1f5e9b453f4",
  "name": "T-shirt (Teagan)",
  "garments": ["01a13cdb-cc02-7918-aa9f-9eb6980dd3b8"],
  "avatar": "01a13cdb-cc04-728e-9afd-3f992133737d",
  "fabrics": ["01a13cdb-cc03-713c-9796-120438b8ba92"],
  "simulation": { "targetVertices": 10000 }
}
  • garments is in layering order, closest to the body first. The MVP drapes one garment; the order is defined now so outfits need no format change.
  • fabrics lists every fabric part, used or not: the project’s own fabric library.
  • appearances (version 2, optional) lists every appearance part the same way; absent when there are none.
  • avatar is the avatar every garment is draped on.

Garment

garments/<id>.json (schema). The entity tree:

garment ── fabric (default for its cuts), appearance? (likewise)
 ├─ pieces[]
 │   ├─ outline[]: nodes (corner | notch | point), each with the edge to the next
 │   ├─ lines[]:   internal lines, open paths of nodes
 │   ├─ folds[]:   fold lines, between two outline nodes
 │   ├─ grain
 │   └─ cuts[]:    each copy cut from fabric: mirrored?, fabric?, appearance?, placement, state?, layout
 ├─ stack[]:       every cut once, closest to the body first
 ├─ seams[]:       side a and side b, each a chain of runs (cut, from node, to node)
 ├─ simulation:    overrides of the project's settings
 ├─ sources[]:     imported originals
 └─ attribution

A garment may have no pieces yet: one started from scratch, before its first piece is drawn. It drapes nothing; an app shows the avatar alone.

Pieces and outlines

A piece is a pattern piece as drafted. Its outline is the sewing line (seam allowance zero), as a closed loop of nodes in counter-clockwise order. Each node has an id, a type, an optional name, a position, and the edge from it to the next node:

{
  "id": "01a13cdb-cc06-7bbe-9365-6ac1ac56bab7",
  "type": "corner",
  "name": "hem, left side",
  "position": [242.283, -485.3],
  "edge": { "type": "polyline", "points": [[242.307, -464.868], [242.376, -445.055], …] }
}
  • Node types: corner (the outline turns), notch (an alignment notch), point (anything else worth naming: fold ends, where an internal line meets the outline, a point added so a seam can start or end there).
  • Edges: polyline: the points strictly between the node and the next one, empty for a straight edge. cubic (extension VTRY_curves, below): one Bézier segment to the next node, its two control points in controls. The edge from a node is identified by that node’s id.
  • An edge between two nodes is the unit the rest of the format refers to. Points without ids inside an edge are geometry only.

Curved edges (VTRY_curves)

{
  "id": "…",
  "type": "point",
  "position": [0.0, 300.0],
  "edge": {
    "type": "cubic",
    "controls": [
      [55.228, 300.0],
      [100.0, 255.228]
    ]
  }
}
  • One segment per edge. A longer smooth curve is several cubic edges joined at point nodes; a point node doesn’t end a whole edge for sewing (only corners do), so a curve made of several segments is still one edge to sew.
  • Flattening is part of the format. Everything that needs the curve as points (meshing, seams, suggestions, DXF export, the editor’s drawing) uses the same polyline: n evenly spaced parameters, n = ceil(sqrt(0.75 M / 0.1 mm)) clamped to 1..256, where M = max(|p0 − 2c1 + c2|, |c1 − 2c2 + p3|) (the flatness bound for 0.1 mm), each point rounded to 0.001 mm. The reference is vitryne_format::flatten_cubic.
  • The extension is listed by content. A writer puts VTRY_curves in extensionsUsed and extensionsRequired when any edge is a cubic and leaves it out otherwise, so a file without curves is exactly what it was, and a reader that doesn’t know curves refuses a file with them rather than drawing straight edges.
  • Outlines are simple polygons. As flattened, an outline must run counter-clockwise, never cross or touch itself, and have no two consecutive nodes in the same place (0.01 mm) on a straight edge. These rules held for every file already; readers now check them.

Why Béziers, one per edge: they are what drawing tools make and what people know from vector editors; one segment per edge keeps every handle attached to a node with an id, so a curve can be edited again after saving. Why flattening is specified: two readers must mesh and sew the same curve; leaving the tolerance to each would make results differ between the CLI and the browser.

Why nodes with edges, not a flat list of points with ids: only the points that matter (corners, notches) need identity. Giving all 700 points of a T-shirt an id would triple the file and make diffs noisy. Why each node owns its outgoing edge: no parallel arrays to keep in step. Why the sewing line, not the cut line: sewing, placement and simulation all happen on the sewing line. Seam allowance is for cutting and goes in an extension (planned VTRY_seam_allowance, per edge).

Internal lines

lines[] are open paths inside the piece (pocket placement, darts, stitching lines): id, name, and nodes in order, each with the edge to the next except the last. They’re meshed as creases and can be sewn (the hoodie’s pocket is sewn onto one). A line stays inside its piece (its ends may lie on the outline); readers warn about one that leaves it rather than refusing the file, since an imported DXF may carry a sloppy one.

Cut on the fold

A cut-on-fold piece is stored unfolded: the outline is the whole piece as cut from the fabric, and folds[] records each fold line as the straight line between two outline nodes (for the T-shirt front, centre front hem to centre front neck). The fold must run inside the piece, meeting the outline only at its two ends; readers refuse one that doesn’t.

Why unfolded (option A): what’s stored is what’s cut, meshed and simulated, and every point a seam may use exists in the file. The half-piece form can always be rebuilt from the outline and the fold, but the half-piece form can’t represent an asymmetric piece. Keeping halves symmetric while editing, and re-folding for DXF export, need the fold, which is why it’s a real entity rather than a note. Symmetric editing will be an addition (a symmetric flag on a fold, plus paired nodes), not a breaking change.

Grain line

grain: {from, to} is the grain line as drawn; its direction is the fabric’s warp (the direction fabric.stretch.warp applies to). Absent means +y. Its two ends must not be in the same place (0.01 mm).

Cuts

A piece is cut one or more times. Each cut is one copy in the garment:

"cuts": [
  { "id": "01a13cdb-cc26-…", "name": "right sleeve",
    "placement": { "type": "wrap", "region": "upper-arm-right", "angle": 0.0, "radius": 60.0, "top": -40.0 } },
  { "id": "01a13cdb-cc27-…", "name": "left sleeve", "mirrored": true,
    "placement": { "type": "wrap", "region": "upper-arm-left", "angle": 0.0, "radius": 60.0, "top": -40.0 } }
]
  • mirrored: the mirror image (x → −x in the piece frame), the other one of a left/right pair.
  • state (version 6): absent means placed and draped. unplaced waits for a place on the body and set-aside is kept but not needed on it. Either way the cut is not draped, nor are the seams that sew it and the cuts that follow it, and its placement is a placeholder (an import writes a flat sheet in front of the chest). A reader that predates version 6 drapes the placeholder.
  • fabric: overrides the garment’s fabric for this cut.
  • appearance: overrides the garment’s appearance (colour) for this cut.
  • placement: where it starts before sewing (below).
  • layout: where it sits in the 2D pattern view. Display only. The cut’s points (after mirroring) are turned by rotation (radians, counter-clockwise) about the piece’s origin, then moved by position (mm). Without one, the app lays cuts out as it likes.

Seams and placement refer to cuts; geometry belongs to the piece. Both cuts share the piece’s node ids, and directions are always in the piece frame, including for a mirrored cut.

Why pieces and cuts: editing the sleeve changes both sleeves, as it does on paper. The alternative, one piece per copy, would duplicate geometry and let left and right drift apart.

Placement

Where a cut starts, before sewing pulls it into place. Two types in v1:

wrap: rolled onto a cylinder around one of the avatar’s regions.

FieldMeaning
regionregion name, e.g. torso, upper-arm-left
anglewhere the piece’s centre goes around the axis, radians from the region’s zero direction; increasing towards axis × zero
radiuscylinder radius, mm
topwhere the piece’s top edge goes along the axis, mm from the region’s origin (torso: height above the floor; limbs: negative is down the limb)
rotationoptional: in-plane rotation of the piece before wrapping, radians counter-clockwise, after mirroring
tubeoptional, for long sleeves: below the piece’s widest row the radius follows the pattern (tube × width / 2π); above it, it rises linearly to radius at the top edge
offsetoptional, mm, never negative (absent is 0): further out than the stack puts the cut. It belongs to the cut, so reordering keeps it

The maths: transform the piece’s points (mirror, then rotate) and take its anchor, the centre of its bounding box in x and the top in y. A point p goes to region.at(along = top + (p − anchor).y) + r · (cos θ · e0 + sin θ · e1), with θ = angle + (p − anchor).x / r, where e0 is the region’s zero direction and e1 = axis × e0 at that point of the axis. The reference implementation is vitryne-pattern garment.rs (Frame::place and tube_profile); v1 is defined to match it.

follow: on top of another cut, like a pocket on a front: the same region, anchor, top and tube as the followed cut, at its radius plus lift (mm), at its angle unless angle is given. The followed cut must not follow this one, directly or indirectly.

The stack

stack on the garment lists every cut once, closest to the body first: which cut is outside which. The list is global, not per body place, because technical garments overlap across places (a front panel wrapping over the back). A cut that goes on another (follow) comes after it. A file where a cut is missing or listed twice, or one that goes on another comes before it, is refused.

What the order means for the start positions is the app’s to work out and not stored: a cut that overlaps others on the body starts further out than the ones below it, by a gap that follows the mesh resolution (never below 12 mm), plus its own offset. Two cuts overlap where their areas on the body do; cuts that only meet along an edge don’t. The reference implementation is vitryne-pattern placement/stacking.rs; how it works is in Architecture.

Why a list of cuts, not a number per cut: reordering is one edit to one list and can’t leave two cuts tied or a gap in the numbers; the list is the same shape as project.garments, which is in layering order too.

The editor’s placement gizmo adjusts these fields themselves (around, along, away from the axis, turn): no other placement data was needed.

Why regions by name: a garment file has to fit any avatar. Garments say “torso” and “upper-arm-left”, and each avatar defines where those are. The region coordinates used to be hard-coded in Rust for one avatar; they move into the avatar. Patents: placement is data the user sets. Under Patent warnings rule 3, auto-join must not use it as an input, and that is an app rule, not a format rule.

Seams

A seam sews side a to side b. Each side is a chain of runs, and the start of a meets the start of b, the end of a the end of b:

{
  "id": "01a13cdb-cc2d-77a1-8042-7453fa1f0bc1",
  "name": "right side seam",
  "a": [
    {
      "cut": "<front>",
      "from": "<underarm, right>",
      "to": "<hem, right side>",
      "direction": "ccw"
    }
  ],
  "b": [
    {
      "cut": "<back>",
      "from": "<underarm, right>",
      "to": "<hem, right side>",
      "direction": "cw"
    }
  ]
}
  • A run is a stretch of one cut’s outline between two of its nodes: cut, from, to, and direction, ccw (the outline’s order) or cw, in the piece frame. On an internal line, give line (its id) instead of direction; the run goes from from to to along the line.
  • A side may chain several runs, across cuts (the hoodie’s hood neckline runs along the front, the top of a raglan sleeve and the back).
  • pairing: nodes (the default): if both sides pass through the same number of nodes, the nodes meet (notches line up) and each stretch between them is matched by length; otherwise the sides are matched by length overall. length: always matched by length along the whole chain (needed when sides have different notches, like the hood’s crown seams).
  • Run ends are nodes, always. A seam that ends partway along an edge needs a point node there. That’s how the T-shirt sleeve’s cap top (no notch in the pattern) works: a named point at half the length between the two cap notches.
  • The format doesn’t restrict which nodes a seam may use (whole edges, notch to notch, or any two points). The interaction rules in Patent warnings (designs to avoid because other companies’ patents claim them) constrain how the editor lets people create seams, not what a file may contain.

Why “starts meet” instead of the sidecar’s reverse flag: one rule, no flag. To reverse a side, write its runs the other way.

Garment simulation overrides and sources

  • simulation: overrides the project’s targetVertices and engine, plus collisionBounds {min, max} (mm, avatar space): the box the cloth can reach, where the body’s collision field is built. Optional; when absent the engine derives one (see In the engine).

  • sources[]: imported originals (id, type such as dxf-aama, valentina or seamly2d, fileName, optional part if the original is kept in the container with role source). Pieces point back with source: {source, piece}. For reference and re-import only: nothing is read from a source when opening a file. Originals stay in the user’s own project and are left out of shared copies: the app keeps an imported DXF as a source part of the project (on the user’s disk or in their cloud storage), and drops source parts by default when exporting or sharing a .vtry or .vtryg, unless the user opts in (“include original files”). The sources[] entries stay, so the record of what a garment came from survives without its contents.

    Why: a kept original allows re-importing with a better importer (arcs are chords today), updating from a changed source, and reproducing import bugs, at a small cost in a project (20–40 KB next to a 482 KB avatar). But a DXF from professional software can hold more than the user means to share (other sizes, grade rules, other pieces, author or company names), and it would make a shared garment file 3–6 times larger.

  • attribution: title, creator, SPDX licence, source URL. Kept wherever the garment is copied, because licences like MIT (FreeSewing) require the notice to travel with the work.

Fabric

fabrics/<id>.json (schema). The physical behaviour, and which appearance it has by default:

{
  "id": "01a13cdb-cc03-713c-9796-120438b8ba92",
  "name": "Cotton jersey (placeholder)",
  "category": "knit",
  "density": 0.15,
  "stretch": {
    "warp": 11547.005383792517,
    "weft": 11547.005383792517,
    "shear": 4330.127018922194
  },
  "bending": { "warp": 5e-6, "weft": 5e-6 },
  "friction": 0.3,
  "notes": "The engine's spike-1 placeholder (Material::cotton), not calibrated. …"
}
FieldMeaningUnit
categorywoven, knit or nonwoven (quality targets differ: p99 strain 3% woven, 8% knit)
densityareal densitykg/m²
thicknessoptional; not used by the v1 engine (collision thickness is a simulation setting)mm
stretch.warp, .wefttensile stiffness along the grain and across it: force per unit width per unit strainN/m
stretch.shearin-plane shear stiffnessN/m
bending.warp, .weft, .biasbending rigidity per unit width (bias optional, defaults to the mean)N·m
frictionCoulomb coefficient against the body
appearanceoptional (version 3): how it looks by default, an appearance id
noteswhere the values come from, or that they are placeholders
attribution, libraryReffor fabrics from a library

Why these quantities: they’re the ones fabric testing reports (tensile, shear and bending tests, like KES-F or FAST), and the ones the published presets (Fabric & textile) cite. They’re independent of mesh resolution and of the solver. Anisotropy (warp ≠ weft) is in the format from the start, even though the v1 engine is isotropic (see In the engine). Why appearance isn’t here: colour and texture change per colourway while the physics stays the same. They’re a separate entity: Appearance. A fabric only names one as its default, so “navy denim” is one thing to pick (the editor’s fabrics are picked that way), and a texture added to the appearance later reaches every cut of that fabric.

Appearance

appearances/<id>.json (schema), since version 2. How a fabric looks, apart from how it behaves:

{
  "id": "01a13cdb-cc05-7a1e-9d3c-5b0f2e8c4a11",
  "name": "Navy",
  "color": "#1f2a44"
}
FieldMeaning
colorthe colour of the right side: sRGB, #rrggbb, lowercase
attribution, libraryReffor appearances from a library

A cut’s appearance is the nearest one set: the cut’s own appearance, else the appearance of the cut’s own fabric (if it names one), else the garment’s appearance, else the appearance of the garment’s fabric. All are optional: without any, the app shows its own cloth colour. Every appearance part is listed in project.appearances.

Why that order: a level of the tree (cut, then garment) wins over the one above it, and within a level an explicit appearance wins over the fabric’s, so a colourway can recolour a garment without editing its fabrics, while a cut cut from another fabric keeps that fabric’s look.

  • The colour is sRGB, as people pick it. A renderer working in linear light (glTF’s baseColorFactor) converts it.
  • Nothing in the drape depends on it. Changing a colour never needs a new simulation. The simulation cache’s key leaves appearance parts out, but it hashes whole garment parts, so pointing a cut at another appearance changes the key, as renaming a piece does (a later keyVersion can leave such display-only fields out).

Why an entity and not a color on the cut: a colourway (the same garment in navy, then in red) changes which appearance each cut uses while the pattern, fabrics and seams stay the same, and textures and print scale belong with the colour. An entity gives both a place without another format change: textures become parts an appearance names, and colourways map cuts to appearances (Extensions). Why a hex string: it is what colour pickers, CSS and design tools read and write, it can’t hold an out-of-range value, and it diffs well.

Avatar

avatars/<id>/avatar.json plus its mesh avatars/<id>/body.glb (schema). The avatar is embedded in every project, so a project opens on its own; content hashes let the app (and cloud storage) recognise and share an avatar used by many projects.

{
  "id": "01a13cdb-cc04-728e-9afd-3f992133737d",
  "name": "MakeHuman base (male, A-pose)",
  "attribution": { "title": "MakeHuman base mesh (hm08)", "creator": "…", "license": "CC0-1.0", "source": "…" },
  "mesh": "avatars/01a13cdb-cc04-728e-9afd-3f992133737d/body.glb",
  "pose": "A",
  "regions": {
    "torso": { "type": "axis", "origin": [0.0, 0.0, 30.0], "axis": [0, 1, 0], "zero": [0, 0, 1] },
    "arm-left": { "type": "path", "points": [[182.0, 1360.0, 6.0], [297.0, 1179.0, 12.0], …], "zero": [0, 1, 0] },
    …
  }
}
  • Mesh: glTF 2.0 binary, one mesh, triangles, metres, in avatar space (+Y up, facing +Z, feet at y = 0). The collision field (SDF) is never stored; the engine bakes or caches it.
  • measurements: optional, mm, informational in v1.

Why glTF: standard, compact, in metres, and it already has skins, morph targets and animations for poses later. OBJ has none of those.

Regions

A region is a frame to wrap pieces around: zero is the direction of angle 0 around it.

  • axis: a straight line through origin along axis (pointing towards the top of the pieces).
  • path: a centreline through points (the first is the origin), a Catmull-Rom curve that carries on straight past the last point; along the first segment’s direction above the origin. zero is carried along the curve (parallel transport).

Region vocabulary. Garments refer to these names; an avatar defines the ones it supports. “Left” is always the wearer’s left (+X).

RegionWhatangle 0Sidecar frame
torsovertical axis through the body; top = height above the floorfronttorso
headvertical axis through the headfronthead
head-overleft-right axis through the head centre, for strips over the top of the headtophead_over
upper-arm-left, -rightstraight, from the shoulder joint along the upper armtop of the armarm_l, arm_r
arm-left, -rightthe arm’s centreline, bent at the elbow, to the wristtop of the armbentarm_l, bentarm_r
arm-straight-left, -rightstraight, from the shoulder joint towards the wristtop of the armlongarm_l, longarm_r
leg-left, -rightaxis through the leg, from the floorfrontleg_l, leg_r

New region names are additions, not format changes. A file using a region its avatar doesn’t have still opens; the app reports the cut as unplaced.

Simulation settings

In project.json simulation, overridable per garment:

  • targetVertices: the mesh resolution, about this many cloth vertices per garment.
  • engine: sparse engine tuning, only the values that differ from the engine’s defaults, keyed by the engine’s own setting names (vitryne-solver SimSettings, e.g. {"substeps": 30, "self_collision": false}). This object uses the engine’s units (SI, metres) and naming, the one exception to the format’s conventions. Unknown keys are kept and ignored (with a warning). Three keys aren’t SimSettings fields: schedule (the garment’s sewing and gravity ramp, vitryne-solver Schedule), and sdf_cell, sdf_band (the collision field’s cell size and band, m). The garment’s values win over the project’s.

Why sparse: a file that doesn’t override a value gets the engine’s improvements to that value, and the file states only what the author chose. Reproducing an exact drape is the cache’s job (its key includes the engine version). Why a fenced engine namespace: the solver’s 30-odd tunables change with the engine; putting them in the format proper would mean a format version per solver change. Anything users set through the UI (resolution today; quality presets later) gets a format-level name.

View

view.json, optional: camera (target in mm, distance in mm, optional yaw/pitch in radians), and drape (paused, fast): the drape’s controls as the project was left, so a project left paused opens paused (version 5; absent means the drape waits for Play, not fast). It never affects the drape’s result and isn’t part of the cache key (schema).

Simulation cache

A cached drape lets a file open showing the drape without simulating. It’s always optional and always safe to delete. Readers that can’t use it ignore it.

  • One entry per drape of the project (all garments, since outer layers depend on inner ones): the part cache/<key>.glb, role cache, where <key> is sha256- plus the hex key.

  • The key is the SHA-256 of the canonical JSON (RFC 8785, JCS) of everything the drape depends on:

    {
      "keyVersion": 1,
      "engine": { "name": "vitryne-solver", "version": "0.1.0" },
      "garments": [ <each garment part, in layering order> ],
      "fabrics": [ <each fabric used, by id order> ],
      "avatar": { "mesh": "<sha256 of body.glb>", "regions": { … } },
      "simulation": <the resolved settings: engine defaults, then project, then garment overrides>
    }

    A file opens with its cache only if the recomputed key matches. Renaming a piece changes the key too; v1 accepts that to keep the rule simple (a recompute is the only cost), and a later keyVersion can leave out display-only fields.

  • The cache part is a glTF 2.0 binary, in metres: one glTF mesh per garment, one primitive per cut, with POSITION (the draped positions), _PATTERN (VEC2 float, the vertex’s pattern position in its cut’s frame, metres), and triangle indices. asset.extras.vitryne holds {key, keyVersion, engine, frames, atRest}; each mesh’s extras.garment and each primitive’s extras.cut hold ids.

  • To resume simulating from a cache (drag after opening), the engine re-meshes the garment and uses the cached positions only if the mesh matches _PATTERN exactly. Otherwise it shows the cache and re-drapes.

Why glTF for the cache: it is the export format and viewable in any glTF viewer. The same code writes both. Why the engine version is in the key: GPU solvers aren’t bit-exact and a solver change alters drapes. A stale cache shows a drape the current engine wouldn’t produce.

Versions and migrations

  • formatVersion (integer) is the version the file was written in. Every change to the format increments it, additive or not, and comes with a migration (possibly a no-op).
  • minReaderVersion is the oldest reader that can open and save the file correctly. It moves only on a breaking change (removed or reinterpreted data); for an additive change (a new optional field that older readers can ignore safely) it stays.
  • A reader:
    • older file (formatVersion below its own): applies the migrations from formatVersion to its own, in order, on the raw JSON of all parts, before parsing into types. Saving writes its own version.
    • newer file it can still read (minReaderVersion ≤ its version < formatVersion): opens it, keeps unknown members, extensions and parts, and saves it with the file’s formatVersion and minReaderVersion unchanged.
    • file too new (its version < minReaderVersion): refuses with “made with a newer Vitryne”, and may offer read-only viewing.
  • Migrations are pure JSON-to-JSON functions, one per version step, never deleted. The test suite keeps a fixture file for every past version and checks it migrates and opens.
  • Version 4 is a breaking change for files with garments (minReaderVersion is 4 for them, still 1 for fabric and avatar files): the stack lists every cut, so a version 3 app that added or removed a cut would leave it stale. The migration orders each garment’s cuts by the radius they start at (a follow at its cut’s radius plus lift), ties in file order, so a file looks as it did.
  • Version 5 is additive: view.json gained drape. The migration is a no-op.
  • Version 6 is additive: cuts gained state. The migration is a no-op.
  • A rule for future additive features: if a new field’s meaning depends on other data (e.g. per-size node offsets), it must stay valid when an older app edits that data, or the change has to be breaking, or it goes in a required extension.

Why an integer and not semver: “can I read this?” is answered by minReaderVersion, so a single counter is enough. Why migrate raw JSON: the typed structures only ever exist for the current version, so old type definitions don’t pile up in the code.

Extensions and future features

  • Unknown members are kept. A reader preserves any JSON member it doesn’t know (at any level) and any part it doesn’t know, and writes them back. Writers never invent members outside extensions. The schemas are strict (they reject unknown members) because they check what a v1 writer produces; readers are lenient.
  • extensions: every object may carry extensions: {"NAME": {…}}, glTF style. Names are VTRY_… (official), EXT_… (shared by several vendors) or a vendor prefix. The manifest lists every name in extensionsUsed, and in extensionsRequired those without which the file would be misread; a reader that lacks a required extension refuses the file. Official extensions can later move into the core format through a migration.
  • extras: free-form application data on any object, never interpreted.

How the planned features fit, without breaking v1 files:

FeatureHow it’s added
Sizes and gradingPer-size offsets of outline nodes (by id), the way grade rules work in industry formats. The ids are why nodes exist. A sizes list on the garment plus per-node deltas. (Watch Patent warnings rule 6 for automatic grading.)
Colourways and texturesAppearances exist since version 2 (colour only), and fabrics name a default one since version 3. Next: texture parts and print scale on the appearance, and colourways on the garment mapping cuts to appearances. Physics stays in fabrics, so nothing existing changes.
Multi-garment outfitsAlready there: project.garments is in layering order. Per-garment visibility or grouping are additions.
Avatars from measurementsavatar.source = {generator, measurements}, with body.glb as the generated (and regenerable) mesh.
Animations and posesglTF skins and animations in body.glb; a project-level pose reference. The cache key gains the pose.
CollaborationStable ids per entity are what operation-based sync needs; per-entity parts let edits travel as small objects. Metadata (authors, comments) goes on entities in extras or an extension. The file stays a snapshot.
Seam allowance, arcsVTRY_seam_allowance per edge; new edge.type values (arc), which a reader that doesn’t know them must refuse, so they go in extensionsRequired until they’re core, as cubic does (VTRY_curves, Curved edges).

Interop

Converters, not the format:

  • In: DXF-AAMA (vitryne convert, and the editor’s import, where each cut is placed as the user chooses and seams come from a garment.toml if one is given). Each DXF piece becomes a piece; boundary (or sew line, layer 14) → outline in mm, CCW; turn points → corner nodes; notches → notch nodes; mirror line → unfolded outline plus a fold between two point nodes; grain line → grain; internal lines → lines (both ends and every turn over 15° become nodes). DXF quantity gives the default number of cuts. Arcs are imported as chords (as today). Anything ignored is reported at import and not stored. The original may be kept as a source part. The importer puts every point on the format’s 0.001 mm grid, so an imported piece is exactly the piece a saved file holds.
  • In: Valentina and Seamly2D (.val or .sm2d with its .vit/.vst or .smis/.smms measurements; vitryne convert and the editor’s import, placed as for DXF). The pattern’s tools are worked out at a chosen size; each piece’s path → outline in mm, CCW, its curves as cubic edges (a spline path’s joints as point nodes), corner where it turns over 15°, passmarks as notch nodes; internal paths → lines; grainline → grain; mirror line → unfolded outline plus a fold; quantity → the default number of cuts. The outline is the main path, the sewing line (a piece whose seam allowance is built in is imported with a warning). Labels, seam allowances and layout data are not imported. Source type: valentina or seamly2d.
  • Out: glTF 2.0 and OBJ: the draped mesh in metres, UVs from pattern coordinates (the _PATTERN data of the cache), one material per fabric.
  • Out: DXF-AAMA (later): re-folds pieces along their folds when the halves are still symmetric, writes notches and grain; seam allowance once that extension exists.

From garment.toml

vitryne convert <garment.toml> <out.vtry> (vitryne-pattern convert) turns a sidecar plus its DXF into a project with the test avatar. The three samples in assets/examples/ are its output (tools/format/build-examples.sh), and make check fails if they drift from it. Ids are version 7 from a fixed time and the garment’s name, so converting again gives the same file. Only the DXF pieces the sidecar uses become pieces (the hoodie’s waistband, cuffs, binding and pocket facing are left out); --include-dxf keeps the DXF as a source part.

garment.tomlVitryne file
namegarment.name
dxf, units_mimported once into pieces (mm); recorded in garment.sources[]; the DXF may be kept as a source part
[sdf] min, maxgarment.simulation.collisionBounds, in mm; without [sdf], the engine’s default box (SdfParams::default), written out so the drape doesn’t change
[sdf] cell, banddropped when they equal the engine defaults (4 mm, 120 mm: true for all three samples), else garment.simulation.engine sdf_cell, sdf_band (m)
schedulegarment.simulation.engine.schedule (no sample sets it)
title, [attribution]garment.name (default: name), garment.attribution
[fabric] name, category, notesthe fabric’s (default: a knit placeholder named after the garment)
[names] front = [...], "sleeve:3+0.5" = "...", "front:L0" = [...]node names: landmarks in order, a fractional point, an internal line’s landmarks
label on [[piece]], [[seam]]the cut’s and the seam’s name (default: name)
[material] (or the default Material::cotton)a fabric part: density as is; stretch.warp = weft = 2k/√3 and shear = 3/8 of that, from stretch_k (see below); bending.warp = weft = bend_kb; friction = 0.3 (the engine’s current value); category by sample (T-shirt and hoodie knit, trousers woven)
camera = [x, y, z, d]view.json camera: target = (x, y, z) in mm, distance = d in mm (the default camera when absent)
[[piece]] with the same dxfone piece, with one cut per [[piece]] entry (name → cut name)
mirrorcut.mirrored
rotate (degrees)cut.placement.rotation (radians)
place.frameplacement.type = "wrap", region by the table in Regions
place.angle, radius, top, tubeangle in radians; radius, top in mm; tube as is
place.lift without likeadded to radius
place.like = "x", liftplacement.type = "follow", cut = x’s cut id, lift in mm
DXF landmarks (numbered per piece)outline nodes: Turn → corner, Notch → notch, FoldEnd and LineEnd → point; names from the sidecar’s comments
fractional landmark 3+0.5a point node inserted at half the length from node 3 to node 4
L0:2-3 (internal line, landmarks)a lines[] entry; its landmarks become its nodes
[[seam]] name, a, bseam.name, a, b as chains of runs
"front:3-5"run {cut, from: node 3, to: node 5, direction: "ccw"}
"!front:3-5"run {cut, from: node 5, to: node 3, direction: "cw"}
"front:L0:2-3"run {cut, line, from: node 2, to: node 3}
reverse = trueside b written the other way: its runs in reverse order, each with from/to swapped and the direction flipped
by_length = truepairing = "length"

The stretch conversion. The engine’s stretch_k is the stiffness of each mesh edge. For a mesh of equilateral triangles, springs of stiffness k act like a membrane with tensile stiffness Y = 2k/√3 and Poisson’s ratio 1/3, so shear stiffness Y / (2(1 + ν)) = 3Y/8, whatever the edge length. The engine converts back with k = (√3/2) · Y. The cotton placeholder’s k = 10⁴ N/m becomes Y = 11,547 N/m; the trousers’ k = 10⁶ N/m becomes 1.155 × 10⁶ N/m. These are the same placeholders under a physical name, not calibrated values (those are the presets).

The T-shirt, worked through: 3 pieces (front and back cut on the fold, unfolded with 12 nodes each; sleeve with 6 nodes plus the cap-top point), 4 cuts (the left sleeve mirrored), 10 seams. The sidecar’s side_r (a = "front:10-11", b = "back:1-2", reverse = true) becomes side a “front, underarm right → hem right side, ccw”, side b “back, underarm right → hem right side, cw”. See the example. (The first example was written by a script by hand and had one seam wrong: its “left armhole, back” ran counter-clockwise from the underarm to the shoulder tip, the long way round the back. The converter writes what the sidecar says, shoulder tip to underarm.)

Cloud storage

The format is the same on disk and in the cloud. The planned hosted instance (and any self-hosted one) stores a file as its manifest plus content-addressed parts: each part is an object keyed by its SHA-256. That gives, for free:

  • Deduplication: an avatar used by a thousand projects is stored once.
  • Small uploads: saving after a fabric change uploads one small JSON part and a new manifest.
  • Downloads are exports: a .vtry is the manifest and its parts, zipped.

The editor saves projects to its backend, never to disk (since the MVP fixes): a .vtry file is what the CLI writes, what Download all my data gives, and what the editor opens as a new project. How accounts and storage work is an app concern, not a format one: see Cloud backend. There, parts are deduplicated per person rather than across people (an avatar is stored once per person, whatever the number of their projects), so that knowing a hash never gives access to someone else’s part.

In the engine

What reading a file into the engine takes (vitryne-pattern project):

  1. Fabric from physical values. Material is built from the fabric: k = (√3/2) · mean(warp, weft), bend_kb = mean(warp, weft), and the friction setting from friction. The engine is isotropic; shear is ignored, and opening warns if warp ≠ weft.
  2. Region frames from the avatar. Frames are built from avatar.regions (mm → m). The test avatar’s regions are in assets/body/avatar.json, which the garment.toml path uses too (Frame::named is gone). A garment file (no avatar) is placed on the test avatar.
  3. One fabric per garment. The engine takes one Material per garment; a garment whose cuts use different fabrics is refused with a clear message until it doesn’t.
  4. Collision bounds. From collisionBounds when present; otherwise the placed garment’s bounding box plus 150 mm on every side (not below the floor). The samples carry theirs.
  5. Identical drapes. Each cut is a panel (pieces in order, then their cuts), its outline split into edges at every node, so a .vtry and the garment.toml it came from give the same engine garment, bit for bit (vitryne-pattern test project_matches_sidecar), and drape the same (vitryne regress and vitryne regress --toml share one set of goldens). Two things made that exact: the importer’s 0.001 mm grid (above), and the mesher listing triangles in a canonical order (it used to follow the triangulation library’s internal order, which sub-micrometre input changes can reorder, and triangle order is constraint order).
  6. The avatar mesh comes from the file’s body.glb; the drape cache isn’t implemented yet (cache parts are kept and written back unread).

Decisions

Approved on 2026-10-13. This design commits to:

  1. Zip of JSON parts plus glTF, one entity per part, mimetype first; also valid as a folder.
  2. Four kinds, one format: .vtry, .vtryg, .vtryf, .vtrya, told apart by manifest.kind.
  3. mm for every length in JSON, radians, SI for physics; glTF parts in metres; the engine tuning object is the single exception.
  4. UUIDv7 ids on entities and on the nodes things refer to; references never use indices or names.
  5. Nodes plus edges for outlines: only corners, notches and named points have ids.
  6. Cut-on-fold stored unfolded, with folds as entities.
  7. Pieces and cuts: geometry once, copies (mirrored or not) as cuts.
  8. Placement by named body region, the regions defined by the avatar.
  9. Seams as two chains of runs, starts meeting, any two nodes allowed.
  10. Fabric in physical units, anisotropic from the start; appearance kept separate.
  11. The avatar embedded in every project.
  12. Sparse simulation settings, with engine tuning fenced off.
  13. A glTF drape cache keyed by a SHA-256 of all inputs plus the engine version.
  14. formatVersion + minReaderVersion, migrations on raw JSON, unknown data preserved, glTF-style extensions.
  15. Imported originals stay in the user’s own project and are left out of shared copies unless the user opts in.

Settled in the review, to revisit later:

  • The avatar is embedded in every project. Fine for now; a reference to a shared avatar can be added later (a new avatar source, with the embedded mesh as its cache).
  • The schema ids use vitryne.app URLs. They’re names, not downloads; nothing has to be hosted. Publishing the schemas there later would give editors autocompletion. Changing the domain later means new $ids in a new schema version, not a format change.
  • Node names on a fresh DXF import: the converter writes the sidecars’ names; a fresh import has none, so seams would show as “corner 3”. Names generated from position (“hem, left side”) come later.