Problem with animating a mesh with multiple materials

Hey everyone,



for sme time I am trying to solve a problem with mesh displacement that occurs for some models when imported with blender importer.

The problem occurs whan a model in blender has a skeleton and more than one material used on a single mesh.



Because jme does not support multiple materials for one mesh, the importer splits the model into separate meshes, each one with its own material, and stores them in one Node.

When such model has a skeleton attached the mesh becomes very much displaced. In general - total chaos :slight_smile:

I inspected the buffers (Position, BoneWeight and BoneIndex) and they look ok to me.

I have no idea what might be wrong with that and I would like to ask for help from someone who has better knowing of the wholse Skeleton - Mesh interaction in jme.



The model where this can be seen is attached to this issue:

http://code.google.com/p/jmonkeyengine/issues/detail?id=538&q=label%3AProduct-jME3%20owner%3AKaelthas_Spellsinger%40o2.pl&colspec=ID%20Type%20Status%20Component%20Priority%20Difficulty%20Product%20Milestone%20Owner%20Summary



If you separate the hair from the model as a separate object or change the hair meterial then the model should load fine.



And here is an issue with another example model (Skink Engine):

http://code.google.com/p/jmonkeyengine/issues/detail?id=540&can=1&q=label%3AProduct-jME3%20owner%3AKaelthas_Spellsinger%40o2.pl%20status%3DFixed&sort=id&colspec=ID%20Type%20Status%20Component%20Priority%20Difficulty%20Product%20Milestone%20Owner%20Summary



If anyone has any hint on what might be wrong there please let me know. Even the slightest idea migh be helpful.



Cheers,

Kaelthas

I’m pretty sure this works with the ogre exporter as i already had the case, something must be wrong when the splitting occur in the blender loader.

Or maybe you should apply the transforms to the blender model before importing it into JME, maybe the splitting “resets” the unapplied transformations.

One of the largest changes made was not allowing sharing of VertexBuffers between Meshes. For this reason, we have a Mesh.extractVertexData() which uses the index buffer of the current mesh to extract vertices from a target mesh. @Kaelthas: do you think the issue is in extractVertexData() or the Blender importer?