alexeyd / blender2cal3d

A project to port blender cal3d exporter to blender 2.58
7 stars 13 forks source link

Error on mesh export #14

Closed farrer closed 12 years ago

farrer commented 12 years ago

Trying to export a model from DNT, it seems to be wrong... I don't know what's the error cause (I cleared rotations and scale for both armature and mesh, but it still is exported wrong)...

The model is: http://dnt.dnteam.org/test_blends/velhaca.blend

And how it looks on the irrlicht viewer of the exporter: http://dnt.dnteam.org/test_blends/velhaca.png

It's not a bug on the viewer, as it looks the same on DNT engine.

alexeyd commented 12 years ago

On my system velhaca is exported finely.

Blender: 2.61 CAL3D: 0.11 XML cal3d format RotX: -90 Scale: 10.0

Here's what I see in the viewer: http://www.freeimagehosting.net/newuploads/dwy6t.jpg

Idle animation also exports without a glitch.

Could you please specify your export params?

farrer commented 12 years ago

Maybe it's my blender (I'm using 2.60a, 2.61 isn't yet on gentoo repositories)... I`ll try with 2.61 and see if I can export successfully...

For parameters, I've tried with the default (no rotations), but with XML formats (if I'll export with binary ones, my cal3d complains about invalid file version or something like that - cal3d is 0.11 here).

farrer commented 12 years ago

Tryed with 2.61 (downloaded from blender site)... Same problems...

Without rotations, when loading on viewer:

Loading skeleton "velhaca_Armature.xsf".. OK! Loading animation "velhaca_ArmatureIdle.xaf".. Failed! Cal3D could not open one of the files Error: The duration of the animation is invalid

So, I've commented the animation on the .cfg, and the model is still distorted (try the exported model here: http://dnt.dnteam.org/test_blends/velhaca-without-rot.tar.bz2 )...

Adding a -90 rotation doesn't fix the problem either (still the same mesh distortion and error on animation load)...

I'm using the lastest version of the exporter from git repository...

Edited: One problem is related to the "vertex-group" option. If I disable it, the mesh is correct exported (but the animation still doesn't).

alexeyd commented 12 years ago

Hmmm...

I downloaded your exported model (velhaca-without-rot.tar.bz2) and it looked fine in the viewer. Animation was also exported correctly. I had to edit the .cfg file because of the viewer peculiarity - it won't display an animation unless it's named, but that was it. Here's the edited .cfg:

path=/home/farrer/velhaca/

skeleton=velhaca_Armature.xsf animationname=idle animation=velhaca_ArmatureIdle.xaf material=velhaca_Material.xrf mesh=velhaca_velhaca.xmf

Here's the shot: http://s15.postimage.org/kngve2n6z/velhaca.png

"vertex groups" option is not functional now. Actually if you deselect it, it just disables weight exports.

Are you sure that you have only one cal3d library installed? Maybe you're linking viewer to some newer/older cal3d?

farrer commented 12 years ago

Really strange... so the problem probably is on the cal3d side. I'm using cal3d-0.11, of the gentoo repository. I even tried now the 0.11 from cal3d gna site, but same problem...

As cal3d isn't updated since 2006, maybe it's a bug with 64bits systems (are you running on 32 bits? What OS?)... I'll take a look at cal3d source and see if I can debug it (must be something related to the bone weights - or maybe bone transformations - at cal3d, as the model is ok without weights [when exported with the "vertex groups"])...

Anyway, thanks for the help...

farrer commented 12 years ago

Just for note: I've got the error.

It's because cal3d converts float data from string using "atof" function, wich is locale dependent. When running on my system, atof expects float strings separeted by commas, not by points. The solution is to convert to float on a locale independent way (using std::sstream, for example). Doing that, and the model is loaded fine on the viewer!

What I really can't get is why some models load and others don't (all of them are point separated floats).

I'll submit a patch to cal3d, but I'm considering a fork since they doesn't release a new version for years!

Again, thanks for the help, and sorry for taking your time, as it isn't related to the exporter itself, but to cal3d. I'm closing the bug now, as it is fixed.

alexeyd commented 12 years ago

Yep, I'm on 32 bit linux with "C" locale.

No problem, maintaining cal3d exporter is fun (=