Sign in to follow this  

Collada animation data

This topic is 3111 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'm working on a collada loader/converter and have muddled my way through loading the mesh data and now need to figure out animation data. But i'm pretty much completely lost. My first problem pops up when saving a .dae with animation from Max. I get a warning that i'm not sure what to make of: -Warning: link Bone01's mode is not supported. It will be treated as mode eTOTAL1. -Warning: link Bone02's mode is not supported. It will be treated as mode eTOTAL1. I'm not sure what Bone01's mode is or whether or not i should care if it's treated as eTOTAL1. Anyone know what this means, whether i need to fix it, and if so how? My second problem is actually looking at the document. The animation data is, to say the least, confusing. The data i need for an animated model should be: a list of bones a list of vertices each bones affects and how much it affects them which should total 1.0 for all bones a list of transformations for each bone and how long it takes correct? Is there anything else i need to take into account? I have no idea how to get that information though. Looking through to file i just cant wrap my head around how it's organized. Any hints? One of the first things i need to parse is
<vertex_weights count="16">
<input semantic="JOINT" offset="0" source="#Box01Controller-Joints"/>
<input semantic="WEIGHT" offset="1" source="#Box01Controller-Weights"/>
<vcount>1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2</vcount>
<v>
0 1 0 2 0 3 0 4 1 5 1 6 1 7 1 8 0 9 0 10 0 11 0 12 0 13 1 14 0 15 1 16 0 17 1 18 0 19 1 20
</v>
</vertex_weights>
I've not a clue what <vcount> is about. <v> seems to be bone/weight/bone/weight etc. And the weights to which it refers are easily found & parsed. But they're just the % to which a vertex is affected by the bone and i cant find which vertex its referring to. But that's just one problem. I'm really not sure where to go from here and any advice at all would be very appreciated. Edit: I forgot to mention, i'm using Collada Dom to load & navigate the files

Share this post


Link to post
Share on other sites
Well, first the number and order of the input tags is important:

<input semantic="JOINT" offset="0" source="#Box01Controller-Joints"/>
<input semantic="WEIGHT" offset="1" source="#Box01Controller-Weights"/>

This tells you, that each vertex data consists of a pair of indicies, a index of the joint and the index of an according weight.

Next you need to know if a vertex depends on one or more bones. This is encoded in the vcount-array. In your example vertex 1 to 12 depends on just one bone(=joint), the rest on two bones.

Well, with this knowledge you could decode the v-array in a sequential manner.

0 1 0 2 0 3 0 4 1 5 1 6 1 7 1 8 0 9 0 10 0 11 0 12 0 13 1 14 0 15 1 16 0 17 1 18 0 19 1 20
=> divide it into (joint,weight) pairs
(0 1) (0 2) (0 3) (0 4) (1 5) (1 6) (1 7) (1 8) (0 9) (0 10) (0 11) (0 12) (0 13) (1 14) (0 15) (1 16) (0 17) (1 18) (0 19) (1 20)
=> consider number of bone dependencies
[(0 1)] [(0 2)] [(0 3)] [(0 4)] [(1 5)] [(1 6)] [(1 7)] [(1 8)] [(0 9)] [(0 10)] [(0 11)] [(0 12)] [(0 13) (1 14)] [(0 15) (1 16)] [(0 17) (1 18)] [(0 19) (1 20)]

As you can see, you got 16 sets marked with [], for each vertex one(vertex count=16). These are all indicies, you have to look em up in the according joint/weight arrays to get the concret values. Take a look at the first and the last vertex.

The first vertex depends only on joint 0 and on weight 1, which will be 1.0. Whereas the last vertex depends on joint 0 and 1 with the according weights 19 and 20, which will sum up to 1.0.

Thats all ^^

--
Ashaman

Share this post


Link to post
Share on other sites
Quote:

-Warning: link Bone01's mode is not supported. It will be treated as mode eTOTAL1.
-Warning: link Bone02's mode is not supported. It will be treated as mode eTOTAL1.


Can't help you with that. Maybe ask the export plugin's developer?

[/quote]
One of the first things i need to parse is

<vertex_weights count="16">
<input semantic="JOINT" offset="0" source="#Box01Controller-Joints"/>
<input semantic="WEIGHT" offset="1" source="#Box01Controller-Weights"/>
<vcount>1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2</vcount>
<v>
0 1 0 2 0 3 0 4 1 5 1 6 1 7 1 8 0 9 0 10 0 11 0 12 0 13 1 14 0 15 1 16 0 17 1 18 0 19 1 20
</v>
</vertex_weights>
[/quote]

vcount tells you the number of bones affecting each vertex. The last four vertices are influences by 2 bones each, the other are only moved by a single bone.

v now tells you which bones affect each vertex. The JOINT semantic has offset 0, so the first number is always the bone index. The WEIGHT semantic has offset 1, so the second number is an index into the weights table. The v element holds a number of such index pairs for each vertex, with the count of pairs stated in the vcount element. Read it like this:

Vertex 1 is affected by 1 bone, namely bone 0 with the weight from weight_table[1]. Vertex 2 is affected by 1 bone, namely bone 0 with weight 2. And so on... Vertex 12 is influenced by 2 bones (see vcount), the first one being bone 0 with weight 13, the second one being bone 1 with weight 14.

HTH

Bye, Thomas

Share this post


Link to post
Share on other sites
If you are able to read C#, Remi from the Collada team (i suspect) did a good job on a parser, allthough it doesn't fully work as the specs say it should. Gives you a good indication though:

link

Share this post


Link to post
Share on other sites

This topic is 3111 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this