Help with DirectX Export Script--we may have found a problem

Hiya Blender Family,

My Planet Postmoderna Team has struggled with this Direct X export for some time now. We have not been able to get the file to export with the textures. Someone on our team may have found the problem but we don’t know how to fix it.

Can someone with experience in Python Scripting take a look at this file. Is it possible that the reference to exporting the texture is in the wrong place (eg after the close tag)?

In the ideal, it would be nice if it could confirm the locations of the referenced texture images. This way if you upload a DirectX file to a render location that uses a different directory format, you can change the file reference. Does that make sense?


Now, to backstep, I also could be wrong about this and could also be doing the export wrong. I am just kinda frustrated with trying to export a file into DirectX and not having the texture show. :slight_smile:


As far as I know there is no problem with how it exports the material map to the X file. Here is an example snippet from an X file I recently exported

Material Mat1 {
1.0; 1.0; 1.0; 1.0;;
1.0; 1.0; 1.0;;
0.0; 0.0; 0.0;;
TextureFilename { “”; }
} // End of Material
} //End of MeshMaterialList

UV map looks fine to me in 3DE viewer, and here is a screenshot of it in a game engine.


That is an awesome model. :slight_smile: Did you do that?

K, then there must be something wrong with they way we are mapping the models then exporting them. I see the code in your post does not reference the location of the textures. How does it know where to look? Sorry to sound so “noobish.” I am though in many ways. :slight_smile:

In AW where we are testing the models, there is a model directory and a textures directory and they are separate from each other. When we export from Blender, the file has no mention of the texture name, just numbers. Would you Geoff, mind writing a simple “how to” tutorial for a simple crate with an image texture that we could follow step-by-step. We will credit you for your help in the Dev Forums for our project. We have all been beating our heads against the wall about this.

This is the Crate .X file I exported from Blender.

Hi flapman

I am no expert on this either, just amateur Blender hacker :slight_smile: Yes model done from scratch in Blender my me, skin by Nigel Dickenson.

With regard to your question about how does it know where the texture is ?
Correct the X file doesnt have path information to the dds texture. So it is dependent on the application you are using downstream to view the model. For example in Deep Explorer, if you drop the texture dds file into the folder the X file is in it will display model with texture. My screen shot is from a 2nd world war flightsim “BoB2”, that has its own specific method, you feed the X file and a bunch of other information into a builder tool that takes all that info and spits out a binary bin file containing all the assorted information and the geometry data. One of the bits of data you feed the builder is an instruction as to where to look to find the “” file.

I suspect you are probably not doing much wrong in Blender, your problem probably lies downstream in whatever you are doing to the X file to import into game.

I would suggest you try this to keep things simple

  1. Dont use any diffuse colours, just map your entire model as a single UV texture map to a single dds image file.

  2. Export using Blender to an X file, drop the X file and the dds file into the same folder then view model using 3DE or Deep Explorer. If you can see the texture, your problem lies downstream in the game engine. If you cant see the texture you have done something wrong in Blender. If this is the case, post your Blend file, X file and DDS texture somewhere and I will see if I can tell you what is wrong


PS if you are looking for a tutorial on uv textures, here is a link to a ton of excellent ones from neil hirsig. there are 5 tutorials on uvmapping. Click on the link to videos

Hi Geoff,

Thanks for you help.

I did as you said and the same result. I have put the .blend, the .x and the texture file (which is actually just a basic JPEG) in a Zip file. See the link. Perhaps you can help me figure this out.

Even in Deep Explorer it did not show up until I had to reattach the texture through Deep Explorer.

Hi Flapman

It was just one mouse click away from working :smiley:

you had not assigned the faces to the jpg texture you had selected. I could see that you had selected the jpg file in the uv mapping window but missed the next step.

I have uploaded a fixed version and a screenshot of where you need to click to assign the face to the image.

have 2 windows open 3dview and UV image editor. with the object selected go into edit mode and hit “A” to select all verts, then in uv window hit “A” to select all verts again. Now the important bit, hit the browse image (2 triangles icon) and select your filename. Now when you are in 3d window show texture mode you will see the texture appear This should now work when you export and view in Deep explorer.

I noticed you had assigned a material in your example, this isnt wrong but interestingly you dont even need to do that to make it work, so for my example I removed it.

Hope this helps


Thanks Geoff for doing this. I’ll take a look at this later.


The file worked great in a viewer but still no texture in Active Worlds. Very frustrating. I just can’t figure it out. lol. It is probably right under my nose.


Oh well at least one step nearer solving it. I have no idea what the workflow/tools are that take the X file as the input for your Active Worlds game engine. Is it a proprietary tool, or some conversion software you have written ?


Hey there. I wanted to let you know that the render issues had to do with the name of the rendered file texture. It was named *.JPG and need to be *.jpg. This is an issue with Linux file systems. Our files are stored on Linux.

Hiya Geoff,

I hope you are gearing up for a great New Year. I was wondering if you could answer this as well. Am I to assume that the only way to render textures in a Direct X file export from Blender is to build that model with UV textures only? In other words, I can’t generate them internally using Blender own materials and textures. So, I need to UV map images etc. only. Am I getting that right?

Thanks again for your help.


Yes, the X file format can only export simple diffuse and specular colour information (assuming you are not using uv texture maps). If you want to do something fancy in Blender e.g. a procedural cloud type texture, you wont be able to export it out to an X file.

Regards Geoff