This article is similar to the last one (How to export .X files from 3DS Max for use in XNA
), but this time we are going to export a 3D Model from 3DS Max as a Collada (.dae) file. Most tips are similar, just the output file (Cactus.dae) is different and the engine we will be using is DungeonQuestGDC or the "Skeletal Bone Animation and Skinning with Collada Models in XNA" engine (I will write another article about that in a bit), which support Collada model files.
As I just said, parts of this article will be similar to the last one: First of all you (or your graphic artist) need a version of 3DS Max, I recommend the most recent available version (e.g. Max 2008 has much better support for .DDS files and makes the exporting process way easier). If you do not have 3DS Max, you can test it for 30 days, that should be enough for testing and exporting some existing 3D Models ^^
You will need the ColladaMax Exporter for your Max version, you can find all versions and downloads at the http://www.feelingsoftware.com/
website, more specific information can be found at: http://www.feelingsoftware.com/content/view/65/79/lang,en/
. You can register on the site and then download the ColladaMax plugin for 3DS Max for free there.
Similar as discussed in the last article you have to make sure that each mesh that you export has a shader material assigned to it and in order to work correctly with your XNA Graphic engine it must be a shader that is supported by the engine like ParallaxMapping.fx, NormalMapping.fx or some other test shader.
Lets go through all the steps. Please note that experienced 3DS Max users will probably only need the ColladaMax Exporter and figure the rest out themselves. This tutorial is for beginners and people having trouble getting 3D Models exported for the XNA Graphic Engine in DungeonQuestGDC or SkinningColladaModelsInXna (or similar engines). See http://XnaProjects.net
for more details and downloads of these projects!
Step 1: Load the Cactus.max (312 KB)
model as an example. If you put the used texture Cactus.dds (170.8 KB)
in the same directory you should see the following result:
Step 2: In case you can't see the model, also make sure the used Shader (NormalMapping.fx (10.99 KB, for 3ds Max)
for this model, make sure you have a NormalMapping.fx in your XNA Graphic engine) and all other required files exist in the same directory; like the normal map texture CactusNormal.dds (341.47 KB)
If you want to change an existing 3D model and let it use a shader, open up the Material Editor in 3DS Max (e.g. by using the M hotkey) and create a new DirectX shader material. To do that click on a free material spot, click Standard (1.) and then select DirectX Shader (2.), now select the shader you want to use and fill in all the required shader parameters (colors, textures, etc.).
Step 3: Now export the 3D Model as an Collada (.dae) file via the ColladaMax Exporter
mentioned above. Make sure settings are similar as follows, basically just activate everything. In case you have animation data in your 3D Model you can also activate the Export Animation checkbox. Multiple animations or the so called Animation Clips do not work very well, so I usually export all the frames and then add some extra animation tracks into an extra .xml file. Anyway, our model does not have any animation and in this case it is much easier both to export and to test.
Step 4: Now you should have the Cactus.DAE (38.95 KB)
model file. Unlike previous projects I do not use the XNA Content pipeline for Collada models, I just create a /Models directory and put all the models in there. The textures are stored in /Textures/Models and finally the Shaders go in the /Shaders directory. Thanks to the fact that we do not use the XNA Content pipeline we can keep the game application running while exchanging 3D models and loading them again and again to make improvements, which is cool :)
Step 5: Now with everything in place it is time to test if we can load the model and see it on the screen. I usually use the following unit test in the Model.cs class called TestLoadModel:
Step 6: And finally we should see something like this (this test is from the DungeonQuestGDC
engine from http://XnaProjects.net
I hope this helps.