locked
Question about loading skinned model with DirectXTK

    Question

  • Hello,

    I recently have an issue of loading skinned model with DirectXTK. I made a simple hand model and applied a bone system using skin modifier for it in 3DS MAX 2014. I exported it using the recommend setting for the fbx file. Then I replace the default ps shader, vs shader, input layout, render target view with my own shaders and render target view and the input vertex layout I am using the following:

    const D3D11_INPUT_ELEMENT_DESC layout[] =
    {
    	{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "TANGENT", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "BLENDINDICES", 0, DXGI_FORMAT_R8G8B8A8_UINT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    	{ "BLENDWEIGHT", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
    };

    However, I can read any information about blendindices and blendweight on GPU even though the fbx file contains all these information. I don't know whether it's modeling problem or the way to load skinned model with DirectXTK. I stuck by this problem for days.

    So, could any one tell me how to get the data of blendindices and blendweight on GPU correctly? Thanks a lot!

    ZH



    Sunday, June 29, 2014 4:30 PM

Answers

  • Firstly, are you using the latest version of DirectX Tool Kit?

    Are you exporting to CMO via the Visual Studio content pipeline, or using the DirectX SDK Samples Content Exporter to SDKMESH?

    Remember that you have to use a specific input layout. For SDKMESH, you'll need to match whatever was used to export the SDKMESH file.  For CMO, it is exported as two vertex buffers, but for simplicity the DirectX Tool Kit loader converts it into a single VB with a specific input layout - VertexPositionNormalTangentColorTextureSkinning.

    Your input layout looks very *close* to VertexPositionNormalTangentColorTextureSkinning but you have to use "SV_Position" and not "POSITION".

    Monday, June 30, 2014 12:13 AM