MS3D Animation Bug (bone rotation and speed problems)

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

MS3D Animation Bug (bone rotation and speed problems)

Post by Andi|xng »

Hi again.

I have a problem with an animated .ms3d file. I think it is best described by 2 videos:

In Milkshape it is displayed correctly: http://www.xenoage.com/temp/ms3d-ok.mov

In Irrlicht there are two crazy rotations:
http://www.xenoage.com/temp/ms3d-wrong.mov

Since I am programming in Java (Jirr), I do not know the source code of Irrlicht. For me it seems to be an error in the interpolation code? As if for example "move from 2 degrees to 358 degrees" is not realized by decreasing the angle, but going the "long" way by increasing it - but as I already said: I do not know the sources.

If somebody wants to try it out and fix the bug: I can send you the model (mail to andi@xenoage.com )

Any ideas anyway? Thanks!
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Re: MS3D Animation Bug (bone rotation and speed problems)

Post by Andi|xng »

Today I encountered 2 more problems with ms3d meshes.

First, their animation is very slow. While the scene with .x models reach 250 FPS, with .ms3d models i get only 140 FPS (the model is the same, only the format is different). But ok, this is no bug, and I read in the sources that much optimation can be done there (as I am a Java programmer, I can not help really :( ).

The second thing is really a severe problem. When I change the animation loop (setFrameLoop()), the FPS decrease in about 10 seconds from 140 FPS down to 70 FPS! I tried it for hours now, it is really caused by setFrameLoop().
I call setFrameLoop() about every 4 seconds (thus not really often). The problem appears only, when I attached another node to a ms3d-node's joint (in my case a cap onto the head of a person).
The problem does _not_ appear, if I _only_ call setFrameLoop() or if I _only_ attach a child node to the animated node. It only happens when I do _both_.

At the moment .ms3d is my only choice, because there is no getXJointNode()-method in Irrlicht (I read somebody had implemented it, will Niko add it soon?).
Is there any solution for my problems? If not, is is planned to improve the ms3d support in the near future (0.13 or 0.14)? Thanks!
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, how many bones are you using? If there are really a lot, this could explain the speed change.
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

The model has 36 joints, but as already said, the same model as .x works perfectly, and the .ms3d is slow.
Niko, do you plan to add getXJointNode() soon, so I can use .x models instead of .ms3d? Then all problems would be solved. Or as an alternative, do you plan to optimize the .ms3d code soon?
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

Today I tried to find the reason for the slow .ms3d models, and I think I found it.

First I thought, the animation is very slow, but I soon noticed, that it is very very fast. Then I noticed, that the .x model has only about 1000 vertices, but the .ms3d model about 3000 vertices!
This is caused by loadMesh(), which generates a vertex for each index (3 vertices per triangle). This is not very good, because the index buffer does not help anything after that...

Though I am no good C++ programmer, I tried to minimize the used vertices. At the moment I have increased the FPS from 180 FPS to 300 FPS (!!!) (testprogram with 20 milkshape nodes), but normals are not implemented yet.

I will try to finish it the next days and post the optimization here :)
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

The optimization is nearly complete. I have also implemented the normals now, and the result: 130 FPS before, 260 FPS now (exactly the same scene, exactly the same visual result).

If you want to help me testing, please send me your .ms3d meshes at andi@xenoage.com . Please send everything you have ;)
Andi|xng
Posts: 83
Joined: Thu Mar 24, 2005 10:49 pm
Location: Schrobenhausen, Germany
Contact:

Post by Andi|xng »

Not all problems solved, but much better performance now :)
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=9119
Post Reply