Vertices - joint weights assignment/indexing question


#1

Hello guys,

this might be a duplication of another post, but I couldn’t find an answer that helps me understanding the solution to my questions yet.

In my model I have 1420 triangles, 740 positions and 1408 normals, resulting in 1260 vertices.
If for example <p> looks like this: “97 0 36 0 93 0 …”, it means that the first vertex is put together by the 97th position and 0th normal. A triangle then is put together by 3 following vertices, and so on.
When I don’t parse the normals at all, I get a result of 740 vertices, which fits to the amount of positions.
If I understood it the right way, the higher count of vertices is explained by smoothing groups.

Now comes my main problem when parsing the vertex weight.
The <vcount> node in <vertex_weights> describes how many <joint, weight> 2-tuples affect a vertex.
How does the parsing and indexing work the right way, if I have more vertices than vertex weights?
Do I have to index the first vertex weight with the first vertex (in this case 97th position, 0th normal) and also assign that vertex weight to every other vertex which uses the 97th position, but another normal?

A little test I did was dropping the normals, which gave me the result of 740 vertices (since there are only 740 positions), which matches to 740 vertex weights. I assigned the first <joint, weight> 2-tuple to the first vertex, the second pair to the second vertex etc.
Still there were errors in my skinning implementation, in the vertex - joint weight assignments. The foot and leg bones of an humanoid character were influencing vertices located at the head. In other animation viewers the file works fine.

Are there mistakes in the way I approach this and would you be so kind and give me a short explanation on the right way of assigning vertex-joint weights?

Kind regards :slight_smile:
Devdude


#2

“also assign that vertex weight to every other vertex which uses the 97th position, but another normal?”

Yes.

(If you want to weight other attributes, they must use the VERTEX group, and there must be one per vertex. Same for the other attributes.)

I don’t recall precise details of weighting off the top of my head, but the manual is crystal clear on these things. I recommend giving it a look-see.


#3

Awesome, thank you for your fast answer! I hope I’ll get the animation rolling soon :slight_smile:


#4

Hey it’s me again, I couldn’t solve my problem so far.
What I’m doing now creating vertex groups in relation to the position of a given vertices (since i have more vertices than weights).
Then I simply assign joint+weight 0 to vertex group 0, joint+weight 1 to vertex group 1 etc.
The indices should be right this way, or am I wrong?

global transformation matrix of a joint: parent local transformation matrix * local transformation matrix of a joint, starting with the root joint

For the deformation of the model I then calculate: new vertex = sum(((old vertex * bind shape matrix) * (invers bind matrix of a joint * global transformation matrix of a joint) * joint weight)

I appreciate any help! If you want me to provide any resources just hit me up :).


#5

The forums were offline yesterday. The most recent topic here is about animating the skin-controller. I can’t remember… I think it may require the weights to sum to 1. Or else they are supposed to be normalized. (If so, I don’t see why personally, since that limits your options. But COLLADA is like that in places. Probably to encourage interoperability.)