Skinned mesh incorrectly deformed when using multiple materials

Started by
1 comment, last by cdbfoster 10 years, 5 months ago

Hi there,

I am the developer of the DirectX .x exporter addon for Blender, and recently I've encountered an issue that I do not understand. On a simple skinned mesh in a .x file, when using more than one material index in the MeshMaterialList template, the mesh becomes deformed in a very weird way.

The mesh is simply a rhombus composed of two triangles stacked vertically, and contains two bones that each fully influence a tip and share 50% of the influence on the vertices in the middle. When using only one material in MeshMaterialList, or foregoing the MeshMaterialList template entirely, the mesh deforms correctly. When instructing the bottom triangle to use a different material than the top, the weird deformation occurs.

I've attached two versions of the .x file: one with only one material, and the other with two. I test the files I export against the DirectX Viewer.

Can anyone tell if these files are malformed in some way? I don't really understand this problem.

Thanks for any insight!

Chris

Advertisement

Looks OK in my mesh viewer and AssimpView, so the file is fine.

What viewer are you using? The old DirectX viewer had some quirks, maybe that's one of them.

Oh really? Yikes! So, it doesn't look like this for you?

5y9TieO.png

If not, can you recommend a better, more up-to-date .x file viewer that would be safe to test my exports against?

Thanks a lot for looking into this!

Edit: You mentioned "your" viewer -- might it be prudent to write my own? Unless there's one out there that could provide helpful diagnostics on malformed files, or something. I've basically written this whole exporter via trial and error testing against the old viewer (and the occasional spec docs).

Edit 2: If you reverse the material indices such that the first face uses material 0 and the second uses material 1, the DirectX Viewer renders the file correctly... Perhaps all faces that belong to the first material must be listed first, and then the second, and so on..? A trivial fix if that's the case, but what a weird bug.

This topic is closed to new replies.

Advertisement