[SOLVED] Animation in Jmonkey is distorted

So I load my character animation (bottom picture) which looks fine in Blender into Xbuf loader for JME3 but the animations become very distorted (top picture). I’ve found out that removing bones on the person’s face fixes the problem but I’m still perplexed as to why this happens in the first place.

Can someone explain what I’m doing wrong?

And yes, the mesh and the armature are at 0,0,0, the scale is 1,1,1, etc.

Do you get the same type of distortion from Ogre and just importing the .blend?

I had the same problem using Jme importer. Solved it by switching to Ogre.

I don’t use Ogre, just the Xbuf loader that allows to make .j3o files from Blender.

I used to use Ogre but I’ve swithed to JME Xbuf loader because I kept getting other errors.

Did you apply trasformations in blender?

I assume I did or don’t need to if rotation and position of the mesh and skeleton are 0,0,0 and the scale is 1,1,1.

Mmh,still try to re-apply trasformations and export the model. This is exactly what happens when trasformations are not applied,but there could be another cause.

I did so but it still does not work properly. I’ve mentioned before that removing bones from the face solves the problem so I thought that maybe those bones get the wrong vertices but everything appears to be fine in Blender regardless.

What’s the “root” bone? Maybe the issue is related to that.

Does it have to be in the centre at all times? Because I use it for animations.

No you can use the root bone I’m sure. Death animations would be tough if you couldn’t rotate a lower spine, which is often the root bone to an upper armature.

The error seems very much like the armature, mesh, offset issue.

This can be very tricky to actually track down*

I can’t tell you how many times I’ve though I’ve properly applied all the issues. Scale Rotation and Translation need to be applied and still get a p[roblem. Also remember this is done with the skeleton in object mode. Try switching between object and edit modes with both the skeleton and mesh and check scales and rotations etc.

If you have the same issue with other formats like ogre, or the regular jme importer it’s the model.

If it works okay, then it must be the xbuf. I’d start there

Ok, but why does this happen only when I remove the bones on the face?

I tried exporting the model using Ogre but the problem persists so I know something is wrong with my model. What could it be if my model has transformations applied and so on?

Ok, I think I’ve found the problem: after having tested out with some iterations of the same file, I’ve concluded that there is a bone limit for animated models up to approximately 249 bones. Thanks for those who took the time to try to help.

Hmm… I did not know there is a limit for bone counts !?
@david_bernard_31 do you confirm this ?
If it is true then I should be careful about bone counts on my models. Until now the max bones I have used is 64 :wink:

If there are to many bones I get this error:

com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Misc/Unshaded.vert, defines, type=Vertex, language=GLSL150]
0(45) : error C0000: NUM_BONES must be between 1 and 255.

at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1200)
at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1227)
at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1291)
at com.jme3.material.Material.preload(Material.java:845)
at com.jme3.renderer.RenderManager.preloadScene(RenderManager.java:665)
at com.jme3.renderer.RenderManager.preloadScene(RenderManager.java:656)
at com.jme3.renderer.RenderManager.preloadScene(RenderManager.java:656)
at com.jme3.animation.SkeletonControl.testHardwareSupported(SkeletonControl.java:164)
at com.jme3.animation.SkeletonControl.controlRender(SkeletonControl.java:281)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:135)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:756)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:723)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:712)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1086)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1145)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Unknown Source)

This leads me to believe that there is a bone limit, note this line:

    0(45) : error C0000: NUM_BONES must be between 1 and 255.
1 Like

99% sure the bone limit is related to hardware skinning. We are limited to how much we can pass to the shader I guess.

1 Like

Yes ^

Sorry for my bad English.
About this issue, I´d like to report about an Exception.