Sign in to follow this  

Skinned mesh incorrectly deformed when using multiple materials

Recommended Posts

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!


Share this post

Link to post
Share on other sites

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




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.

Edited by cdbfoster

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this