Tekkaman

导航

 

绑定姿势

  //The Bind Pose Matrices allow a raw vertex of the mesh (in local coordinates) to be transformed into world-space
  // and then to each bone's local coordinate space, after which each bone's animation can be applied to the vertex in question
  // (under the influence of the weighting value). The mesh's bind pose takes the vertex from local space to world-space,
  // and then each bone's inverse bind pose takes the mesh vertex from world-space to the local space of that bone.

  // The mesh's Bind Pose Matrix takes its vertices into world-space, to the location at the time of binding,
  // and each bones' Bind Pose Matrix takes the bones from local space to world-space at the time of binding.

  bind pose是指将vertex从local coord转换到world coord的matrix。而inverse bind pose起相反world 2 local的作用。

  在Unity中,上述的mesh bind pose与bone inverse bind pose,合2为一,为mesh.bindposes属性。

  

  Unity官方示例中,有一段计算 bindPose的代码,

        Transform[] bones = new Transform[2];
        Matrix4x4[] bindPoses = new Matrix4x4[2];
        bones[0] = new GameObject("Lower").transform;
        bones[0].parent = transform;
        // Set the position relative to the parent
        bones[0].localRotation = Quaternion.identity;
        bones[0].localPosition = Vector3.zero;
        // The bind pose is bone's inverse transformation matrix
        // In this case the matrix we also make this matrix relative to the root
        // So that we can move the root game object around freely
        bindPoses[0] = bones[0].worldToLocalMatrix * transform.localToWorldMatrix;
View Code

 

  

参考:http://blog.csdn.net/watersevenmmfx/article/details/51920439

posted on 2017-10-20 21:01  Tekkaman  阅读(361)  评论(0编辑  收藏  举报