Maya to md5 exporter

Because most of the 3d artists in my team fell in love with maya i’ve been forced to find a way to export bone animations from that thing…

I took a deep breath and learned MEL, at least a little. Here is the result so noone will ever have to learn that creepy script again:



http://digitus.itk.ppke.hu/~szada/md5exp.zip



UPDATE:

  - Textures export is working. Ill be calling the exporter 1.0 from now on.

  - Custom model and anim file names are specifiable.


great haha  :smiley:



i think theres a maya to md5 exporter, have u tried that?



http://scripts.zbufferstudios.com/

Yeah, thats what i've expanded. It didnt work at all in maya2008. When i fixed it, it still only exported one mesh at a time, and animations were messy.

I made it to focus on skinClusters so everything connected to them is exported, and fixed the animation issue.

Nice work.



Faced with the buggy MD5 exporter, i went for X (directx mesh) format instead. The MEL was just too much pain for me. So, congrats. You may want to propagate that script elsewhere, not just here. You can even ask money for such a thing, you know?

Will do. But i dont think that a simple exporter script would worth money, would it?

they used maya for doom3/quake4 wouldn't the sdk have a viable exporter :?

The sdk serves a whole different purpose. It contains nothing for export/import.

Odd thing is that they have 3 type of importers available on their site, but not one exporter(besides the user submitted ones). They must be keeping it safe in a hidden desk's hidden drawer for bitter times…

All the MD5 exporters were written for old (Maya 6) versions, none of them works in Maya 8.5. Not having proper exporters for bone animated models from Maya is such a wide problem that i'm sure you can ask money. There is one commercial exporter i know, but surely you can offer yours for less. If you consider maintaining it for longer time, at least put up a donation page. Just noticed that you are hungarian too. Based on the link i guess you are doing a school project?

LOL! …well I guess the idea was the model spec was there and free to use, so it would be up to…well… "us" to do the rest…sadly, but then dear I say it the max and blender support is excellent, derton did good work, if u have max at your disposal, fbx might be a good interdiate maya-><-max format

vear said:

Just noticed that you are hungarian too. Based on the link i guess you are doing a school project?


So you are too? Small world eh?:)
Fortunately this is not a school project. They are being forced on people and we all know what the results of forced labor are... For now the university's server is the only place i can put stuff.
My dream is making a popular rpg game. At first i tried to make a small 2d game alone, but about two months ago i met with a few maya modeller guys, and a quiet sponsor. jME was our(my) choice to stick with, and now here we are. We have bone animations running:)
The donations site idea is not bad. I might just make one. I will not ask directly money for it.

@HouseMDave: Thanks for the creepy script work. I have a bird in maya which I want to bring to md5. Your modified script generates the mesh and the animation.



But i have a little weired problem. I used that importer:

http://code.google.com/p/md5importer/



and the birds with fly-cycle loads in my scene. The problem is, one wing is doing the normal animation, the other wing is moving is the false axis (not up and down, forward and backward).



Here is my project as jar if you want to take a look at the animation:

http://knecht.homelinux.net/ftp/ftp2/knecht/swarms_nosrc_20080701_1816.jar

java -jar swarms_nosrc_20080701_1816.jar



you know where in the script is done what, have you a hint what could be the problem ? I play with your script since 3 hours, and don't know where to search.

thanks
Sebastian

hmm, i simply changed it in maya, then after export it is right again . . . some kond of solved

HouseMDave said:

UPDATE: - Textures export is working. Ill be calling the exporter 1.0 from now on.


I use a texture, but my model is just textured with the jme-no-texture-found texture. How do i tell it where to search the texture ?


01.07.2008 23:43:06 com.jme.util.TextureManager loadTexture
WARNUNG: Could not load image...  URL was null. defaultTexture used.



my folders:

model/texture.jpg
model/md5/models/test.md5mesh
model/md5/models/test_anim.md5anim



i load the model this way;


URL bodyMesh = Md5ModelLoader.class.getClassLoader().getResource("model/md5/models/md5/test.md5mesh");
URL bodyAnim = Md5ModelLoader.class.getClassLoader().getResource("model/md5/models/md5/test_anim.md5anim");
MD5Importer.getInstance().load(bodyMesh, "ModelNode", bodyAnim, "BodyAnimation", Controller.RT_WRAP);
Node boid = MD5Importer.getInstance().getModelNode();



i opened the md5mesh file, the path to the texture was absolut (c:blablaseagull.jpg), i changed that to seagull.jpg.

No effect.

Then i tried to use the ResourceLocatorTool:


        try {
            ResourceLocatorTool.addResourceLocator(
                    ResourceLocatorTool.TYPE_TEXTURE,
                    new SimpleResourceLocator(this.getClass()
                            .getClassLoader().getResource(
                                    "swarms/data/models/md5/")));
        } catch (URISyntaxException e1) {
            e1.getStackTrace();
        }



02.07.2008 00:15:02 com.jme.util.resource.ResourceLocatorTool locateResource
WARNUNG: Unable to locate: seagull
02.07.2008 00:15:02 com.jme.util.TextureManager loadTexture
WARNUNG: Could not load image...  URL was null. defaultTexture used.



I put the textur here and there, but he do not found it. How do you handle your textures with md5 ?
Is there a way to tell the TextureManager where to search ? Or should i put the texture in jme on it, and the UV's are that from maya ?

if more information is needed, my maya model file or something else just ask, i will put it here.


thanks
sebastian

Ah… Good to see someone using the script:)



The md5importer uses jME's resource locator tool. I learned this recently too. Here is an example:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=7323.90

Ergo: Maya's texture path and the resourcelocator's parameter must be the same to make the script work.

Cheers.



(… Damn i need to make texture paths specifiable… )


i love your work, you make my day !!! (also need to handle maya2008 models)



i will try and tell the result here

IT WORKS !!!



i used the ResourceLocator from your link


      try {
         MultiFormatResourceLocator locator = new MultiFormatResourceLocator(this.getClass().getClassLoader().getResource("swarms/data/models/md5/"),
               new String[]{".tga", ".bmp", ".png", ".jpg", ".texture", ".jme"});
         ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, locator);
      } catch (URISyntaxException e) {
         e.printStackTrace();
      }





i used vim (a text editor) to change the texture path in the test.md5mesh file like the MultiFormatResourceLocator code above

mesh {
        // meshes:bodyMesh1
        shader "swarms/data/models/md5/seagull_color.tga"



and thats it, i have my texture !!

THANKS A LOT !!  :D :D


if you ever in berlin, i pay a round  ;)

Dont get too comfortable. I might just collect it… :wink:

just a little info, you shouldn't need to change the path in test.md5mesh.



if your texture is in the path: "com/yourpackage/resources/texture.jpg"

and the path in the md5hesh file is: textures/texture.jpg"



Then the ResourceLocator will still find the file, because he will recursively cut down the path until only the filename is left.

its easier to edit the md5mesh file as to explain the guy made the model that he should not use absolut pathes and moreover use a specific folder structure.



But thanks for the hint.


Hi,



I was trying your export with Maya2008 (MacOs, Linux). I created polygonal cube and skeleton from two joints. I binded with smooth bind.



Error occurred: 0 matches with bindPose2

And Maya froze.



Maya file: http://www.ajka-andrej.com/download/kockabind.mb



Screenshot from frozen Maya in Linux after the running your script. The same on the Mac.

ScreenShot:  http://www.ajka-andrej.com/download/maya.jpg



Thanks for any useful information how to use your exporter script.



Andriu