Jump to content
  • Advertisement
Sign in to follow this  
kaifeng

About VS skin

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

I am working on VS skin, and there have 8 weight vertex. and in client the struct like this: struct ModelInfluence { enum { _MAX_INFLUENCE_NUMBER = 8 }; _dword mBoneID; _float mWeight; }; the memory for every vertex like this: 1 Vector3( position ), 8 ModelInfluence. Let VS to know those is hard... For now, I do that in this way. D3D code: geometry.mVertexDeclaration->AddVertexElement( 1, 0, IVertexDeclaration::_TYPE_FLOAT3, IVertexDeclaration::_USAGE_TEXCOORD, 4 ); geometry.mVertexDeclaration->AddVertexElement( 1, 12, IVertexDeclaration::_TYPE_SHORT2, IVertexDeclaration::_USAGE_TEXCOORD, 5 ); geometry.mVertexDeclaration->AddVertexElement( 1, 16, IVertexDeclaration::_TYPE_FLOAT1, IVertexDeclaration::_USAGE_TEXCOORD, 6 ); geometry.mVertexDeclaration->AddVertexElement( 1, 20, IVertexDeclaration::_TYPE_SHORT2, IVertexDeclaration::_USAGE_TEXCOORD, 7 ); geometry.mVertexDeclaration->AddVertexElement( 1, 24, IVertexDeclaration::_TYPE_FLOAT1, IVertexDeclaration::_USAGE_TEXCOORD, 8 ); VS interface: float3 oripos : TEXCOORD4, float4 blendindex0 : TEXCOORD5, float4 blendweight0 : TEXCOORD6, float4 blendindex1 : TEXCOORD7, float4 blendweight1 : TEXCOORD8 Is there a better way to give VS those paramater? Please Help, Thanks a lot

Share this post


Link to post
Share on other sites
Advertisement
I pass 4 boneids as a D3DCOLOR (UBYTE4 isn't supported on some early nVidia hardware).

I then pass 0, 1, 2, or 3 weights depending on the number of influences needed on a mesh. This can be float1-float3, another D3DCOLOR, whatever. You don't need all that much precision.

Lets assume the standard 4 influences.
Weight4 = 1 - weight.x - weight.y - weight.z
or
w4 = 1 - dot(weight.xyz, float3(1,1,1));

Even when using a D3DCOLOR, and we have space for 4 weights, I calculate the 4th to ensure no conversion error has left some weight out of the calculation. If a vertex was influenced by only 2 bones, I ensure I set the boneid of the remaining 2 unused influences to one of the boneids that the vertex is already using. This ensures that the possible conversion error weight is just added to bones that should be influencing this vertex.

Most models can be accurately done by a good artist with 2 influences. A few need 3. 4 is overkill. If your artists claim they need 8 influences you need to find new artists!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!