CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Brian Peek [MVP C#]

A compendium of random uselessness. Enjoy.

XNA and 3D Model Exporting

Here's an important safety tip that I wish I knew before the 4 hours I wasted on figuring it out.

When building a model in 3D Studio Max (or likely every other modeling package in the universe), and then exporting it to a DirectX .X file via the Pandasoft X file exporter or kilowatt X file exporter plugins, ensure that the model has no meshes named with a space or period (or likely other characters).  This will cause the XNA importer and DirectX Viewer (or likely every other .X file importer in the universe) to fail with a very informative error like "Parser error" with no further information.

We had a model that was working great.  My artist decided to tweak some things and add some new meshes, at which point the new version of the model stopped working.  At first we blamed it on the new parts that were added, then textures, then the exporter, then....who knows.

Finally, after exporting the original model as a .X and the new model as a .X and comparing, I found that the mesh names that had spaces in them were not being exported correctly.  One area would reference the name with an underscore, and another would have the actual space character.  Fixing the names in 3D Studio Max and then exporting again fixed everything.

Meh.

Cross-posted from BrianPeek.com.

 


Published Apr 12 2007, 08:50 PM by Brian Peek
Filed under: , ,

Comments

Raymond Lewallen said:

Awesome! I have no clue about anything you just said, but its great and refreshing to see new and diverse content here, even if I don't understand it!
# April 13, 2007 8:47 AM

Brian Peek said:

And I thought this first technical post would alienate everyone reading... ;)

# April 13, 2007 1:18 PM

Will said:

I have been meaning to check out XNA myself. I am also a modeler (using Lightwave). Thanks for the heads up.
# April 15, 2007 10:12 PM

eric said:

Great to know, i was haveing a similar problem in 3 differnet modeling aps becuase of something like this! If onlyi could get blender 3d to export to .x properly...
# May 13, 2007 3:29 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Brian Peek

For anyone who was following this blog at CodeBetter, please re-point your browsers and RSS readers to http://www.brianpeek.com/ . Thanks! Brian is a Microsoft C# MVP and a recognized .NET expert with over 6 years experience developing .NET solutions, and over 9 years of professional experience architecting and developing solutions using Microsoft technologies and platforms. Along with .NET and its associated languages, Brian is particularly skilled in the languages of C, C++ and assembly language for a variety of CPUs. He is also an expert in a variety of technologies including web development (ASP.NET, ASP, Javascript, HTML, XML, etc.), document imaging, GIS, graphics, game development, and hardware interfacing. Brian has a strong background in developing applications for the health-care industry, as well as developing solutions for portable devices, such as tablet PCs and PDAs. Along with Jonathan Goodyear, he co-authored the book "Debugging ASP.NET" published by New Riders. He is also a member of MSDN's Coding4Fun writing team, contributing articles on a monthly basis. Check out Devlicio.us!