Jump to content

  • Log In with Google      Sign In   
  • Create Account


Collada Skeleton Rendering


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.

  • You cannot reply to this topic
4 replies to this topic

#1 2rockon   Members   -  Reputation: 116

Like
0Likes
Like

Posted 09 July 2012 - 07:52 AM

Hi.

I am trying to write a Collada parser and renderer in C++ with OpenGL, and have got geometry and texturing working so far.

I have also wrote a parser for the skeleton in the Collada file, and want to render it in its static shape, before I go about and implement animation. Is this possible or will I need to parse the animation library as well? What do I need to do to convert collada's matrices into a form OpenGL will understand?

So far I have tried looping through the main bone, and through its children and drawing lines between all the positions, but my understanding is not too great on how each matrix in the Collada file relates to its parent and I end up with a mess of lines which I can make no sense of.

Looking forward to your suggestions.
2rockon

Sponsor:

#2 larspensjo   Members   -  Reputation: 1526

Like
0Likes
Like

Posted 09 July 2012 - 12:54 PM

I would recommend to use the Assimp library. It will do the Collada parsing for you. Eventually (for a commercial application), you would want to make your own file format.

To get an animation up and running is hard work. I documented some of my efforts at: http://ephenationopengl.blogspot.se/2012/06/doing-animations-in-opengl.html.
Current project: Ephenation.
Sharing OpenGL experiences: http://ephenationopengl.blogspot.com/

#3 Koehler   Members   -  Reputation: 228

Like
0Likes
Like

Posted 09 July 2012 - 01:18 PM

Typically a skeleton is represented as a heirarchy of transforms. Each matrix is multiplied by all parent transforms, back up to the root.

The point you want to draw for a joint is (0,0,0,1) transformed by that joint's transform multiplied by the multiplication of ALL of its parent transforms. You might need to reverse the order depending on how you've set up matrices.

So, for a bone with matrix X, You'd draw a line from (Parent of Parent of X)*(Parent of X)(0,0,0,1) to (Parent of parent of X)*(Parent of X)*X*(0,0,0,1)

#4 2rockon   Members   -  Reputation: 116

Like
0Likes
Like

Posted 10 July 2012 - 02:02 AM

I am actually parsing the Collada file into my own structure, which also has methods to read/write itself from the disk from a binary file format I have designed. I have so far got the scene, library_visual_scenes and library_visual_scenes parsed, which I believe would be enough to get a static skeleton to render.

If I had the 16 number matrix, for example from one of my own models:
[source lang="xml"]<matrix>0.9971483 0.07496392 -0.008701464 2.835394 -0.0749609 0.9971862 6.72192e-4 -0.2716522 0.00872737 -1.80052e-5 0.9999619 5.72205e-6 0 0 0 1</matrix>[/source]
which components make up position, rotation etc, is what is really confusing me, as I cannot seem to find what each component means, or how I can give it to OpenGL to simply draw.

Many Thanks
2rockon

#5 Ashaman73   Crossbones+   -  Reputation: 6881

Like
0Likes
Like

Posted 10 July 2012 - 05:42 AM

The 16 number will form up a matrix like this:
[source lang="java"] 0 1 2 3 4 5 6 7 8 9 10 1112 13 14 15[/source]
(3,7,11) will be the position vector.

(0 1 2)
(4 5 6)
(8 9 10)
the rotation matrix.

(0 4 8) the right vector
(1 5 9) the up vector
(2 6 10) the look at vector




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.



PARTNERS