• Advertisement
Sign in to follow this  

Skinning Problem

This topic is 1832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have some problems with skinning. So, here are the steps i have done to perform skinning.

Export:
- 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)

CPU:
- 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

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?

Edited by princezahee

Share this post


Link to post
Share on other sites
Advertisement

I might be completely off, but these are things that seem dubious to me:

1. Is it necessary to multiply bone matrix with bone offset matrix? I would probably simply multiply with offset matrix assuming that before passing to glsl it is already multiplied with parent offset matrix (that is in turn multiplied with its parent offset matrix and so on).

2. Is that the sum of aVertexWeights 0 to 1 guaranteed to be 1.0? If not, maybe divide finalVertex with sum of aVertexWeights.

Share this post


Link to post
Share on other sites

Perhaps if you posted a picture of the broken model…

You would also be doing yourself a favor by posting in the appropriate section.  More people familiar with OpenGL will see your topic and be able to help.

 

 

L. Spiro

Edited by L. Spiro

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement