Jump to content

  • Log In with Google      Sign In   
  • Create Account

Num bones influence per vertex


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
2 replies to this topic

#1 belfegor   Crossbones+   -  Reputation: 2616

Like
0Likes
Like

Posted 02 March 2013 - 01:45 PM

I want to stay away from D3DX animation "module" so i am trying to write plugin for 3ds max to export skinned mesh to my own format.

I dumped some info  into text file to see how many bones is each vertex influenced:

 

...
VERT[19] BCNT: 1
    BINX: 32 Weight: 1.000000
VERT[20] BCNT: 1
    BINX: 32 Weight: 1.000000
VERT[21] BCNT: 1
    BINX: 32 Weight: 1.000000
VERT[22] BCNT: 1
    BINX: 32 Weight: 1.000000
VERT[23] BCNT: 1
    BINX: 32 Weight: 1.000000
VERT[24] BCNT: 2
    BINX: 31 Weight: 0.337000
    BINX: 32 Weight: 0.663000
VERT[25] BCNT: 2
    BINX: 31 Weight: 0.330000
    BINX: 32 Weight: 0.670000
VERT[26] BCNT: 2
    BINX: 31 Weight: 0.371000
    BINX: 32 Weight: 0.629000
...

 

Some vertex have influence by 1, some by 2 and some by 3 bones.

This is the problem since in HLSL shader i need to know how many bones have influence to correctly transform my vertex.

 

What is the common way for this?

 

Should i add another vertex element to be able to tell?

Something like:

D3DVERTEXELEMENT9 vertexElements[] =
    {
        { 0, 0,  D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION,     0 },
        { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,       0 },
        { 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     0 },
        { 0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT,      0 },
        { 0, 44, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL,     0 },
        { 0, 56, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 },
        { 0, 60, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT,  0 },
        { 0, 76, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     1 }, // put number of influence here
        D3DDECL_END()
    };

 

Thank you for your time.

 

 



Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 4356

Like
1Likes
Like

Posted 02 March 2013 - 02:18 PM

Most tutorials will use 4 weights. So if your vertex actually has only 1 weight, simply set other 3 to 0.



#3 belfegor   Crossbones+   -  Reputation: 2616

Like
0Likes
Like

Posted 02 March 2013 - 02:42 PM

Thank you. I'll try that.






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