I’m learning how to animate and I’d really like to make a character whose meshes can be switched out on the fly (imagine equipment in an RPG), and although I’ve gotten really far, there are a few things that I haven’t got right.
My first issue is that, for each mesh the ogre exporter creates, the entire skeleton with all the animations (even unusable stashed ones) are included, resulting in a 4 meg skeleton xml PER BODY PART, and the export process takes way too long.
I probably could edit the exported mesh files to point to a single skeleton file, but hard drive space is not the real issue here.
My animations are all on the armature object, and due to the parenting, the body part objects are in turn children of the bones, which is probably why the whole structure is included for each.
I have tried to join the meshes together in blender before exporting but i have not managed to get anything working that way.
I did however succeed in combining different animations per body part (only an upper and lower half seems necessary atm), which looks like this: https://drive.google.com/open?id=1-UW_gJW-0LpeV7m1r1O_YK0DDXv_ZbqQ
The skeleton copy in front of the guy shows the skeleton attached to the HEAD object, where you can see that unrelated bones are included (anything underneath the spine and sidewards from the neck), but at least the animation for each part is now filtered from the root bone to the mesh’s bone. (you cannot see the hand swing, etc)
Some further research done, apparently trying to recreate the skeletons with the “irrelevant” bones removed was a bad idea. The animations seem to be set up in a way that references every bone of the original structure so the missing bones will cause crazy stuff to happen.
I did however manage to code an animation frame limiter which would help improve performance, if needed. All it does is disable the skeletonControl & animControl while setting time manually, which is a bit hacky but it works.
At 100 animated dudes on screen I had 72 FPS, and by slashing the animation framerate to 1/3, the scene rendered at 190 FPS, so using some LOD tricks would be very viable.
Then I tried to compare that to 100 oto golems and had a few thousand FPS difference… erk.
I’d really appreciate if someone could tell me how to optimize the export in the first place
I managed to do this a few months ago, but ended up accidentally tossing out the code since it was more of a learning excerice, I guess I procrastinated making more than one character for too long.
But if I remember correctly, I exported a model from blender with multiple parts/materials (all attached to one skeleton) and all of the parts were joined together - I found it was necessary to join all my object in blender (ctrl-j) and to have everything selected at export time for the ogre exporter to work right.
Then I converted my model to j3o format, copied it and pasted a second version, and I removed the skeleton from the first j3o file. Then I removed the spatial from the second j3o file, this way you have a scene with the skeleton and a scene with the spatial.
Now you’d be able to apply that skeleton to any model that has matching vertex groups
As for the other issue you mentioned about exporting with the ogre exporter,
I haven’t used the ogre exporter in a while since I switched to the GLTF exporter, but if I remember correctly, this was the only way I could get my ogre models working. I had to join all the meshes together and then create a single keleton for that joined mesh if i recall. But i also didn’t quite understand the ogre exporter as well at the time, so hopefully someone who’s better with the ogre exporter can offer some insight in regards to the trouble you’re having exporting a model with more than one mesh / material.