Sign in to follow this  

COLLADA vs. skinning solved: Using better exporter

Recommended Posts

I need help witch collada matrices... I've already read collada 1.5 specification but I am still confused about matrices I have fully functional directX importer but it has some glitches in parsing (my code/my glitch) so I decided to move to XML -> COLLADA Ive successfully imported skeleton structure and weights for vertexes but I am not sure which matrix I should use for skeleton parent-relative and global-absolute matrix I think that translation/rotation/scale in skeleton structure are relative to parent joint (library_visual_scenes/visual_scene/node) so here are parent-relative matrices there is also matrix array in library_controllers/controller/skin/bind_shape_matrix but this is mainly identity matrix so I think its global model T/R/S and array in library_controllers/controller/skin/source[0]/Name_array which contain names of bones and library_controllers/controller/skin/source[1]/float_array containing matrices which I taught was absolute matrices of global joint translate rotate scale But I got some crazy position of bones If I multiply root bone's matrix of library_visual_scenes/visual_scene/node and root bone's matrix of library_controllers/controller/skin/source[1]/float_array I don't get identity matrix (matrices are from file in reference pose) so there must be some other way to achieve these matrices. Maybe they are inverse or transposed or I don't know what. Is here anyone who work with COLLADA and can help me with this... THX [Edited by - SaTANO on March 24, 2010 3:10:39 PM]

Share this post

Link to post
Share on other sites
thx Buckeye
I checked that link but no clue there
From what I know so far I was able to do it but in sort of difficult way
I can get offset matrices from

<controller id="Armature-skin" name="Armature">
<skin source="#Cube-mesh">
<bind_shape_matrix>1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</bind_shape_matrix>
<source id="Armature-skin-bind_poses">
<float_array id="Armature-skin-bind_poses-array" count="48">

I get offset matrix if I multiply <bind_shape_matrix> with matrix from <source><float_array>

but I cannot find parent-relative matrices (TRS from library_visual_scenes are weird or wrong because it looks like they are translated in object space but rotated in world space maybe they are for animation offset M or something like that) so I generated them using my function and it works now...

Well I am still curious about it so if someone work with collada I'll be glad to know how to obtain those matrices from file

Share this post

Link to post
Share on other sites
Have you already read this article: Skinning with COLLADA?

I tried once to integrate COLLADA in my engine but I gave up. The COLLADA specifications look great and it could be beneficial to use an open standard, but the devil is in the details. All of the tools I tried to use were terribly outdated. The Asset Manager didn't work, the Refinery is buggy, the most exporters still use COLLADA 1.4. The Blender COLLADA plug-in is lacking a lot of functions.

Because my 3D meshes looked good in XNA I decided to use the FBX format for my CPP projects too. It worked well.

Share this post

Link to post
Share on other sites
The transformations from all the nodes are that entries you are looking for. Collect all animation channels which affect one of the transformation entries of one node. Then step through them, apply their animated values to the target transform and resolve the whole transformation chain to get a resulting transformation. This transformation replaces the node's original transformation.

May I recommend the Open Asset Import Library to you? I wrote the Collada loader for it, and to my knowledge it handles most collada node animations correctly. It also loads DirectX .x files, 20+ other file formats, and it slowly learns to load FBX files as we speak.

Bye, Thomas

Share this post

Link to post
Share on other sites
I finally got some time to spent on Collada exporter and I was finally able to animate my model but later I found problems with exporter in blender because it has too many bugs (sometimes bones but more often weights were not exported) so I decide to move to another format.
I found ogre xml mesh exporter. I am able to parse everything but I am not sure about skeleton rotation (same for animation rotations).
It is exported as angle for rotation node and x,y,z for axis node.

First I thought its direct quaternion but when I build matrix from this quat the matrix is wrong (exported root bone with only 180 degree in Z has bad matrix)
When I look into python script of exporter (Blender) I found that angle is from normalized quat (quat angle) and x,y,z are also from matrix quaternion (quat axis) so I am confused about it.

It is exporter for OGRE so it use its own parser so I am not sure if I can find specification anywhere

Any help?


I just tried blender console to get quat for this root bone and now got this:

<rotation angle="3.141593">
<axis x="-0.000001" y="-0.000000" z="1.000000"/>

and this is quaternion from Blender
[0, 0, 0.707107, -0,707107]

So I used Axis angle to quaternion conversion but no luck here
It looks like its kind of rotated in exporter by default


sorry for spamming but problem solved

it was caused by fix to Y in exporter and now I got it all correct

So if anyone is interested in OGRE mesh exporter I can help ;)

[Edited by - SaTANO on March 24, 2010 3:34:59 PM]

Share this post

Link to post
Share on other sites
Thats not very encouraging for me... i have been heavily researching this as i am likely to implement skinning and animation soon.

Everytime I hear about someone trying to use collada i hear it's a huge pain.

but can it really be that bad?

It's xml based, so you just need to grab an xml parser and figure out the structure right?
The structure must be really complicated?

Share this post

Link to post
Share on other sites
Well COLLADA isn't that bad, actually it has a lot of features...
Real problem is fully functional exporter
For some reason I was unable to find exporter which was able to export weights for skeleton correctly (don't know where could be problem) so I tried OGRE's mesh
exporter which is great for my implementation (4 bones / animation sets / weights assignment) and is also XML based

In COLLADA you should be able to parse important data to your project in several hours (mesh + UV + weights isn't big deal but skeleton is more difficult/in specification I didn't find what exactly was exported)

If you can find good exporter you won...
I think XSI MOD Tool has good one, but export a lot of unnecessary garbage so you will have to optimize it (but MOD tool is windows only :( )

Share this post

Link to post
Share on other sites

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