View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

# 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.

3 replies to this topic

### #1princezahee  Members

Posted 15 January 2013 - 12:46 PM

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, 16 January 2013 - 10:53 PM.

### #2mrjones  Members

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.

### #3L. Spiro  Members

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.

### #4princezahee  Members

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.