import type { Document } from '@gltf-transform/core'; /** * Bake a skin whose rest pose differs from its bind pose into the vertices, so that bind == rest. * * glTF skinning draws a vertex at `sum(w_k · jointWorld_k · IBM_k · v)`. In a rig exported at its bind pose every * `jointWorld · IBM` is the same matrix and the vertices already sit where the joints are. A VRM 1.0 exported from * Blender is not always like that: Seed-san's mesh is modelled with the arms hanging (an A-pose) while the humanoid * nodes are authored in the T-pose and the IBMs carry the difference. A viewer draws that file as a T-pose, because it * multiplies through the IBMs; the converter does not, it re-derives the bind matrices from the joints' rest * (`IBM = inverse(rest)`, which is what keeps a pristine rest render for every other source) and so threw the * difference away: the T-pose skeleton ended up inside a mesh that still hung its arms, the forearm bone with no * geometry along it, and the avatar rendered with arms down in every clip. * * What a viewer draws at rest is the truth, so it is made the vertices: each vertex, normal, tangent and blend-shape * delta is moved by its blended rest skinning matrix, and the IBMs become `inverse(jointWorld)`. A rig that already * agrees (VRoid, anything exported at bind) is left byte for byte untouched. */ export interface BakeRestSkinReport { /** Skins whose rest and bind poses disagreed and were baked. */ skins: number; /** Largest distance (source units) any joint's skinning matrix moves the origin of its own bind frame, before baking. */ maxJointShift: number; } export declare function bakeRestSkin(document: Document): BakeRestSkinReport;