Reducing Collada/DAE Filesize

My .dae is currently 150KBs large – which isn’t much – but more complex models can probably easily get into the megabyte-range. And then it will definitely sum up and take time to load. An easy way to reduce Collada filesizes:

  1. Open the file and delete double spaces, tabs, line breaks.
  2. Delete Collada overhead not required for Papervision3D’s Collada parser (trial & error)
  3. Search & Replace long object names like Bip01_Arm_Torso_Spine-node-transform_Bip01_Spine-node_transform-input-array into b1ats_nt_b1sn_tia or something even smaller, as long as it’s unique (trial & error again)
  4. Insert the XML into a Flash-file and load the .swf instead of the .dae.

While the second and third part are optional and only recommendable once the model is final, the flash-part is really efficient, because (unlike .dae-files) swf-files use compression. All in all I got from 150kb to mere 10kb. Nice, nice.

Collada and Cinema4D, Update

After some more digging it turned out that my problems with DAE-Animations were most likely a problem of Cinema4D’s Collada exports. Blender’s exports should be bugged as well, as I wrote the last time, with faulty animation. And while there’s tons of options for exporting Blender models into PV3D, none seems to include animation.

Building Quake2 MD2-Models with Milkshape may still be a way, but there’s still a ton of obstacles, with no guaranteed success or even only a documented workflow at all. Cast3D also turned out to be no option, because it needs proper models first.

OpenCollada‘s 1.3.0 Trunk seems to be, as far as I’ve read, the only proper Collada exporter for Papervision if you want animated objects – or at least some folks with 3ds Max claim to be able to work reasonably well with it. Good that I use a Mac, because there’s no 3ds Max for Mac. Macs are great.

I start to wonder if it’s either that there’s so few people who want to have animated characters in flash that no one talks about it or if it’s just that everyone uses 3ds Max to begin with, and that they never come across those problems :-(

Papervision, Collada, Cinema4d and Animation

This annoys me so much. I’m trying to get an animated 3D-model into Papervision and I thought it would require:

  1. Building a textured 3D model in Cinema4D
  2. Animating the model
  3. Exporting it as Collada
  4. Importing it into Papervision

Yeah. Nice thinking. Making the model is pretty straight forward, easier than I thought, but that’s just where the problems start.

1. Building the Model

Texturing is alrady a bit of a problem. First you’ve got to unrwap your model, outline the texture and export it so you can edit it in Photoshop. C4D even conveniently saves your texture as Photoshop .PSD-file (though PV3d hates those, so one’d rather stick with PNGs and JPEGs). Here’s a tutorial that explains everything nicely. Exporting the model gives you a properly textured PV3D-compatible Collada .DAE (Tutorial on how to import).

However: Papervision doesn’t accept multiple UV-mapped materials, so you’ll have to combine your model into one object and make one texture for all of it… But if you do that, you can’t animate your model anymore. Here’s a class that seemingly repairs C4D’s Collada exports, but it didn’t work for me.

You could try to build different objects and map each of them with normal textures, which PV3d surprisingly understands, but I haven’t tried it with anything more complex than 2 textured planes. Animation of course doesn’t work if you do it this way, why should it.

2. Exporting Animation

This sucks. While C4D’s Collada exports seem to contain animation, they somehow don’t arrive properly at PV3D. First thing to mind is that you can only use linear transitions, but even that didn’t help me. Moving vertices, the only way to animate objects if you reduced them to a pulp (see 1), doesn’t work. Pv3D says that there is animation description in the .DAE, but it only shows the status you’ve last had in C4D and; doesn’t do anything.

Moving normally textured objects doesn’t work either: the moving object isn’t even shown and PV3D doesn’t trace any info about animation in the .DAE. Weird. Some people seem to get past what I’ve managed, but frequently moan that rotations and transitions or a whole axis is ignored. Same thing seems to happen if you use Blender, which, btw., ignores C4D animation; so going through Blender is no option either.

Still to come: Controlling the animation

DAEMC seems to be a good class to control DAE animation (if I were to even get animation into DAEs), but the development has stopped and it’s only compatible with PV3D rev 911 and below. The author says one should move to Away3D, but a quick Google Search doesn’t really look promising at all.

Another alternative would be to use MD2-Models… Quake II models format from those ancient times where PCs had less than 200 MHz. That seems to work reasonably well with Papervision, but then there’d still be the problem of creating MD2-files. I’ve found a C4D-MD2-Converter, but it’s from 2005 (!!) and you’d need a Windows PC for it, which I don’t have. Milkshape also builds MD2-Files, probably I could also set up the different animation sequences there… but it also requires a PC and doesn’t even support Cinema4D. I might try and check if Cast3D helps, but then again: I’d first need properly textured and structured models, or don’t I?

There seems to be no proper and straight-forward approach to building animated 3D-models for Papervision. 3ds Max seeeems to be better supported, but I’d still need a PC for that (Oh, yeah, and 3ds Max, of course). Damn it.

The stupid approach…

… would be to skip building the models with 3D editors and just use the primitives PV3D provides. Cones, Cubes, Planes, etc. and script the animation by hand.

Yeah, right.

Even further down the road:

When I somehow survived all problems stated above, I’d still need to dynamically change materials and get dozends of low-poly models running smoothly. Urrrrgh. Is it hopeless?

Update: Yes it is. Animation only works with 3ds Max.