ConstAdmitted mesh with a skin.
Bones at rest, such as resolvePose of a pose with no joints
and a null root.
Bones in the pose to skin into, from resolvePose.
OptionalmorphWeights: ReadonlyMap<string, number>
Target weights by name, such as
resolveMorphTargetWeights output merged with expression weights;
omitted, no target displaces the mesh.
Flat skinned positions [x,y,z,...] in metres, aligned with
mesh.positions.
Skin a mesh's vertices from its rest pose into a resolved pose, by the method its skin declares, with the formula the viewer's shader draws.
Each joint
jmoves its vertices by the rigid transformC_j = P_j R_j^-1, whereR_jis its rest frame andP_jits posed frame."linear"(also an omitted method) returnssum(w_k C_k v) / sum(w_k), the matrix blend thatTHREE.SkinnedMeshcomputes after normalizing the weights."dual-quaternion"turns eachC_jinto a unit dual quaternion, negates any whose rotation lies in the other hemisphere from the vertex's largest-weight joint (the lowest slot on a tie), sums them by weight, divides by the length of the rotation part and applies that rigid transform (Kavan et al. 2008).Positions are read in the frame the rest bones are expressed in: model space for
resolvePoseoutput, so a part with a transform has it applied to the positions first. Both methods commute with a rigid or uniformly scaled part transform, which is why the viewer can skin in the part's own frame. The result is in the posed bones' frame, so passing bones resolved with a pose root places the vertices by that root as well.Morph targets named in
morphWeightsdisplace the rest positions first,p + sum(w_t * positions_t), as the viewer applies relative morph targets before skinning; a name the mesh does not carry is ignored, as an expression ignores a channel a mesh lacks.Throws when the mesh has no skin or a skin joint is missing from either bone list.