walbourn/directxtkmodelviewer

application crashed when loading D3D11 sample's .sdkmesh

StanwieCB opened this issue · 4 comments

I was trying to view the raw geometry of D3D11's MultithreadedRendering11 sample by loading

DirectXSamples\MultithreadedRendering11\Media\SquidRoom\SquidRoom.sdkmesh

and the model viewer crashed.

I've also tried some other sample's .sdkmesh file and it threw errors as well.

So does it mean that the model view only supports single-mesh .sdkmesh file?

Many thanks!

If you run the Debug build, you'll see the following output:

D3D11 ERROR: ID3D11Device::CreateInputLayout: The provided input signature expects to read an element with SemanticName/Index: 'NORMAL'/0, but the declaration doesn't provide a matching name. [ STATE_CREATION ERROR #163: CREATEINPUTLAYOUT_MISSINGELEMENT]

If you run sdkmeshdump.cpp on that model, you'll see it uses a compressed NORMAL format of:

NORMAL", 0, *D3DDECLTYPE_DEC3N*, 0, 12

Which his not technically supported by DXGI.

That sample treats that as DXGI_FORMAT_R10G10B10A2_UNORM which is not technically valid because it really should be DXGI_FORMAT_R10G10B10A2_SNORM which is not defined.

As a hack, you could make DirectXTK treat D3DDECLTYPE_DEC3N as DXGI_FORMAT_R10G10B10A2_UNORM but the result is questionable.

If you do make this hack assumption, it still fails to load looking for a non-existent DDS file 'default' names that was put in there by an older exporter:

  • default.dds
  • default-normalmap.dds

If you provide some kind of files for those, it will load.

See the pull request for DX11 and DX12

Try out the latest release. You'll still need to provide some kind of default.dds and default-normalmap.dds for that model.