Share animated models

hi community,



is it possible to share geometry data if it is animated? right now, i'm using a high poly spider (5k), and i need to clone the spatial including its jointcontroller to make everything work. using a sharednode doesn't, at least the last time tried. i'll be running into memory problems here because there will be a lot of corpses lying around in the later parts of hhexen, so…is there a way to share animated models? (not using jme 2.0 yet)

i am also looking for a way to share animated models to help performance!

why do the dead corpses need to have their mesh data updated?





I don't think there is a way (but could be wrong) what you could do is have a queue of say 10 controllers, when a new spider is needed check to see if there is any free controllers, if not just use one of the 10 that are already going; this will make it look like there is lots of different animation, but only 10 different at any time.  When a spider dies remove the controller from its node and if it is the last using its controller put it back into the 'free' queue.  (this was my idea when I get to that point in the project I am working on)

My recently updated Mesh.XML importer library supports efficient instancing of animated models.

Animating 961 simple instanced models with software skinning, automatic frameskip and indexed LOD gives 30 fps and 8 MB increased mem usage.



In your case, if your model has 5,000 verts + normals then it will take 120 KB with software skinning for each model + the skeleton (10 - 20 KB, depends on number of bones), for hardware skinning, it will only take the cost of the skeleton as the geometry data is completely instanced.

What I suggest you do, is take the spider, forward the death animation to the last frame, and make a model of that. When the spider is marked as "dead", you simply replace the animated model with the static "dead spider" one. That way you can share it + create VBO for it + optimize it and more.

Momoko_Fan said:

My recently updated Mesh.XML importer library supports efficient instancing of animated models.

... and sounds more and more awesome every time I read about it! Can the output of your loader be saved using standard jME serialization to gain a bit in loading times? Oh, and have you published it separately or can we get it by checking out the radakan source?

Back On Topic:
Long long ago, I made a mechanism to share KeyframeController based animations for my own purposes (saying that it works very well under the exact conditions I needed it for, but is otherwise incomplete and untested).
If there is any interest I can try to isolate the code and publish it. It would probably even make a good feature to go into jME itself, but I'm afraid that it would need a bit more work than I am currently able to contribute.
If somebody feels like volunteering, all the better!

Does the mesh.xml implementation support blending between animations?



Another nice feature would be animation mirroring, I've implemented it in the md5Importer using naming conventions for the bones, "L_foot" would be given the translation and orientation of "R_foot" and vice versa.



Really looking forward to this! Maybe it can solve my pipeline woes.

Can the output of your loader be saved using standard jME serialization to gain a bit in loading times?

Some parts like OgreMesh correctly export to jME. Other parts like the MeshAnimationController do not implement the export and import methods yet.

Oh, and have you published it separately or can we get it by checking out the radakan source?

You can only get it by downloading it from the Radakan source. We recently moved over to googlecode, see this page: http://code.google.com/p/radakan/

Does the mesh.xml implementation support blending between animations?

No support of blending yet, but should be fairly easy to add.

Another nice feature would be animation mirroring, I've implemented it in the md5Importer using naming conventions for the bones, "L_foot" would be given the translation and orientation of "R_foot" and vice versa.

I don't understand why do you need this. Usually you would want different transforms for each bone? Either way, I added some basic "user control" mechanism to bones so you can e.g use Wii controller input or IK solver to move the bone around. Perhaps you can use this feature to mirror your bone's animation for whatever purpose you need it for.

I could make this a community project, in that case, I will accept contributions and fixes from other users. Because this importer is not as complete as I would like it to, I think that's exactly what I will do..
Quote:

I don't understand why do you need this. Usually you would want different transforms for each bone? Either way, I added some basic "user control" mechanism to bones so you can e.g use Wii controller input or IK solver to move the bone around. Perhaps you can use this feature to mirror your bone's animation for whatever purpose you need it for.


The main use would simply be to cut down on the amount of animations required, both included in the project and also created by artists. If you think of a boxing game for instance, you would need to animate both the left and right hook. If you could simply make the right hook, and have the system mirror it, hey presto, you have yourself a left hook! Especially for web based apps where both download speed and memory is at a premium (in the case of an applet) I could see this feature being very useful.

I'm not opposed to altering the code and giving it back to the community so I would really like to see this as a community project! I'm gonna try and give the code from the Radakan svn a test run today and I'll let you know my feedback.

This may be getting a little off topic - but I'll give it a go anyway!



I grabbed the latest source for the mesh.xml importer and got it working with my app. I have exported a few of my models from maya using the latest maya 7.0 exporter.



What I have noticed is that if I leave the "use shared geometry" option selected, then inside jme the model shows up without any texture, or I should say it IS textured, but it's all one colour, as if it's only applying one pixel from the texture or something like that. I have viewed the binary .mesh file in CEGUIMeshViewer and the textures are fine there. I have exported the same model and deselected the "use shared geometry" option, and now it textures ok in jme.



I have also tested the robot model that comes with ogre and is in the world.pak file of Radakan and it textures correctly, looking at the xml though it doesn't use shared geometry, maybe this is a bug?

Sharedgeometry models used to work before but now support is sketchy due to bone animation stuff integrated and other changes.

Ok, I'm not going to pretend to understand exactly why it's broken, but I have come across something which may be of use to some!



Once you have exported the model from maya with the shared geometry flag turned off, if you run the MeshMagick tool (available from OgreCommandLineTools package on ogre3d) on the mesh and skeleton it will drastically reduce the size. Essentially it just removes duplicate vertices, my model went from 5.5. MB to 1.3MB.