Mobile Zone is brought to you in partnership with:

I'm a Jack of all traders but first and foremost a Community Developer and Teacher. I love to rip apart and discover new things and technologies, then break them down and show others how to as well. Father of 4 and maybe just a bit mad as well, I have Monty Python to thank for that. Simon is a DZone MVB and is not an employee of DZone and has posted 73 posts at DZone. You can read more from them at their website. View Full User Profile

Converting DirectX .X Files for Use in Games

11.09.2012
| 3902 views |
  • submit to reddit

What do you do if you have assets in Microsoft’s DirectX X .X format and you want to use them with Unity? You'd have no problems with XNA, but Unity doesn't like .X one bit.


What formats DOES Unity support

Amazingly Unity has an astounding amount of support for 3D model formats, including:

image


Road to conversion

Now quite surprisingly converting models FROM .X is quite difficult, want a package to SAVE in .X format no problem, but Import!, that’s a one way trip to the funny farm.

After a few hours of searching and installing tools I eventually came across a solution that not only worked, it was also FREE.

image

LithUnwrap is primarily a tool for mapping and editing the UV coordinates of low poly models, but it can also read and write models from one format to another.

It supports Importing & exporting LWO, OBJ, DXF, 3DS, ASC, COB, and X files.

So after launching up LithUnwrapyou can open up a model file:

image

Once loaded we can simply then save the model to which ever format we want to use, I’ve no particular preference but I generally use OBJ files as they are more commonly supported by other tools, but if you are using Unity and have access to 3D Studio Max (or have a modeler who does) then you can just export to .3DS which Unity also supports:

image

Just be sure to use the “Model –> Save” options, the export options are for other things.

*Note

I could not confirm (just because I didn’t have any assets to test with) if LithUnwrap will also convert / save all the features of a model such as Animations, Bones.  It does support Meshes and Textures (including the ability to UnWrap / change the UV mapping of a model) but you should check if you have Animations or Bones in your model if they are also exported.  Granted if you have no other option you might just have to live with it and re-create them in your tool of choice


What didn’t work?

In my journey i followed many posts and hints of ways i could convert .X files, here why most of them didn’t work:

  • Milkshape – Was free to TRY and could read .X files. But doesn’t allow saving in the trial.  Granted it wasn’t much and you may want to buy Milkshape if you wish
  • TrueSpace3D – Truespace was made free several years back after Microsoft bought them, can be tricky to find but its a great Free 3D tool.  However it cannot import .X files no matter what people say! (<Download Link>)
  • Online / downloadable model converters – looked at several but ALL require purchase, anything from $100 to $$$$, seems it’s a very hot market.
  • 3DS Max / Maya – I found hints that these big boy tools may be able to read .X files but couldn’t confirm (plus Autodesk’s site wasn’t working when I tried to check)
  • ModDb.com had some great tools (like xconv) but they generally only convert into 1 format or another, usually for specific Game engines like Modern Warfare
  • Blender is a great and FREE 3D modelling tool, however it can only Export .X files.  I think it did Import .X files at one point but such things have been lost to the past (I went back as far as version 2.49b but no luck)

Published at DZone with permission of Simon Jackson, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)