Hi all,
I’m attempting to implement a simple skeletal animation system with data drawn from collada files.
I feel I must be missing something, because I’m having a hard time matching the geometry data to the per-vertex weights and joint indices.
As I understand it, the layout of geometry data in a collada file is more or less the following (for a model with only normals and positions):
positions array: [0, 1, 0, 0.7 …]
normals array: [0, 1, 0.9, 0.8 …]
indices: <p>[0, 0, 1, 0, 0, 3]</p>
where, for example, [0, 0] represents the first vertex of the model, with position (0, 1, 0) and normal (0, 1, 0.9).
If I’ve got this right, it seems obvious that a model should be composed of length(indices) / number_of_vertex_attributes
vertices.
//
Separately, I understand the joint weights and indices to be stored in a <vertex_weights> node with a layout like this:
<vcount>1, 2, 1</vcount>
<v>3, 0, 3, 1 3, 2 …</v>
where each element i
in vcount
indicates the number of bones that influence that vertex i
.
Again, if I’ve got this right, it would seem that the number of elements in vcount
should equal length(indices) / number_of_vertex_attributes
– but in my case, it does not.
I’m pretty sure there aren’t any parse issues going on, because all of the relevant count attributes in the collada source match up to my array lengths – there must be a conceptual thing I’m misunderstanding.
So what am I missing here?
Thanks in advance for any help!
Edit: Also, if I ignore the joint info and just render the geometry, all is well – so I think the file parsing is ok.