Results 1 to 2 of 2

Thread: skin/skeleton

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    20

    skin/skeleton

    I have been looking through the 'sampleImport' example and other various modules to export skin/skeleton/animation data.

    I've come up with the following code to access the skin(this was derived from some post on the forum) :

    int i, count = pDataBase->getElementCount(0, COLLADA_ELEMENT_LIBRARY_CONTROLLERS);
    for (i=0; i<count; i++)
    {
    daeElement* element = 0;
    pDataBase->getElement(&element, i, 0, COLLADA_ELEMENT_SKIN);
    domSkin* pSkin = daeSafeCast<domSkin>(element);

    if (domSkin)
    {
    domSkin* pSkin = daeSafeCast<domSkin>(element);
    domSkin::domVertex_weightsRef vertWeights = pSkin->getVertex_weights ();

    domSkin::domJointsRef joints = pSkin->getJoints ();
    }
    }

    This is seriously as far as I have gotten. I dont know how to go through the joints and am pretty tenuous on my next step. Ostensibly, it seems like the skeleton is accessed through the skin -- if this is the case and I have 2 skins associated with one skeleton will I get the same skeleton for each or will I have to merge skeletons?

    Also, Is this the recommended way to get skin/skeleton/animation data?
    Matt

  2. #2
    Member
    Join Date
    Feb 2005
    Location
    San Jose, CA
    Posts
    63
    The code is incorrect, these will get you started.
    int i, count = pDataBase->getElementCount(0, COLLADA_ELEMENT_SKIN
    );
    for (i=0; i<count; i++)
    {
    domSkin* pSkin= 0;
    pDataBase->getElement(&pSkin, i, 0, COLLADA_ELEMENT_SKIN);
    if (pSkin)
    {
    domSkin::domVertex_weightsRef vertWeights = pSkin->getVertex_weights ();
    domSkin::domJointsRef joints = pSkin->getJoints ();
    }
    }

    from <skin> -> <joints> you get joint name and their corresponding inverse bind matrix. These information tells you how your geometry bind your joints. It doesn't tell you where is the skeleton and initial position of the skeletong.

    You get your skeleton in <instance_controller> -> <skeleton>.
    These reference to a node where you will a tree of nodes with joints names.
    You will find the joints name in the nodes' id or sid. This tree of nodes is also where you find te inital position.

    Collada keep skin joints and skeleton separate so that you can bind them anyway you want.

    If you want 2 skins associate with one skeleton, then you just need 2 different <skin> with <joints> reference to the same names.
    You will still need 2 different <instance_controller>, but they will both have <skeleton>#node_for_skins</skeleton>

    For animation, you target node's transforms in node_for_skins and it's children nodes, Not the <skin> nor <instance_controller>. You will see 2 figures when you have <instance_controller> on the same <skeleton>#node_for_skins</skeleton>. Since both <instance_controller> reference to same <skeleton>, your animation on node_for_skins will influence both figures.

    In other word, if you have two skin (one fat and one thin) on the same <skeleton>, you will see both fat and thin figure will jump the same way at the same time. If this is not what you want to do, let me know.

    Thanks,
    Herbert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •