Page 1 of 1

MS3D Animation Bug (bone rotation and speed problems)

Posted: Mon Sep 19, 2005 4:40 pm
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!

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

Posted: Tue Sep 20, 2005 1:21 pm
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!

Posted: Sun Oct 02, 2005 1:58 pm
by niko
Hm, how many bones are you using? If there are really a lot, this could explain the speed change.

Posted: Sun Oct 02, 2005 9:48 pm
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?

Posted: Mon Oct 03, 2005 2:02 pm
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 :)

Posted: Tue Oct 04, 2005 8:27 am
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 ;)

Posted: Fri Oct 07, 2005 7:36 am
by Andi|xng
Not all problems solved, but much better performance now :)
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=9119