Slow Animation

BlitzMax Forums/MiniB3D Module/Slow Animation

Stu_ovine(Posted 2008) [#1]
I've got an animated B3D that contains 36 bones, 22 textures, 5600 verts, 500 frames of anim .


If I take out "UPDATEWORLD" frame rate is normal, so im sure its just the animation thats causing the slowdown and not the polycount of the model.

Is it just that Minib3d is really slow at animation, is this too large an animation for it ? or am I missing something obvious...


GfK(Posted 2008) [#2]
Is it actually causing a drop in framerate, or just the animation itself is playing too slow?

IIRC, you can specify the animation speed with Updateworld.


slenkar(Posted 2008) [#3]
if its the framerate, it could be the number of bones


Stu_ovine(Posted 2008) [#4]
Just tried the same model in Blitz3D and it play no problem......

Updateworld is taking over 30ms to run.


Brucey(Posted 2008) [#5]
Possible that the animation side of minib3d hasn't been tuned as much as other parts of it...


Stu_ovine(Posted 2008) [#6]
Im just tracing thru the code and its VertexDeform() that is the bottleneck.

Im wondering if the anim is loading in correctly...

In the loop


For Local anim_surf:TSurface=EachIn ent.anim_surf_list
..
.
   debuglog(anim_surf.no_verts) <-----
       For vid=0 Until anim_surf.no_verts



Almost all of the debug output is saying that I have over 4000 ? ( which i presume is saying that I have over 4000 verts that get effected by the bone ?) In the editor of course this isnt the case.


slenkar(Posted 2008) [#7]
interesting, Si will have to answer this one


klepto2(Posted 2008) [#8]
No, not all vertices needs to be effected, but each anim_surf is just a representation of the original vertices transformed by the bones. So it is just normal that the anim_surf contains the same amount as the orifinal surface. I haven't looked much into the animation (bone animation) yet, but as far as I understand this works like this:

Each vertex can have up to 4 bones effecting it.
Now simon goes through all vertices.
---> Checking if Bone 1 is effecting the vertex
---> if yes check applie changes and check bone 2,3 and 4
---> proceed with next vertex.

I think there are at least two ways to optimize it.
The way commonly used nowadays : update the bones via Shaders.
Other approach: Precreate the main frames (1,2,3,..) and save them like its done with md2 or md3. You later just need to interpolate between eg frame 1 and 2.
The last is not complicated but will just destroy the idea behind boned animation.


Maybe there are other ways to speed things up. Maybe you're able to send me and/or simonh the model for testing (handling the model with respect of course).


Stu_ovine(Posted 2008) [#9]
Yea I guess that a movement from a lower bone could adjust the position of another bone hence so many checks.

Blitz manages it, just thought MAX would be able too.


smilertoo(Posted 2008) [#10]
I'd blame the 22 textures before the 33 bones on a normal anim system, its a shame almost every blitz 3d engine focuses mainly on scenery.


simonh(Posted 2008) [#11]
22 textures? That means there's 22 surfaces, which would certainly cause some slow down.

I wouldn't expect there to be a huge difference between Blitz3D and MiniB3D though. Feel free to send me the model if you want me to try and improve the speed.


Stu_ovine(Posted 2008) [#12]
I'll take you up on the offer. Send it to your Profile address ?


Stu_ovine(Posted 2008) [#13]
How small do I feel...... seems I've been running in debug mode which halves the frame rate !!!!

Does make debugging the game a bit harder with the anim running so slow - but at least in a final exe its running fine.


slenkar(Posted 2008) [#14]
oh well live and learn