• Advertisement
Sign in to follow this  

How to map the standard biped names to the standard bvh names?

This topic is 734 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

After the mapping, none of them are matched.
I think the standard bvh names don't match the standard biped names from 3ds max.
I don't want the manually change the biped name every time a new character is created.
I want to use the defaults.

Why does the standard bvh file have some designated names that the biped doesn't understand?

e.g:

Biped Vs BVH

Bip001_Pelvis Vs Hips
 

void Map_BVH_To_Mesh(CMesh* mesh, std::vector<Joint*>& skeleton) {

    FRAME* root = (FRAME*)mesh->GetFrameRoot();

    for (auto& b : skeleton) {        
        FRAME* f = (FRAME*)D3DXFrameFind(root, b->name.c_str());
        if (f)
            mesh->m_BoneMap.insert(std::make_pair(*f, b));
    }

    
}
Edited by lucky6969b

Share this post


Link to post
Share on other sites
Advertisement

Hello,
I decided to create my own map for the bones.
Cannot match some of the bones.
But I don't know how to map the spines between the two.

Bip001_Pelvis:Hips
Bip001_Spine:
Bip001_Spine1:Chest
Bip001_Spine2:Chest2
Bip001_Spine3:Chest3
Should I map the Hips of the bvh to the Bip001_Spine of the biped or what?
 

Share this post


Link to post
Share on other sites

Hello,
Here comes another question.
You may assume the mapping is successful.
But the bones have some combined transformations like in a range of a few units.
But the bvh is in hundredths.
I know there is some scaling problem.
But It's hard to predefine which scale the mesh and the bvh are going to match.
I've seen the library which called Smartbody, when some users have problems with their meshes,
they're always associated with scaling problem.
What is the easiest way to match up the bvh scale to the mesh scale?
Thanks
Jack

Share this post


Link to post
Share on other sites

Another option

is to tweak the keyframes in prebaked mode.

Like there is a reaching animation.

You know, it doesn't necessarily match where the target is.

Although it can be helped with the IK subsystem, some motions can still get really exaggerated

even though IK comes to help.

 

Update:

I've just forgotten lately, one of the guys in here said that all objects including characters should be modelled at the scale of 1

Any ideas?

 

Update:

Are there ways of normalizing both the mesh and the bvh data?

Edited by lucky6969b

Share this post


Link to post
Share on other sites

Hello,

Currently,

I am using this project

 

http://cgg.mff.cuni.cz/~semancik/research/wxmv/

 

And I just steal the rotation of the bvh and keep the translation and scale of the original transformation matrix.

Here comes the result, it looks just like a monkey.

void RenderMesh(const CMesh& mesh, const Shot& shot, float time, float scale) {

    

    FRAME* frame = (FRAME*)mesh.GetFrameRoot();



    stdext::hash_map<FRAME, Joint*, FrameHasher> boneMap = mesh.m_BoneMap;



    D3DXMATRIX iden;

    // sets to identity first, so that it has a reference frame

    d3d::m_pDevice->SetTransform(D3DTS_WORLD, D3DXMatrixIdentity(&iden));



    // local or world?

    shot.skeleton->Evaluate(shot.motion, time, zero_vector, identity_quaternion,

        &Joint::world_position);



    

    



    for (auto& b : boneMap)

    {        

        if (b.second && b.second->parent)

        {

            // world rotation

            const Vector& parent_position = b.second->parent->world_position;

            const Vector& position = b.second->world_position;

            



            D3DXMATRIX matRot;

            D3DXMatrixIdentity(&matRot);

            

            if (position != parent_position)

            {

                double d, x_rot, y_rot;



                const Vector& p1 = parent_position;

                const Vector& p2 = position;



                Vector v = p2 - p1;

                v.polar(d, x_rot, y_rot);



                // transform        

                D3DXMATRIX RotY, RotX;

                //D3DXMatrixTranslation(&matTrans, p1.x, p1.y, p1.z);



                D3DXMatrixRotationY(&RotY, y_rot);

                D3DXMatrixRotationX(&RotX, x_rot);



                matRot = RotY * RotX;// *matTrans;



                //D3DXMatrixInverse(&matRot, NULL, &matRot);





            }

            FRAME* f = (FRAME*)D3DXFrameFind(frame, b.first.Name);



            D3DXMATRIX matTrans;

            D3DXMATRIX matScale;

            // check

            D3DXMATRIX matRot2;

            D3DXMatrixIdentity(&matTrans);

            D3DXMatrixIdentity(&matScale);

            D3DXMatrixIdentity(&matRot2);

            D3DXMATRIX& TransformationMatrix = f->TransformationMatrix;



            D3DXVECTOR3 pos, scale;

            D3DXQUATERNION quat;

            D3DXMatrixDecompose(&scale, &quat, &pos, &TransformationMatrix);





            D3DXMatrixTranslation(&matTrans, pos.x, pos.y, pos.z);

            D3DXMatrixScaling(&matScale, scale.x, scale.y, scale.z);

            D3DXMatrixRotationQuaternion(&matRot2, &quat);



            D3DXMATRIX finalMat = matScale * matRot * matTrans;            



            // if this is the case, I have to scale the mesh

            // otherwise, scale the bvh

            f->TransformationMatrix = finalMat;

        }



        

    }



    



    UpdateFrame(frame, &iden);



    // render all frames

    RenderFrame(frame);

}

[attachment=30317:2016-01-18 14_12_34-TestSB.png]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement