BNA!@Posted: Wed Mar 19, 2003 5:52 am :
Exporting From Maya To MD5

The MayaImportx86.dll now works for several versions of Maya, meaning the exportModels console command should work if your Maya version is 4.5 or greater.

Go here for a tutorial:
http://www.doom3world.org/phpbb2/viewtopic.php?p=58097

============================

Edit by Goliath: This post refers to obsolete material and will not work for the final version of Doom3. We'll have to wait for the SDK before being able to use Doom3's Maya->MD5 model/animation exporter, which should be released soon after the first game patch is released.

In addition, the .def file formats, entityDef defintions and export commands and parameters have drastically changed between what is shown here and what can be found in the final game.


Our user crimity has written this nice tutorial a while ago.
Since it shouldn't get forgotten or vanish in the web, I mirror it here.

crimity wrote:
I've recently been messing around with getting animated models into Doom 3. I am not going to go into too much detail since this is really a tutorial about using the Doom 3 MD5 converter instead of a Maya tutorial. Plus I really don't know crap about Maya, two days ago I was just another 3ds Max user :P

Okay, to start out you will need an object. I made a box with 2 height segments so I could figure out what I was doing easily just by reading the ".md5mesh" file. Because of the way Maya does their polygons (actual polygons instead of triangles) you have to triangulate your object(s) (modeling->polygons>triangulate). Now UVW map it and apply a tga (I don't think doom3 supports jpeg like quake3 did).

Set up your bones and skin (in other words link the bones to your object's vertices). Since my object was really simple I only needed 3 bones. My bones were named "joint1" "joint2" and "joint3". Joint 1 being the root bone which controls all of the other bones. You will have to know the names of your bones for exporting... So, make them pretty simple if your doing a complicated bone system.

Create a box (or any object really) called "[whateveryouwant]_" at 0 0 0 xyz coordinates or at the base of your object. This will be your prefix object. The prefix object is the base of the model as far as I can tell anyway, I haven't really tested it. I called mine "pre_", as far as I can tell it doesn't export with the MD5. I am pretty sure the underscore isn't necessary but I see it being done all time in id's .def files. The only place I haven't seen it was in the chainsaw's def file.

Save your scene as either a ".ma" (maya ascii) or ".mb" (maya binary). I like to use ".ma" so I can open it up in a text editor if I'm getting major problems later. I would call the file name something with "mesh" in it since this file is going to be used to export to .md5mesh.

Now put together an animation sequence.. JUST ONE. Unlike Quake 3, Doom 3 uses one file for each sequence. This makes it a bit easier to organize your animations, in my opinion anyway. After you've finished putting together the animation save it as either ".ma" or ".mb" again, but this time put something that will help you tell which animation it is. For me it was "idle"

Whelp, Maya has served its purpose *kicks off stage* now we get to use the fun stuff. It's time to convert our model to md5. To do this you will have to create or edit a .def file. I created one called sausage.def.... ahem. At the beginning of the file you will run a "export" command.. and it does exactly that. Here is what I put in my sausage.def file (NOTE: I added comments explaining what each part is) :

// ----------------------------------------------------------

export {

// You must start your extra commands with "-options"
// prefix defines the pivot point object.. "pre_" was mine.
options -prefix pre_

// "-parent" is what id uses for their linking system. Even though you already
// defined all this in maya you'll have to do it again in here.
// So the line below links joint3 to parent joint2
addoptions -parent joint3 joint2.

// Links joint2 to joint1... joint1 is the root and controls all of the other roots.
addoptions -parent joint2 joint1

// If you have objects in the scene you dont want to export then dont include
// them in the keep line. Everything else must be in it though.
addoptions -keep joint1 joint2 joint3 sausage

// Below is where the path and destination of the mesh
// sausage.ma is my source file..
// models/matt/ is where it's going to put sausage.md5mesh
mesh models/matt/sausage.ma -dest models/matt/sausage

// Below is where the path and destination of the animation
// works the same as the "mesh" except it doesn't export the mesh =D
anim models/matt/sausageidle.ma -dest models/matt/sausageidle
}

// ----------------------------------------------------------------------

In order to test your models animations you are going to have to make an "entityDef" script. This will make a new entity in Doom 3 that you can test out in game. This is what I put under my "export" script:

// ----------------------------------------------------------------------

// Entities name. You will be using this name to test the model.
// You have to name give it the appropriate title for what "spawnclass"
// My spawn class is "idProjectile" so I put a "projectile_" before the actual name.
entityDef projectile_sausage {

// This is what type of entity it is.. I used idProjectile
// because it was simple and idAnimated was giving me some trouble.
"spawnclass" "idProjectile"

// "min" and "max" is the bounding box size.
// I think Maya and Doom3 have about the same grid size, so you can
// figure out your models bounds like that.
"mins" "-3 -3 -3"
"maxs" "3 3 3"

// This defines the path for the actual mesh.
"model" "models/matt/sausage.md5mesh"

// The animations name (idle) and path to the ".md5anim" file.
"anim idle" "models/matt/sausageidle.md5anim"
}

// ------------------------------------------------------------------


There are alot of other commands you can do, but I wanted to keep it simple. Okay, Save your ".def" file and start up Doom 3. All you have to do now to get the engine to export the model is load up a map. "empty.map" is good for this type of thing. Once you're in a map type "testmodel " and what you named your entity, in my case it was "testmodel projectile_sausage"

The model should pop up, if it doesn't then you might be aiming a bit to low/high. The "testmodel" command spawns the model a certain distance from the players viewpoint. So make sure you are looking away from walls, floors, or ceilings.

Now bind a key to "nextanim" and another one to "prevanim". I think those commands are pretty much self-explainitory. Press your "nextanim" key, hopefully you will see your model looping the first animation you defined in your entityDef script.

Well, I hope this helped some people out there who are dying to start modeling cool characters in Doom 3. There should be some awesome stuff the mod community makes with id Softwares kick ass engine. I can't wait to see what people come up with.

- Crimity


Current MD5 viewer source code.
Last uploaded 11/07/02-22:42PST.



LPlasma@Posted: Thu May 08, 2003 6:21 pm :
Just a note to people compiling models, if you get a DLL error when exporting the models in the engine, you need Maya 4.0. 4.5 or any other version will not work, it wont load the proper DLLs. You have to uninstall 4.5/whatever and install 4.0, and then it will work fine.



Jafo@Posted: Thu May 08, 2003 10:12 pm :
C0_0L LPlasma thanks for all the work. Can't wate to test it out:)



Onan@Posted: Sat Jun 14, 2003 6:11 pm :
Thanks for your support, guys, especially LPlasma. It works perfectly now. For Maya 4.5, you're right. The dlls don't work with MayaImportx86.dll. You have to take 4.0.

Crimity's Tutorial is not bad, but with the export options he erred a lot:

The prefix is not an object in the Maya-file that determines the origin of the model, but some letters that will be attached to the joints' names in the parent and keep options. For example: -prefix = my, and parent joint3 joint2. If Doom doesn't find joint2, it will look for myjoint2. Thus it's just to simplify work, if all joints start with the same letters.

-keep: All joints will be exported. It doesn't matter if they are in the keep options or not. But you can put the meshes in the keep options, the channels of which normally aren't exported. So you also have the meshes' channels in the md5. However, it doesn't make much sense, for they have no influence on the skincluster and only appear in the initial pose.

-parent: You don't have to indicate the hierarchy. If you omit it, Doom will use the hierarchy you defined in Maya. Use this option to overwrite the original hierarchy.

Maybe it should also be mentioned how to put the Maya model into the right format. crimity says: triangulate it. But that isn't sufficient. You also have to kill the histoy, or Doom3 will crash. Furthermore, freeze the transformations on the whole mesh: Modify->freeze transformations, for the channels of the transform-node won't be exportet.

I have written a full tutorial about the export at http://www.doom3maps.de, but until now it is in german only (sorry).



crimity@Posted: Sat Jun 14, 2003 7:03 pm :
Thanks a lot for pointing all of that out. I'm sure it will help a ton of people out there, including me :P

I never really got to play around with doom 3 enough to figure out all of the kinks in my methods, so I'm really glad you caught the snags.



rebb@Posted: Fri Jul 09, 2004 7:26 pm :
Uhm, is anyone else getting a "Fick-Filme" Porn Site when clicking the link up there ? :shock:



Hell Byte@Posted: Sun Aug 08, 2004 7:25 pm :
Quote:
Uhm, is anyone else getting a "Fick-Filme" Porn Site when clicking the link up there ?


Yup...



BNA!@Posted: Sun Aug 08, 2004 8:09 pm :
He didn't renew his domain - removed the link.



function@Posted: Fri Aug 20, 2004 6:14 am :
Hi. Great forum all!

I'm trying to follow Crimity's instructions to get a model out of Maya and converted to md5mesh. (That's a good idea right?) I created a VERY basic 35 triangle model with transformations frozen and history deleted. I have Maya 4, and I'm working with an off the shelf version of Doom3.

When I run "testmodel models/mystuff/simpledesk.mb" I get the error message:
> Failed to export 'models/mystuff/simpledesk.mb' : MayaImport dll not loaded.
> Can't register model

I can't tell if this is a Maya problem or a Doom problem. Does anyone know if the final release of Doom3 included this Maya exporting function? Or how do I get MayaImport.dll to load?

*additional facts: I have a MAYA_LOCATION env variable set to my maya dir (but not the /bin), and I do _not_ see anything like importx86.dll in my doom3/base dir*

I know Kat has been working on a maya2md5 app, but that's mainly for boned/skinned characters. I'm just starting out and want an easy way to get useable meshes out of Maya.

Help?

(need to) function



goliathvt@Posted: Mon Aug 23, 2004 2:43 pm :
Please read the edit I made to the first post in this thread. Or, check out the Maya section of this forum where I made roughly the same statement. Exporting to MD5 using Maya will have to wait for the SDK. There's no way around it.

Goliath



uberstonks@Posted: Sat Oct 16, 2004 7:11 pm :
The sdk site now has instructions on how to export to MD5 from Maya

http://www.iddevnet.com/modelexport.php :twisted:



moss18@Posted: Mon Feb 21, 2005 12:45 pm :
ive tried goliath tutorial...and i just cant get an xport going....it doesnt give me any errors...no thing....but it doest create any md5 files >?? pleaaaaaaaaaaaaaseeee guysss help me



moss18@Posted: Mon Feb 21, 2005 1:14 pm :
i think ive figured out what the problem....doom cant find my maya scene file........can any one please tell me the paths i should be using ?? pleaaaaaaaaseeeeeeeeeee



moss18@Posted: Tue Feb 22, 2005 6:31 am :
hey all..pleaaaaaaaaaaaseeee will someone help me out here..... in the goliath tutorial we initially make a buddy.def file...but when we xport we have to give the command exportmodels monster_buddy.def ...... where should i put the def file......i just want a simple md5 mesh...just a box.....as i said...i get no errors..but nothing exports.....i have to put my buddy.def file in the doom3/base/def or else doom doesnt know its there..... please guyssssssssssss help me out here will y..........PUH-LLLEEEEEEEEEEEEEEEEEEEEZEEEEE....



moss18@Posted: Tue Feb 22, 2005 6:51 am :
im getting an error loading the file (kFailure) unexpected internal failure......anything..anybody..please :s



Live-wirE@Posted: Tue Feb 22, 2005 10:26 am :
Your using maya, :P umm have you checked the UVs hav you given the box joints?? make sure everything is tri not quad. thats about all i can think of right now so get bak temm me how it goes.

And the .def file goes in the def folder
base/def


Live-wirE



moss18@Posted: Tue Feb 22, 2005 11:29 am :
ive got the export working...thankyou all :D



goliathvt@Posted: Tue Feb 22, 2005 1:36 pm :
I'm glad you got it working, moss18. For others that read this thread: if I remember correctly, that "(kFailure) unexpected internal failure" error has to do with using an incompatible MayaImportx86.dll with your particular version of Maya. For others that have this problem, make sure to visit iddevnet and get the proper expoerter .dll for your Maya version. There are seperate ones for Maya 4.5, 5, and 6.

Goliath



Live-wirE@Posted: Wed Feb 23, 2005 12:11 am :
hey goliathvt i wanna thank you for helpin sort that prob wif the UVs i got the model in game and doing wat its ment to now and thanks for the script help cheers.



Live-wirE



Live-wirE@Posted: Thu Mar 03, 2005 2:43 am :
Hey i was wounderin if ne one new how to export a gun for the player model to hold. i cant figur it out i know it has to be md5 but im not sure howto do it iv looked at the id files but im sure i missin sumthing cheers.




Live-wirE