My maya x exporter bug

Started by
3 comments, last by coding penguin 17 years, 8 months ago
I've written an X exporter for Maya. All seems to be working fine except for one bug. My test mesh is just a skinned box bending back and forth. When my mesh has skinning and uses one material, everything is fine as shown below: Good However whenever I set any of the faces to another material, some other faces start moving as is they were attached somewhere else on the mesh: Bad In my x file, I have MeshMaterialList { 4; 60; 0, 0, 0, ... When I put all the face indices to the same material index, it works fine. But even if I just change one index, the faces will fly off. All the skin weights and everything else in the x file is the same. Any ideas or suggestions?
Advertisement
This template

MeshMaterialList {
4;
60;
0,
0,
0,


says you have 4 subsets in the mesh. Maybe this is a problem? Are all of the 60 attribute buffer elements set to 0 except 1 being set to 1?

How are you loading and rendering the mesh in your DirectX program?
--------------------------Most of what I know came from Frank D. Luna's DirectX books
I'm viewing the files in DirectX Viewer. My exporter sorts the face indices as well as the list of indices in MaterialList by material. Since this bug occurs with multiple materials, I tried a little experiment. If I don't sort the indices, I still get the bug. If I don't sort the face indices but leave the material mapping indices sorted, I don't get the bug, but my materials are on the wrong faces (obviously). However, if I manually open up the x file and simply reorder the material mapping indices to match their unsorted face indices, the bug returns. The played animation looks like the skin weights are changed. That piece flying off from the bottom of the mesh in the screenshot matches the joint animation of the top joint, it's just reversed. Are the material indices supposed to have an effect on skin weights?
I think I solved this problem. I guess DirectX likes data ordered a certain way. So I had to sort all my other data (vertices, normals, tangents, etc.) by material in order to preserve the unsorted order of the vertex indices.
you got nice site!

This topic is closed to new replies.

Advertisement