I have some problems with skinning. So, here are the steps i have done to perform skinning.
- When exported, all vertices are already in the reference pose.
- All bone transformations are absolute transformation. (Not relative to parent)
- bone offset matrix = inverse (bone transform matrix)
- bone matrix = bone matrix * inverse (parent bone matrix)
- bone.transformMatrix = bone matrix (as exported)
- Loop through each bone
bone.absoluteMatrix = bone.transformMatrix * parentBone.absoluteMatrix
- Send bone.absoluteMatrix as the bone matrix to the GPU
- Send bone.offsetMatrix (as exported) as the bone offset matrix to the GPU
for each vertex
vec4 tempVertex = [0, 0, 0, 0]
for each bone influencing this vertex
boneMatrix = boneMatrix[this bone] * boneOffsetMatrix[this bone]
tempVertex += (vertex * boneMatrix) * weight[this bone on this vertex]
tempVertex /= total weight
final vertex position = projection Matrix * view matrix * world matrix * tempVertex
So, the skinned mesh is not being rendered correctly and i am not being able to spot the problem but i know the problem comes from the matrices. The weights and bone influences are all right. Any1 can help please?
princezaheeMember Since 15 Jan 2013
Offline Last Active Mar 26 2013 02:18 AM