Animated models


Finally I managed to have some basic animation in a model using Blender 2.40 and the jME XML exporter.

The problem now is that the number of meshes is more than three times compared to the model without animation but the number of triangles is still the same. The frame rate dropped from 49 to 12.5.



Is it possible that animated models can cause such a drastic performance loss?

It seems it's unrelated to the animation, the blender exporter triples the mesh count and that seems to be the reason for the performance loss.

How should models be done so that they can be used in jME? Is it reasonable that a higher mesh count with the same number of triangles cuts down the frame rate dramatically?

Maybe it's related to cloning the model. What I do is I load a model if there is no template yet in an internal cache. Otherwise it's cloned and it looks like the count of meshes increase when using a blender exported model.

it's not my fav format but there is a ms3d script for blender google it

Does that exporter understand skeletal animation? I tried several converters and I think the more you involve the more problems you get :frowning:

sorry for the misinformation aparently it doesn't do animations

I did some more tests and added a function to disable the ray intersection tests I do at every frame. The frame rate is still low, so the intersection test is not the guilty one. Something that's more dependant on the number of meshes instead of number of triangles must be the reason.

Can you email me both the xml files as they are exported from blender? Maybe I can help, then. My first idea: The models look different in the two screenshots supplied, maybe you are using materials in the second one? That would result in the meshes being split up to how much different materials they contain. E.g. a mesh with three different materials, while one single mesh in blender, would export to jME as three different models. Setting some faces to "twoside" and some to "single sided" would result in two meshes per applicable material.

Galun, your model (referring to the one you emailed me the blend file for) contains a few things affecting it's performance in jME. I wrote down some hints to optimize morph-target animated mode performance, and posted them in the exporter thread:

(the third point doesn't apply to your model, but I wanted to make this a little more general)

Hope that helps!

? are you cloning the aliens.

Just wondering if you can do anything with the textures - say one is down to half life, make it look sickly.

Can you lock the meshes with models ???

Forgive me if im asking daft questions - i really dont know the answer but would be interested to find out


Yes I clone the model. The game server just tells the client an ID, a template and a position, so a model handler checks a cache of loaded models and creates a clone if it's already there.

Depending what you want to do on a per-model basis you have to specify properties to the CloneCreator. First I used default options and now with animation it works fine with:

         CloneCreator cc = new CloneCreator(n);
         n.putClone(newNode, cc);

There is also a texcoords property which should even enable different texture coordinates.

I haven't checked locked meshes as I guess it won't do anything useful for animated models.

I still hope that some developers with more artistic skills join so my models are placeholders ;)

Just off the top of my head, a thought: have you tried using SharedNodes instead of clones? That should give you an enormous performance boost… and afaik, it allows for changing of RenderStates, too.