md5anim problems

Software: Away3D 4.x

Rasterizer, Member
Posted: 03 January 2013 06:16 PM   Total Posts: 69

So I’ve implemented dynamically loaded md5s, Hellknight loads up just fine, no problems with either mesh or anims…

BUT

once I start loading my own md5s, the mesh loads and displays just fine, but on the anim loading, I have a bucketful of problems.
I compared hellknight’s anims with my own and in the Notepad they have the same structure and everything, one difference is however if I look at it in HEX mode, Hellknight uses 0As for line feeds but my file uses 0D0As. I replaced them with a tool, but still a no-go.
The runtime problems at loader3d.loadData time vary from misinterpreting an obvious String for an Object (ParseUtils.as) through to a comma being added to the beginning of the String object somewhere along the line right to number of frames being misinterpreted.

While I could circumvent some of this by tinkering with Away code, the weird part is, Hellknight’s anims didn’t have a single problem. Still, my anim files look EXACTLY as those from the example.

So the question is: Is there a specific way .md5anim needs to be created, saved or “pre-processed” in order to load successfully ? I’m using the der-ton’s md5 exporter for 3ds max, my max version is 2009 Design.

   

Avatar
Fabrice Closier, Administrator
Posted: 03 January 2013 09:05 PM   Total Posts: 1265   [ # 1 ]

Do your animations play in Prefab?

 

   

Rasterizer, Member
Posted: 03 January 2013 09:16 PM   Total Posts: 69   [ # 2 ]

Yes, Prefab doesn’t complain about them.

 

   

Rasterizer, Member
Posted: 04 January 2013 04:03 AM   Total Posts: 69   [ # 3 ]

OK I have an update on the situation.

As it turned out, after re-exporting md5anim from Max, both Prefab and Away3d play it without any complaints code-wise. So that’s one problem gone.

However the inclusion of anim now makes the mesh distorted. This is not the case when I inspect the model with Modelviewer from der-ton.

I have included a screenshot.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 04 January 2013 09:08 AM   Total Posts: 1265   [ # 4 ]

Looks like a joint index issue. I’ve seen this problem on some Collada’s too.

 

   

Rasterizer, Member
Posted: 04 January 2013 09:42 AM   Total Posts: 69   [ # 5 ]

So… eh… do you by any chance know why it’s only happening in Away3D and Prefab and not in the actual Modelviewer ?

 

   

Rasterizer, Member
Posted: 04 January 2013 12:22 PM   Total Posts: 69   [ # 6 ]

Further info:

I downloaded the latest dev git branch and obviously overwrote the away3d folder - the old bugs came back. So I investigated into why and I identified 2 things that seem to make all the difference.

1, ParserUtils.as

public static function toString(data : *, length : uint = 0) : String {
  var ba : ByteArray;
 
  length ||= uint.MAX_VALUE;
 
  if (data is String) {
                        return String(data).substr(0, length);
  }
            ......
}
Doesn’t work. For some reason, at this point a comma gets inserted at position 0, so the next operations don’t see the keywords properly and the whole thing crashes with Unknown Keyword error.
So I use this instead to make it work: return String(data).substr(0, length).replace(”,MD”,“MD”);

2, asset loading

During md5anim file loading using LoaderMax, I found even if I load the file as plain text, I need to parse it into my anim array as a String, otherwise the above function will return null instead of actual data and obviously crash parsing. So I use this:

public function onMd5AnimLoaderComplete(e:LoaderEvent):void {
  md5anim_data[anim_name] = String(LoaderMax.getContent(e.target.name));
  }


Doesn’t matter which md5anim file I use, newly produced or the old batch, these problems prevent it from successful loading.
Looking at these weird errors I wonder if away3d has been developed on Macs or something with different filesystem and maybe not finetuned for Windows platform, I don’t know. I don’t see a logical explanation why this keeps happening to me.
What bugs me the most is that the .md5mesh is parsed with 0 problems and it’s a plain text file as well. I don’t need to do any fiddling with code to make that work. My bet is that there are some hidden bugs in the md5anim parser.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 04 January 2013 12:47 PM   Total Posts: 1265   [ # 7 ]

My bet is that there are some hidden bugs in the md5anim parser.
That’s possible, please fill a bug report + files to reproduce.

I wonder if away3d has been developed on Macs…
The majority of us are on macs, but David who wrote the md5parser is pc based.

 

   

Rasterizer, Member
Posted: 04 January 2013 01:09 PM   Total Posts: 69   [ # 8 ]

Thanks Fabrice, I’ve asked David for some insight first, as I don’t really want to raise an alarm over my possible lameness. grin

As to the joint index issue, I solved it - in Skin Modifier I forgot to add clavicles as bones and therefore the resulting .md5mesh was generated with 3 root joints instead of 1.
Now all is fine, the mesh animates great in all apps. Thanks for your advice!

 

   

Rasterizer, Member
Posted: 04 January 2013 01:15 PM   Total Posts: 69   [ # 9 ]

I’m wondering if there is anything comprehensive and definitive written about exporting MD5s for Away3D.

With all this tinkering around, I’ve got a pretty big picture now that I might put into some advice sheet or something, if you guys are willing to hang it up somewhere here.

Maybe an editable post in a sticky thread or something that people could find all the relevant info in. Might save people a lot of time googling stuff.

Just an idea.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X