This is the c++ vertex structure:
//! Vertex with skinning info.
struct SkinnedVertex
{
XMFLOAT3 Pos;
XMFLOAT3 Normal;
XMFLOAT2 Tex;
XMFLOAT4 Tangent;
XMFLOAT3 Weights;
BYTE BoneIndices[4];
};
This is the HLSL structure:
//! Input vertex data.
struct SkinnedVertexIn
{
float3 PosL : POSITION;
float3 NormalL : NORMAL;
float2 Tex : TEXCOORD;
float4 TangentL : TANGENT;
float3 Weights : WEIGHTS;
uint4 BoneIndices : BONEINDICES;
};
And this is the input layout:
// Create the vertex input layout.
D3D11_INPUT_ELEMENT_DESC vertexDesc[6] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"TANGENT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 32, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"WEIGHTS", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 48, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"BONEINDICES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, 60, D3D11_INPUT_PER_VERTEX_DATA, 0}
};
// Create the input layout.
D3DX11_PASS_DESC passDesc;
mTech->GetPassByIndex(0)->GetDesc(&passDesc);
HR(gGame->GetD3D()->GetDevice()->CreateInputLayout(vertexDesc, 6, passDesc.pIAInputSignature,
passDesc.IAInputSignatureSize, &mInputLayout));
This is what it looks like in PIX:
As you can see the position, normal, texcoord and tangent are transfered correctly. But the weights and bone indices are totally wrong. I have no idea why and I have realised I won't be able to solve this on my own, I really appreciate any help. Also, it seems kinda weird that the tangent is shown as a float3 in PIX when it's acctually a float4.
If you need more information in order to help let me know. Thanks!