Where to start with. I am implementing a project based on fbx sdk and directx 11, right now (for quite a while sadly) I have irritating problem with passing weights to shader. I try creating D3DXVECTOR4 with 4 floats and then pass it to vertex structure as with this description:
polygonLayout[5].SemanticName = "WEIGHTS";
polygonLayout[5].SemanticIndex = 0;
polygonLayout[5].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
polygonLayout[5].InputSlot = 0;
polygonLayout[5].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[5].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[5].InstanceDataStepRate = 0;
It clearly is the most basic way (at least for me), where optimization is not important for now. Vertex structure in hlsl looks like that:
struct VertexInputType
{
float4 position : POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0;
float hairLen : HAIRLENGTH;
int4 bonesID : BONES;
float4 weight : WEIGHTS;
};
Don't bother with other variables - they work. And here comes what bothers me: weights that are equal 1.0f are passed fine, but those <1.0f are messed up. I mean they get larger than 1.0f... like sometimes over 10000.0f... The question is not why, but how I can pass weights without having this problem. I know that I probably should use BLENDWEIGHT, however this gives me some error no matter what. I tried BLENDWEIGHT with rgba16 unorm format to be clear (but I guess my 16 bit data type was anyways wrong, so if I should use this, then how do I have to store weights other than in D3DXVECTOR4... or how to parse it to D3DXVECTOR4 correct?).
All in all, please give me a most straight forward answer, since it's my first directx project. I will surely provide additional information if this was not clear.