Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

Skinning Problem

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 princezahee   Members   -  Reputation: 120


Posted 15 January 2013 - 12:46 PM

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?

Edited by princezahee, 16 January 2013 - 10:53 PM.


#2 mrjones   Members   -  Reputation: 612


Posted 15 January 2013 - 02:01 PM

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.

#3 L. Spiro   Crossbones+   -  Reputation: 14391


Posted 15 January 2013 - 08:34 PM

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, 15 January 2013 - 08:35 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#4 princezahee   Members   -  Reputation: 120


Posted 16 January 2013 - 09:40 PM

***I have updated the thread***

Please view the thread and help me.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.