Replace a vertex shader's linear blend skinning with dual quaternion
skinning, the formula skinAutoMovieMesh evaluates in the engine.
Three's bone matrix for joint j is G P_j R_j^-1, with G the model's
world placement at draw time, and its attached bind gives
bindMatrixInverse = (G T)^-1 for the part transform T. The shader
therefore blends K_j = bindMatrixInverse * boneMatrix_j * bindMatrix = T^-1 P_j R_j^-1 T, which cancels G and stays rigid for a rigid or
uniformly scaled T. Each K_j becomes a unit dual quaternion through
Shepperd's matrix-to-quaternion method; the four are aligned to the hemisphere
of the largest weight (the lowest slot on a tie), summed by weight, divided by
the length of the rotation part and applied to the morphed position. Normals
and tangents turn by the blended rotation alone. The result is already in the
part's frame, so no bindMatrixInverse follows.
The blend is computed once after skinbase_vertex and read by the normal and
position chunks, so depth and distance shaders, which skip the normal chunk,
still skin their positions. A shader missing the skinning parameter, base or
position chunk is refused rather than left on linear skinning.
Replace a vertex shader's linear blend skinning with dual quaternion skinning, the formula
skinAutoMovieMeshevaluates in the engine.Three's bone matrix for joint
jisG P_j R_j^-1, withGthe model's world placement at draw time, and its attached bind givesbindMatrixInverse = (G T)^-1for the part transformT. The shader therefore blendsK_j = bindMatrixInverse * boneMatrix_j * bindMatrix = T^-1 P_j R_j^-1 T, which cancelsGand stays rigid for a rigid or uniformly scaledT. EachK_jbecomes a unit dual quaternion through Shepperd's matrix-to-quaternion method; the four are aligned to the hemisphere of the largest weight (the lowest slot on a tie), summed by weight, divided by the length of the rotation part and applied to the morphed position. Normals and tangents turn by the blended rotation alone. The result is already in the part's frame, so nobindMatrixInversefollows.The blend is computed once after
skinbase_vertexand read by the normal and position chunks, so depth and distance shaders, which skip the normal chunk, still skin their positions. A shader missing the skinning parameter, base or position chunk is refused rather than left on linear skinning.