/** * VRM BLEND SHAPES → `helix/avatar-face@1`. * * The sibling of `vrmDynamics.ts`, and it exists for the same reason: a bridge that carries an avatar's bones * but not its mouth has not carried the avatar. Every VRM in the reference set declares the same five vowels * and a blink, and HELIX's own face contract names them identically — `vowel.aa/ih/ou/ee/oh` IS the VRM 1.0 * preset vocabulary, and VRM 0.x's `a/i/u/e/o` is the same five under older names. So this is a rename plus an * index resolution, not a retarget, and there is no excuse for an imported character to arrive mute. * * What it deliberately does NOT do: * * - Invent the 15 visemes. VRM assets have five vowels; `FaceRuntime` already folds a 15-viseme provider down * onto five when that is all the asset has. Declaring `viseme.pp` against a mouth shape that cannot make a * P would be a lie the runtime then blends. * - Carry the emotion presets (joy, angry, sorrow, fun). They are real and they are worth having, but the * face contract is 24 channels of SPEECH and EYES; emotions belong to whatever expression system claims * them, and squatting on the contract now would make that harder, not easier. * - Guess. If the file has no expression block, this returns null and the caller ships an avatar with no face * manifest, which is honest. A name-based fallback for VRoid's `Fcl_MTH_*` exists but runs only when the * file's own declaration is missing, and says so in the warnings. */ import type { ExpressionId } from '../faceManifest'; import { type FaceExt } from './vrmFaceExt'; export interface GltfLike { meshes?: Array<{ name?: string; extras?: { targetNames?: string[]; }; primitives?: Array<{ extras?: { targetNames?: string[]; }; }>; }>; nodes?: Array<{ name?: string; mesh?: number; }>; extensions?: Record; } /** The subset of `helix/avatar-face@1` this converter can produce. */ export type VrmFaceSemantic = 'vowel.aa' | 'vowel.ih' | 'vowel.ou' | 'vowel.ee' | 'vowel.oh' | 'blink.left' | 'blink.right' | 'gaze.left' | 'gaze.right' | 'gaze.up' | 'gaze.down'; export interface VrmFaceChannel { kind: 'morph'; name: string; mesh?: string; scale: number; } export interface VrmFaceResult { sourceVersion: '0.x' | '1.0'; channels: Partial>; expressions: Partial>; /** Everything the strict contract cannot hold: multi-morph expressions, custom ones, overrides, lookAt. */ ext: FaceExt | null; warnings: string[]; } /** * Read a VRM's expressions and return the HELIX face channels, or null if it declares none this can use. * * NO `jawOpen`, deliberately, and it took building the wrong thing first to see why. VRM has no jaw channel, and * the face runtime's cheap LOD rung drives `jawOpen` alone — so deriving it from the "aa" morph looked like free * fidelity at distance. It is not: two semantics bound to the SAME morph both write it, so driving "ih" or "oh" * also opened the "A" shape all the way. Measured on the reference avatar — `vowel.ih` at 1.0 left `Fcl_MTH_A` * at 1.0 — which is a mouth stuck in one vowel for every sound it makes. * * A still mouth at forty pixels is a smaller lie than the wrong mouth shape at four hundred — and it is not * even that, because `FaceRuntime` already handles the absence properly: at the jaw rung, an asset with no * `jawOpen` binding has its `vowel.aa` target driven by the jaw signal instead ("their broadest open-mouth * target, never a blink/expression or an arbitrary first morph"). So the fallback exists where it belongs, at * the rung that needs it, instead of corrupting the full rung as an aliased channel did. An asset with a * genuine, distinct jaw morph can still declare `jawOpen` in a hand-authored manifest; this converter will not * invent one by aliasing a vowel. */ export declare function convertVrmFace(gltf: GltfLike, boneExists?: (sourceNodeName: string) => string | undefined): VrmFaceResult | null; /** The `helix/avatar-face@1` manifest for a converted face, ready for `attachFaceManifest`. */ export declare function faceManifestFrom(result: VrmFaceResult): { contract: 'helix/avatar-face@1'; channels: Partial>; expressions?: Partial>; lod: { fullMinPixels: number; jawMinPixels: number; }; };