HLSL Skinning X models

Started by
0 comments, last by DXnut 18 years, 1 month ago
In the skinnedmesh SDK sample there is a comment that you can't use CloneMesh() (the stream declarator version) because it does something with the blend indices. The SDK sample uses CloneMeshFVF() instead and manually changes a semantics flag in the vertex declaration. I chose the CloneMesh() approach and after spending 2 hours, I almost got the model right (connected properly) but it is still slightly distorted. The neck stretches a little and so does the arm in animation. Rendering in fixed function mode works fine, so I believe the problem has something to do with the blend weights or blend indices. I would appreciate if anyone can shed some light on this. My vertices are non-FVF because I want to use normal mapping, so I'm not sure how I could use CloneMeshFVF() for this. Here's my vertex layout: float3 position, normal,tangent,binormal, float2 uv float4 blendweight,blendindices
Advertisement
The indices are always packed in one DWORD. In your shader they will come in as int4.

BTW, I am cloning the mesh after the ConvertToIndexedBlendedMesh call to put it in the order I want. I am not having any problems with this messing up the bone data in the vertex buffer.

I want it like this for a skinned mesh with a max of 3 bone influences (like the Tiny_4anim.x file):

struct vertex
{
D3DXVECTOR3 pos;
D3DXVECTOR3 normal;
D3DXVECTOR2 Tex;
float weights[2];
DWORD Indices;
}

Then the header for my vertex shader is:

OutputTexVS VS( float3 posL : POSITION0,
float3 normalL : NORMAL0,
float2 tex0: TEXCOORD0,
float2 weights : BLENDWEIGHT0,
int4 boneIndex : BLENDINDICES0)



[Edited by - DXnut on March 14, 2006 2:41:19 AM]
--------------------------Most of what I know came from Frank D. Luna's DirectX books

This topic is closed to new replies.

Advertisement