DirectX export not working?

I’ve made a couple simple models in Blender; thinking of using it to make all the models for a game I’m working on. So I load the .blend files for these models and do:
File - Export - DirectX - Only mesh data
and save them.

However, when I try and load either of these .x files into the “Mesh Viewer” utility that comes with the DirectX sdk, I get an error saying it was unable to load the file. Also if I try loading them in a program using the sdk function D3DXLoadMeshFromX I get a similar error.

Do I need to do something special in blender for exporting .x models to work properly, or does blender just not export format correctly?

After messing with it more, it looks like it’s the Materials stuff thats causing problems somehow.

If I open the .x for cube with one texture mesh that I made, and delete the following pieces:

…just after header…

Material Material {
0.756191134453; 0.756191134453; 0.756191134453;1.0;;
0.5;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename {
none ;}
}

… and near the end …

MeshMaterialList {
1;
6;
0,
0,
0,
0,
0,
0;;
{Material}
}

… then the .x WILL open properly. However, it’s now an untextured cube. Additionally I don’t see the filename for the texture that I put on the cube anywhere inside the generated .x file anyways.

maybe if you rename the material so it’s not called “Material”?
DX might be getting confused…

Ok… I changed the name of the material and texture from the detault to something different. That by itself didn’t help. However looking at the .x file it genereated I still noticed that the “stone1.bmp” texture is still never listed in the file.

So I changed the spot below the header from this:

Material basicmat {
0.756191134453; 0.756191134453; 0.756191134453;1.0;;
0.5;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename {
none ;}
}

to this:

Material basicmat {
0.756191134453; 0.756191134453; 0.756191134453;1.0;;
0.5;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename {
“stone1.bmp” ;}
}

And now the mesh “does” load. However looking at it, I’m not seeing any texture coordinates in the .x file that was created, and as such the mesh appears textureless when viewed. I just used “Map Input” tab’s Object and Cube buttons.

This was using blender 2.33a…

I just downloaded 2.34, and now the meshes it exports using the “DirectX” format load correctly into other programs. However they are untextured, and if I open the .x file and look at it, I don’t see my “stone1.bmp” listed anywhere in the file.

have you tried with both directx and directx8 exporters?

The “DirectX8” one seems to generate invalid files that nothing else can open. If you open a file created from it, it doesn’t even seem to contain the vertices for the mesh.