vrm-mixamo-retarget
Version:
A lightweight library for retargeting Mixamo FBX animations to VRM avatars using Three.js
97 lines • 4.82 kB
TypeScript
import * as THREE from 'three';
import type { VRM } from '@pixiv/three-vrm';
/**
* A map from Mixamo rig name to VRM Humanoid bone name
*/
export declare const mixamoVRMRigMap: {
readonly mixamorigHips: "hips";
readonly mixamorigSpine: "spine";
readonly mixamorigSpine1: "chest";
readonly mixamorigSpine2: "upperChest";
readonly mixamorigNeck: "neck";
readonly mixamorigHead: "head";
readonly mixamorigLeftShoulder: "leftShoulder";
readonly mixamorigLeftArm: "leftUpperArm";
readonly mixamorigLeftForeArm: "leftLowerArm";
readonly mixamorigLeftHand: "leftHand";
readonly mixamorigLeftHandThumb1: "leftThumbMetacarpal";
readonly mixamorigLeftHandThumb2: "leftThumbProximal";
readonly mixamorigLeftHandThumb3: "leftThumbDistal";
readonly mixamorigLeftHandIndex1: "leftIndexProximal";
readonly mixamorigLeftHandIndex2: "leftIndexIntermediate";
readonly mixamorigLeftHandIndex3: "leftIndexDistal";
readonly mixamorigLeftHandMiddle1: "leftMiddleProximal";
readonly mixamorigLeftHandMiddle2: "leftMiddleIntermediate";
readonly mixamorigLeftHandMiddle3: "leftMiddleDistal";
readonly mixamorigLeftHandRing1: "leftRingProximal";
readonly mixamorigLeftHandRing2: "leftRingIntermediate";
readonly mixamorigLeftHandRing3: "leftRingDistal";
readonly mixamorigLeftHandPinky1: "leftLittleProximal";
readonly mixamorigLeftHandPinky2: "leftLittleIntermediate";
readonly mixamorigLeftHandPinky3: "leftLittleDistal";
readonly mixamorigRightShoulder: "rightShoulder";
readonly mixamorigRightArm: "rightUpperArm";
readonly mixamorigRightForeArm: "rightLowerArm";
readonly mixamorigRightHand: "rightHand";
readonly mixamorigRightHandPinky1: "rightLittleProximal";
readonly mixamorigRightHandPinky2: "rightLittleIntermediate";
readonly mixamorigRightHandPinky3: "rightLittleDistal";
readonly mixamorigRightHandRing1: "rightRingProximal";
readonly mixamorigRightHandRing2: "rightRingIntermediate";
readonly mixamorigRightHandRing3: "rightRingDistal";
readonly mixamorigRightHandMiddle1: "rightMiddleProximal";
readonly mixamorigRightHandMiddle2: "rightMiddleIntermediate";
readonly mixamorigRightHandMiddle3: "rightMiddleDistal";
readonly mixamorigRightHandIndex1: "rightIndexProximal";
readonly mixamorigRightHandIndex2: "rightIndexIntermediate";
readonly mixamorigRightHandIndex3: "rightIndexDistal";
readonly mixamorigRightHandThumb1: "rightThumbMetacarpal";
readonly mixamorigRightHandThumb2: "rightThumbProximal";
readonly mixamorigRightHandThumb3: "rightThumbDistal";
readonly mixamorigLeftUpLeg: "leftUpperLeg";
readonly mixamorigLeftLeg: "leftLowerLeg";
readonly mixamorigLeftFoot: "leftFoot";
readonly mixamorigLeftToeBase: "leftToes";
readonly mixamorigRightUpLeg: "rightUpperLeg";
readonly mixamorigRightLeg: "rightLowerLeg";
readonly mixamorigRightFoot: "rightFoot";
readonly mixamorigRightToeBase: "rightToes";
};
/**
* Configuration options for animation retargeting
*/
export interface RetargetingOptions {
/** Custom bone mapping from Mixamo to VRM (overrides default mapping) */
customBoneMap?: Partial<typeof mixamoVRMRigMap>;
/** Whether to log warnings for missing bones (default: true) */
logWarnings?: boolean;
/** Custom animation clip name in the FBX file (default: 'mixamo.com') */
animationClipName?: string;
}
/**
* Retarget Mixamo animation from FBX object for three-vrm use.
*
* @param fbxAsset A loaded FBX object containing Mixamo animation data
* @param vrm A target VRM
* @param options Optional configuration for retargeting
* @returns THREE.AnimationClip | null The converted AnimationClip or null if failed
*/
export declare const retargetAnimation: (fbxAsset: THREE.Group, vrm: VRM, options?: RetargetingOptions) => THREE.AnimationClip | null;
/**
* Load Mixamo animation from URL, convert for three-vrm use, and return it.
* This is a convenience function that loads the FBX and then retargets it.
*
* @param url A url of mixamo animation data
* @param vrm A target VRM
* @param options Optional configuration for retargeting
* @returns Promise<THREE.AnimationClip | null> The converted AnimationClip or null if failed
*/
export declare const retargetAnimationFromUrl: (url: string, vrm: VRM, options?: RetargetingOptions) => Promise<THREE.AnimationClip | null>;
/**
* Legacy function name for backward compatibility
* @deprecated Use retargetAnimationFromUrl instead
*/
export declare const loadAnim: (url: string, vrm: VRM, options?: RetargetingOptions) => Promise<THREE.AnimationClip | null>;
export type { VRM, VRMHumanBoneName } from '@pixiv/three-vrm';
export type { AnimationClip, KeyframeTrack } from 'three';
//# sourceMappingURL=index.d.ts.map