New MD5 loader for JME

We're a student group currently working at a project to make a new Md5 importer for jMonkey. We think that it is possible to make one that works more smoothly than the existing one. One of the requirements for the project is to make an integrated importer which uses code already created in jMonkey. We have tried out a couple of the different Controllers like JointController (which we couldn't make work), KeyframeController(which we made work), and BoneAnimation with Bone, SkinNode and BoneInfluence which we are currently working on and which hopefully will be the best solution.



We have made custom classes for handling data from the md5mesh file, and some methods for computing and sorting the data which we need for converting the file. The model is represented by a Node which contains a Bone (the root joint) with children and a SkinNode for each mesh in the file. These are connected.



The model now loads, and the animation seems to be correct, but there is a problem with vertices with multiple weights. Right now we precalculate a mesh for the SkinNode, and send in BoneInfluences to each vertex in the mesh based on the corresponding joint and its weights.



This is obviously wrong since the calculation of vertices in the animation depends on the position of each weight. We've tried to create dummy bones which actually are weights, but have failed to figure out a way to make this work. Does anyone have any suggestions about how to resolve this problem?





We are also puzzled by the fact that we have to use the baseframe position and orientation to make the model look right instead of just the position and orientation for each joint.



Here you can look at our code:

http://pastebin.com/d3837777c






http://www.jmonkeyengine.com/jmeforum/index.php?topic=7239.msg57143#msg57143

Here is a video of what we got as of now…

to the left is the mesh loaded without and bones/influence and such…

to the right is the same mesh with added BoneAnimation, and as you can see the weights aren’t exactly right.



http://www.youtube.com/watch?v=LAsQMrOwrIc



We are cleaning the code now, but if anyone wants to have a look, we can paste the not so clean code :slight_smile:

FruBlom said:

This is obviously wrong since the calculation of vertices in the animation depends on the position of each weight. We've tried to create dummy bones which actually are weights, but have failed to figure out a way to make this work. Does anyone have any suggestions about how to resolve this problem?


The problem is probably caused by an incompatibility between jME skinning system and MD5 skinning system. neakor, with his MD5Importer already encoutered problems in almost the same area and had to move to a custom implementation.

FruBlom said:

We are also puzzled by the fact that we have to use the baseframe position and orientation to make the model look right instead of just the position and orientation for each joint.


I do not understand well what you mean. Though, you should pay attention to MD5 specification. Base frame is used to build all the other key frames. Though, the way your model is calculated depends on your implementation.