Importing from Blender with Animations?

Allright. It has been a lot harder than I had thought. I have tried pretty much everything I can imagine, so now I’m asking help… Here is what I have already tried:

  1. Just use jme3-blender?
    Nope. The importer crashes when loading a model from Blender 2.7.7 with following error message:
    Caused by: java.io.IOException: Unexpected importer exception occured: The pointer points to nothing!
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:223)
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:88)
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
    … 12 more
    Caused by: java.lang.NullPointerException: The pointer points to nothing!
    at com.jme3.scene.plugins.blender.file.Pointer.fetchData(Pointer.java:87)
    at com.jme3.scene.plugins.blender.animations.AnimationHelper.getTracks250(AnimationHelper.java:237)
    at com.jme3.scene.plugins.blender.animations.AnimationHelper.getTracks(AnimationHelper.java:206)
    at com.jme3.scene.plugins.blender.animations.AnimationHelper.loadAnimations(AnimationHelper.java:57)
    at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:97)
    … 14 more

    And to make it worse, Blender 2.6.x doesn’t open that model correctly.

  2. Use xbuf?
    Xbuf exporter seems to work, but jME xbuf loader doesn’t:
    java.lang.NoSuchMethodError: xbuf_ext.CustomParams.registerAllExtensions(Lcom/google/protobuf/ExtensionRegistryLite;)V
    at jme3_ext_xbuf.Xbuf.setupExtensionRegistry(Xbuf.java:77)
    at jme3_ext_xbuf.Xbuf.(Xbuf.java:68)
    at jme3_ext_xbuf.XbufLoader.load(XbufLoader.java:25)
    at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
    at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
    at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
    at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
    at com.ritualsoftheold.client.ClientPlayer.initialize(ClientPlayer.java:71)
    at com.ritualsoftheold.client.state.IngameAppState.initialize(IngameAppState.java:51)
    at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:251)
    at com.jme3.app.state.AppStateManager.update(AppStateManager.java:281)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:236)
    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(Thread.java:745)

    Ouch. Apparently it misuses Protobuf API. If I didn’t use Gradle to add it as dependency, I’d think I had wrong version of Protobuf in classpath.

  3. OgreXML?
    Blender OgreXML exporter does not create scenes or meshes that jME could import. Materials are missing… Exporter isn’t probably compatible with Blender 2.7.7.

  4. Wavefront obj?
    Not an option, since animation support is needed.

So, any ideas?

1 Like

You are doing something wrong here!
Ogre should work without any problems, but it could be that, you have to rename the material, that’s why the message “Material missing” is showed up. For example you have the file “mymodel.mesh.xml” then your material file must have the name “mymodel.material”.
Please try it again and tell me if it works or not.

1 Like

Ogre exporter from Blender is telling me that it couldn’t find any materials, and I have confirmed with 3D artist that everything should be correct in the model.

I’ll check with him again, just in case we missed something.

1 Like

Can you test with this version https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java/3.0.0 ?
I once had the same problem.
I suggest to use gradle.
v0.9.1 is not released to jcente i think but you can build from git.
JitPack | Publish JVM and Android libraries

Just add these to your build.gradle

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

dependencies {
                compile 'com.github.xbuf:xbuf:0.9.1'
	        compile 'com.github.xbuf.jme3_xbuf:jme3_xbuf_loader:0.9.1'
	}

You should also use the latest version of xbuf blender plugin (because of protobuf version match). Just go GitHub - xbuf/blender_io_xbuf: Delegate rendering to an external render engine (eg provided by game engine) and download it as zip (without unzipping it) and open blender File → User Preference → Add-ons → install from file

and finally assetManager.registerLoader(XbufLoader.class, "xbuf");

Also you may want to watch these tutorials for importing animated models to jme

Edit: If you do not want to bother with steps above, you can download JME SDK and convert your .xbuf model directly to .j3o by right clicking on it and “convert to j3o”.

2 Likes

I meant I do use Gradle and so think it can’t be old Protobuf. But thanks for other advise. Will try that later today when back home.

1 Like

Seems to work, except the animations. loadedModel.getControl(AnimControl.class) returns null.

Did I miss something here?

1 Like

I personally use Blender format, but I need to bake animations for them to work in JME.

1 Like

See this thread

1 Like

Hmm, another issue here. I baked animations in Blender, then exported to OgreXML, then tried to convert to j3o again…
java.lang.IllegalArgumentException: for uniform m_BoneMatrices: value cannot be null
at com.jme3.shader.Uniform.setValue(Uniform.java:210)
at com.jme3.material.Material.updateShaderMaterialParameters(Material.java:806)
at com.jme3.material.Material.preload(Material.java:846)
at com.jme3.renderer.RenderManager.preloadScene(RenderManager.java:665)
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:282)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:135)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:757)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:723)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:733)
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(Thread.java:745)

It looks like something went wrong… Note that this does not happen when I load the model, instead it happens at update tick. Animations might work, but rest of model doesn’t!

1 Like

Apparently that j3o file was corrupted somehow. I createe a new one… And exporter from Blender to Ogre, then used SDK to convert to j3o

One problem. No nodes (including subnodes) included animations. Ogre files did contain them, I verified this from exporter console log.

1 Like

Allright. I have done a lot more testing, and found out the following.

  1. Blender importer is not actually usable with this model.

  2. Xbuf does not export animations correctly.

  3. OgreXML exports animations correctly but jME fails to import them.

Ideas?

1 Like

Can you upload your model to somewhere? I can give it a try.

1 Like

Yeah I’ve never had problems with the ogre export/import method so I can try it too

1 Like

@bensku,

What is the issue with xbuf ? (if you can share .blend it could help)

2 Likes

Here it is: Dropbox - PlayerModel.blend - Simplify your life

Recently I found out that there has been an update on FBX importer. I haven’t yet tested that extensively, but initially it complained about not having triangulated meshes after I had done exactly that in Blender. I still need to check with the 3D artist of this model to see if I did something wrong.

Note that this is a scene; there are clothing+hairstyles available, but they are now hidden (character is naked). There are also multiple animations (walk, run, sit), which should work on jME.

Note that I’m no 3D modelling expert; I have no idea if there is something really stupid there. The modeller who did this was confident that he had followed instructions, but I’m not sure if this page is up to date.

This .blend is not triangulated, but I have ran all tests with a copy that was, too. It did not seem to affect anything.

@david_bernard_31 There are two issues with xbuf. First, some textures do not appear to be working - they do work if I use OgreXML. Second, animations do not appear to exist for jME.

1 Like

Your blender file looks like a mess. In my opinion the problematics you are facing are related to the non following of some standards for JME compliant models.

One of the problematics for example would be applying rotation, scale and location. Animations exist under node named “Body”, however they don’t play correctly because of the models problematics.

Yes, blender file looks like a mess.
There are more than one Armature modifier for each mesh. (There should be just one otherwise you will get some bunch of errors when loading in JME).

Also Scale of rig is not applied (it is 0.15). You should apply Scale/Location first, before adding any animation. Applying Scale now (after adding animation) will screw up all scale keyframes and you will have hard time fixing them in Graph Editor.

Ouch. Apparently I need to have serious talk with my 3D modeller…

Thanks for your help! I wouldn’t habe figured out this without you :slight_smile: