Wednesday, March 31, 2010

[Away3DLite] MD2 and MDZ Builder from DAE Animation!?

What's that?

Are you feeling sick with Collada DAE format? big ass, huge parse time, long load, plug-in mess up each revision, animation clip need expert modeler to export it with new version from $$$ program, texture didn't pack with model (yes you can use KMZ, but i won't suggest that, face is totally mess from Sketch Up ;p) and bla bla bla….

And?

bad news is you still have to deal with it lol, but good news is from now on we can now export that DAE to MD2 with animation!

Method #1 : DAE -> Mesh -> MovieMesh + AnimationData -> MD2

Yeah, that's mean single mesh animation, I won't buy it

ah ,well let me try again

Method #2 : DAE -> Mesh(es) -> MovieMesh(es) -> MD2(s)

Well, look nice, but how about textures?

you right, let's add texture file name to MD2 header

Method #3 : DAE -> Mesh(es) -> MovieMesh(es) -> MD2(s) + texture filename

Collada got auto textures load isn't it?

you 're lazy bastard! let's pack it then, know KMZ right? let's do it!

Method #4 : DAE -> Mesh(es) -> MovieMesh(es) -> MD2(s) + texture(s) -> MDZ

Which mean I can use WinRar or WinZip to open it?

you right! look at this!

 winrar-mdz 

Pros?

  1. less file size, mean less load time
  2. no bone need, mean only vertex animation here = should be faster
  3. can be dynamic convert DAE bone animation at run time to vertex animation, even share vertices and/or material (some decision will make about this later to toggle shared on/off)
  4. all pack and can be repack by one line of code
  5. can be read MD2 -> modify vertex, animation -> write MD2

And cons?

  1. not optimize yet, weld need
  2. not support quad face yet, need more coffee
  3. no docs for this yet, only brave/geek allow
  4. in case it don't weld/share vertex yet, import back to some real 3d editor may cause some problem

Any demo?

here's DAE and MDZ running together side by side, which mean DAE bone animation and MD2 vertex animation running there, fyi that you can click stage to save model as MDZ

dae-mdz 

Where can I try this?

let open source rule the world :)

What's next?

can you keep secret? no? i won't tell you then lol, later!

del.icio.us Tags: ,

5 comments:

makc said...

what about several textures on one mesh? since md2 does not allow more than 1 texture at a time, you'd have to split meshes. right?

katopz said...

i think i see num_skins and skin_list there, so may be we can be add more than one texture there, i did comment for this in code as TODO there btw, at present i use 1 mesh (or 2 shared) per texture, kinda sure this is just 1st step :)

makc said...

unfortunately that was for non-simultaneous textures, like red team and blue team.

Bryson said...

Can you explain how this works?

I've been trying to get MD2 files out of Cinema 4D but it seems like this is impossible without me writing my own plug-in. It does allow me to export animated DAE files but I can't figure out how to use them with Away3D.

I downloaded this demo from the SVN and tried my animated Collada exported from Cinema. In the Flash tracing, it appears that it recognizes that this is an animated DAE (it shows frames) but nothing is displayed on the screen. I think the display issue might be related to something about Cinema naming Collada nodes in an unconventional way.

My question is, what does this utility actually do? Does it package up the DAE into this MD2/MDZ format? And do I need to start with a separate DAE for every animation?

Thanks a ton for your work already, it's helped me at least get some traction after I hit a brick wall.

katopz said...

"but nothing is displayed on the screen."
try adjust scaling to 0.01->100 , sometime it's already there but to small or to big to see, or try draw to canvas to see it rect in 2D size

"Does it package up the DAE into this MD2/MDZ format?"
yes it did

"And do I need to start with a separate DAE for every animation?"
no you don't, just make it like normal timeline flash animation mean make it long and continuous e.g. stand->walk->sit and just remember frame number for each action type to defined it later via as3, example for this it's already there

"Thanks a ton for your work already, it's helped me at least get some traction after I hit a brick wall."
np, just don't forget to share what you found, and other people will do the same (i hope ;D)