Suppose you've made a really cool object in Gmax and now you want to load it into your XNA Game project. But the "save" button in Gmax only lets you save it as a ".Gmax" file! And XNA requires that all of your 3D mesh files be in Autodesk's FBX format. Here are my instructions for exporting an object from Gmax as an .OBJ file, and then converting it to .FBX file so that it can be loaded in a Microsoft XNA program. Enjoy!
PART1: DOWNLOAD AND INSTALL THE EXPORT AND CONVERT SOFTWARE
==========================================================
First, download these two export script tools:
Go to this web page "http://www.xzzy.org/halo/gmax_render/"
1) Download these 2 files:
a) On that web page, scroll down a little and you will see this link: "http://xzzy.org/halo/gmax_render/GMaxSLGRAB.zip". Click it to download the file 'GMaxSLGRAB.zip'
b) Scroll down a little more and you will see this link: "Xzzy's .OBJ Tool - A simple maxscript...". Click it to download the file 'xzzy_obj_tool.ms'
2) Go to Autodesk's web site and download the latest version of the free FBX Standalone Converter Utility.
Get either the 32bit or 64bit version depending on your OS.
a) Here's the link for downloading the utility: http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775855
b) Here's a link to the PDF help file for the utility: http://images.autodesk.com/adsk/files/fbx_2011_2_converter.pdf
3) Install the Autodesk FBX Converter utility.
PART2: EXPORT SOMETHIN'
========================
1) Copy the GMax script file "xzzy_obj_tool.ms" to this Gmax directory: "C:\gmax\scripts".
2) Start Gmax.
3) Create a teapot object to export.
a) Click the "Teapot" button.
b) Check the "Generate Mapping Coords" check box at the very bottom, below the Teapot button.
c) Drag in any window to create the Teapot object.
d) Right-click on the Teapot object and select "Convert to editable mesh" in the pop-up menu.
4) Outside of Gmax, run the program "GMaxSLGRAB.exe". A little window will pop-up containing a "Grab" button.
5) Back in Gmax, select Gmax menu "MAXScript -> MaxScript Listener". A text window will open.
6) Select Gmax menu "MAXScript -> Run Script". Select the script file "xzzy_obj_tool.ms" and click OK.
7) In Gmax, select the "Utilites" tab. It's in the pannel on the right of your screen.
At the top of that panel, it's the "hammer" on the far right tab.
Under the Utilies tab, click the "MAXScript" button.
At the very bottom is the word "Utilies" with a text box below it.
Expand the text box and click "Obj Import/Export".
Clicking that will cause 2 more buttons to appear below that.
Click the "Export" button.
Alot of text will scroll by in the Listener window.
Wait for the text to stop scrolling (about 15 seconds for a Teapot).
8) Click the "Grab" button.
It will copy the text from the Listener window and prompt you to save the file.
Save the file to your desktop with the name "Teapot.obj".
9) Startup the Autodesk FBX Converter stand-alone utility.
In the utility, open your "teapot.obj" fle.
(Note: You can drag and drop your .Obj
file onto the FBX Converter program window to open the file.)
Make sure you convert it to "Binary" FBX format, not in Ascii format. See my note below.
Click the "convert" button and save your file as FBX format.
Russ' Note for step #9: In my experience, the Microsoft XNA game programming software **HATES** 3d files that are saved in FBX "ASCII" (Text) format. When you convert your Obj file, you must save it in FBX "Binary" format. If you try to load an FBX ASCII formatted 3D mesh file in your XNA game, the Visual-C# compiler crashes intermediately without any warnings when you hit F5 to run in debug mode! -- That's yet another reason to "save often" as you are writing your software program :-)