Aqoole_Hateenaの技術日記

vulkan+raytraceで色々描いてます

glTFでのアニメーション

glTFでアニメーション

colladaに引き続き、glTFでもアニメーションを行うことができた。

モデルの権利表記

配布元リポジトリ
https://github.com/TheThinMatrix/OpenGL-Animation

Unlicense license
https://unlicense.org/

glTFでanimationを行うときの注意点

nodeとjointとの関係のようなものは別の機会にまとめたいと思うが、注意点としては以下のようなものがある。

  • inverse bind matrixはjointの順番に並んでいる
  • animationのtargetはnodeの番号
  • inverse bind matrixは親nodeからの継承も含めて計算されている
  • rotationのQuaternionからの変換はwikiにある変換を用いればよい

Rotation formalisms in three dimensions - Wikipedia


colladaでanimationを行う際には
[Animation] colladaファイルの読み取りからAnimationを行うまで - Qiita
でまとめた通り

OBJECT SPACE -> BONE SPACE -> OBJECT SPACE
geometry (J_{A} * J_{B1} * J_{C1})^{-1} b A_{A} * A_{B1} * A_{C1} p

となるが、glTFでは

OBJECT SPACE -> BONE SPACE -> OBJECT SPACE
geometry J_{C1}^{-1} b A_{A} * A_{B1} * A_{C1} p

となる。