[solved] Creating humans with makehumans and importing them in JME


#1

Hello all,

I’m having troubles trying to properly import and use models from Make Humans.
I’m following this tutorial:
https://wiki.jmonkeyengine.org/jme3/advanced/makehuman_blender_ogrexml_toolchain.html

My main problem is that i get the following error when i try to use the animation i created:

java.lang.ArrayIndexOutOfBoundsException: -3
at com.jme3.animation.CompactVector3Array.deserialize(CompactVector3Array.java:95)
at com.jme3.animation.CompactVector3Array.deserialize(CompactVector3Array.java:42)
at com.jme3.animation.CompactArray.get(CompactArray.java:132)
at com.jme3.animation.BoneTrack.setTime(BoneTrack.java:232)
at com.jme3.animation.Animation.setTime(Animation.java:110)
at com.jme3.animation.AnimChannel.update(AnimChannel.java:403)
at com.jme3.animation.AnimControl.controlUpdate(AnimControl.java:332)
at com.jme3.scene.control.AbstractControl.update(AbstractControl.java:112)
at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:570)
at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:688)
at com.jme3.scene.Node.updateLogicalState(Node.java:145)
at com.jme3.scene.Node.updateLogicalState(Node.java:152)
at com.jme3.scene.Node.updateLogicalState(Node.java:152)
at com.jme3.scene.Node.updateLogicalState(Node.java:152)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:244)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:744)

Here is the part of code which loads the model and try to start the animation:

        Spatial test = assetManager.loadModel("Models/gael2/Gael.mesh.xml");
        Node animate = (Node) test;
        test.setLocalScale(0.15f, 0.15f, 0.15f);
        test.setLocalTranslation(5.0f, 0.2f, 0);
        AnimChannel channel;
        AnimControl control;
        control = animate.getControl(AnimControl.class);
        channel = control.createChannel();
        channel.setAnim("my_animation");
        channel.setSpeed(1f);

I checked the name and existence of animation, this one exists (there is another error when there is no animation in the model or when i type a wrong name).

Here is the model i try to import:
http://37.59.1.7/make_human_test.zip
(There is the blender file with one animation and the ogre exported file)

I don’t understand where the error is, as i said in a previous topic, i’m far from being an expert in animation, this was kinda the first test to see if i can make it using Make Human.
When i don’t try to start the animation (removing the 2 last lines of my code), the model is displayed.

Have someone faced a similar problem when using Make Human and managed to solve it ?

Thanks in advance,

Gaël


#2

Try the XBuf and/or GLTF Pipeline for Blender->j3o and load the j3o format, Ogre and especially .blend files is somewhat bugged sometimes, we should try fixing this but ogrexml is somewhat limited anyway


#3

That wiki page is a bit out-of-date: it’s based on MakeHuman 1.0.2 .

I tried loading Gael.mesh.xml in JME 3.2.1 and hit an assertion failure in SkeletonLoader. Apparently one of the keyframes in an animation is lacking position data. Very unusual, I believe.

I encountered the same issue with Gael.scene.

Importing Gael.blend directly (using jme3-blender-3.2.1-stable.jar) seemed to work fine, however.

Can you skip the Blender->Ogre export step and go directly from Blender->J3O using jme3-blender or the SDK?


#4

What script version are you using for Ogre? Where did you get it?


#5

My troubles where probably because o was using the version 3.0 of the SDK.
Import worked when i used the SDK to convert from *.blend to *.j3o but the model was without any animations because it seems it was not supported yet. That’s why i was trying to use ogre exporter (and also because the tutorial was telling me to do it).
I used ogre exporter from here: http://wiki.ogre3d.org/Blender+Exporter.

I installed the new version of the SDK (3.2.1 stable).
I saw that animations are supported now, but when i tried to import my model, i’ve got another error i don’t understand:

An Exception has occured when trying to load asset Gael
com.jme3.asset.AssetLoadException: An exception has occured while loading asset: Models/gael2/Gael.blend
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:261)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:53)
	at com.jme3.gde.core.assets.AssetData.loadAsset(AssetData.java:130)
	at com.jme3.gde.modelimporter.ImportModel.copyModel(ImportModel.java:208)
	at com.jme3.gde.modelimporter.ImportModel.access$000(ImportModel.java:63)
	at com.jme3.gde.modelimporter.ImportModel$1.run(ImportModel.java:102)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Unexpected importer exception occured: name
	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)
	... 9 more
Caused by: java.lang.IllegalArgumentException: name
	at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:693)
	at sun.misc.URLClassPath.findResource(URLClassPath.java:215)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
	at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
	at com.jme3.asset.plugins.ClasspathLocator.locate(ClasspathLocator.java:98)
	at com.jme3.asset.ImplHandler.tryLocate(ImplHandler.java:178)
	at com.jme3.asset.DesktopAssetManager.locateAsset(DesktopAssetManager.java:191)
	at com.jme3.scene.plugins.blender.textures.TextureHelper.loadImageFromFile(TextureHelper.java:522)
	at com.jme3.scene.plugins.blender.textures.TextureHelper.loadImageAsTexture(TextureHelper.java:246)
	at com.jme3.scene.plugins.blender.textures.TextureHelper.getTexture(TextureHelper.java:154)
	at com.jme3.scene.plugins.blender.textures.TextureHelper.readTextureData(TextureHelper.java:616)
	at com.jme3.scene.plugins.blender.materials.MaterialContext.<init>(MaterialContext.java:100)
	at com.jme3.scene.plugins.blender.materials.MaterialHelper.toMaterialContext(MaterialHelper.java:176)
	at com.jme3.scene.plugins.blender.materials.MaterialHelper.getMaterials(MaterialHelper.java:258)
	at com.jme3.scene.plugins.blender.meshes.MeshHelper.toTemporalMesh(MeshHelper.java:118)
	at com.jme3.scene.plugins.blender.objects.ObjectHelper.toObject(ObjectHelper.java:171)
	at com.jme3.scene.plugins.blender.BlenderLoader.load(BlenderLoader.java:105)
	... 11 more

#6

Note: it’s going to basically be impossible for the blender loader to ever work ‘correctly’. It’s a nice idea but an impossible target.

Today everyone is pinning their hopes on gltf and in my experience it’s been very good so far.


#7

I just tried to export in gltf format from Blender (using that script: https://github.com/KhronosGroup/glTF-Blender-Exporter)
But i have the following bugs:

  • Program crashes when shadow is on on the model (a bug with bones).
  • When shadow is off, the model is present on the scene but it’s almost invisible, i just see the shape of it “masking” transluscent objects around.
  • If i try to activate the animation, i got a NullPointerException on the createChannel line.

For me gltf is not that good…
I usually create my objects/buildings with Google Sketchup and i import them using the Collada format, but it don’t works for animated models.


#8

oh god, I made this post 5 years ago =( … dunno but there may be something in here that helps : Adventures in BVH MoCap, Blender and JME


#9

Well, there is at least hope with gltf because it works fine with well formed models.

.blend is an impossible format to chase because it is not an interchange format. Blender can and will break it with each new version.

So for animations you are left with the old ogre format or gltf… which works fine in a lot of cases but it at least still being actively developed by a larger community.


#10

That version has the correct ogre script (0.6.0) under the tools>ogrexml.

The ogre script you used will not work with the sdk.
The correct script(0.6.0), as was stated in the tutorial, is in SDK 3.2 where I pointed out above, or
https://wiki.jmonkeyengine.org/jme3/advanced/ogrecompatibility.html.

Ditto what paul said.

Edit: that script you used was also the one they used for SDK 3.1 and below. No one knew at the time it was bad.

You may want to restart the SDK also. That exception seems to make it go wonky.

Edit: This is what reveals when someone uses the wrong ogre script with SDK.

java.lang.ArrayIndexOutOfBoundsException: -3

#11

We should definitely look into the GLTF issue, so an example file might be appreciated.
I can only tell that my MakeHuman->Blender->XBuf works, however when I use MakeWalk for BVHs, I need to reparent the Armature or else the animation looks deformed (dont ask me how to do that :smiley: , I have to do research every time)


#12

Just as a side question is there any reason Import Blender is still in the IDE?


#13

For the same reason there also is an ogre import: legacy/comfort. Many people still use Blender Import today and without animations or complex modifiers it’s quite passable. The SDK also supports gltf and xbuf though.


#14

Well i tried two things:

  • Install the Ogre export scripts from the SDK instead of using the downloaded ones: It changes nothing.
  • Using XBuf instead of gltf: Animation is not here and model’s textures are not imported.

I just don’t understand why i struggle so much in that thing, all i wanted to do was to do a little test of animation and i ends up installing and trying tons of versions of differents softwares/add ons with almost no results…
How are you guys doing animations generally ? I was thinking that the bone model of blender was the most common way to do it (as the tutorials shows), maybe i’m wrong and all of this is outdated ?

I’m thinking of doing human animating by doing a mesh for each part (arm, leg, trunk, head etc …) and managing the position and rotation of them instead of one big animated mesh. Maybe it won’t look that good but at least it will works as i don’t have to import animations.

JMonkeyEngine is really fantastic for lots of things, everything is simplified compared to technologies i used before and without restrictions, it’s very powerful ! But when i comes to animating a human, it suddenly become the hardest thing i every tried in my whole I.T. life, very frustating.


#15

Probably this is also the same issue with Ogre, it seems that they need the Animatiojns (Actions?) all being present in the NLA Strip or something.

The textures aren’t there because you probably forgot to set asset path.
Xbuf works like this:

  1. Install Plugin
  2. Set Renderer to XBuf Renderer
  3. In Render Options, select the asset path
  4. select all (A)
  5. Export

Maybe 2 and 4 aren’t required, but I always do them


#16

I just checked this out and the problem is no nla strip for ogre.

Also, the file is set on cycles render so that means you have to use the gltf nodes and that is not even setup.

The model is massive in scale so that needs to be addressed.

Easiest fix is to learn how to use blender (search for Neal Hersig on the forum) but to get you on your way, first change to blender render.

Assign your textures to the images listed if they are not already assigned. The image preview under textures will be black if not assigned.

In the animation screen layout, select your skeleton, then in the dope sheet editor, next the the “new button”, select the Gael action to make it active and then push it down into the stack to make an nla strip. You can see the strip by changing to the NLA editor.

To export in ogre, select the skeleton and mesh, and then under file, export as ogre.

Then in the export panel on the bottom left, toggle selected only, armature animation, and increase the trim weights to a higher number until the export doesn’t bitch about to many bones being weighted when you export. I just set it to .12 arbitrarily.

After you get a clean export, rename your material file to just Gael.

Convert to j3o and your set.

I wont go into how to use gltf because you should probably learn blender first. Search for gltf on the fourm if you want detailed info on that. It uses the cycles render you had set.


#17

I know I am late to the party, since you have moved on from trying the GLTF format and have spent time trying many formats. However, I have had very similar errors with GLTF when I was getting used to it at first, and maybe some of the errors you are running into are the same.
I also use GLTF to export MakeHuman models, so I can hopefully help you figure out where the problem is if you decide to go back to the GLTF exporter.

I ran into this error, and it was caused because I was rendering muiltiple light probes when my scene was loadiing. I am not sure if you are using Light Probes in your scene - but this error disappeared whenever I stopped generating my LightProbes at run time:

May 22, 2018 8:48:26 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Shadow/PreShadow.vert, defines, type=Vertex, language=GLSL150]
0(158) : error C0000: NUM_BONES must be between 1 and 255.
0(165) : error C1043: size of dimension cannot be less than 1

	at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1269)
	at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1296)
	at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1360)
	at com.jme3.material.logic.DefaultTechniqueDefLogic.render(DefaultTechniqueDefLogic.java:94)
	at com.jme3.material.Technique.render(Technique.java:166)
	at com.jme3.material.Material.render(Material.java:974)
	at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:598)
	at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
	at com.jme3.renderer.queue.RenderQueue.renderShadowQueue(RenderQueue.java:275)
	at com.jme3.shadow.AbstractShadowRenderer.renderShadowMap(AbstractShadowRenderer.java:439)
	at com.jme3.shadow.AbstractShadowRenderer.postQueue(AbstractShadowRenderer.java:412)
	at com.jme3.shadow.AbstractShadowFilter.postQueue(AbstractShadowFilter.java:118)
	at com.jme3.post.FilterPostProcessor.postQueue(FilterPostProcessor.java:241)
	at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1103)
	at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)
	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:197)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
	at java.lang.Thread.run(Thread.java:748)

	

May 22, 2018 10:42:15 PM com.jme3.app.LegacyApplication handleError	
	java.lang.ArithmeticException: This matrix cannot be inverted
	at com.jme3.math.Matrix4f.invert(Matrix4f.java:1455)
	at com.jme3.math.Matrix4f.invert(Matrix4f.java:1427)
	at com.jme3.shadow.AbstractShadowFilter.preFrame(AbstractShadowFilter.java:110)
	at com.jme3.post.FilterPostProcessor.preFrame(FilterPostProcessor.java:368)
	at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1078)
	at com.jme3.renderer.RenderManager.render(RenderManager.java:1158)
	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:197)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
	at java.lang.Thread.run(Thread.java:748)

The next problem with transparency is a simple export error where the GLTF exporter is assigning your material to have a BaseColor with an Alpha value of 0. If you open up the material for your transparent objects in the SDK, you will most likely see that the Color is invisible (ex: 1.0, 1.0, 1.0, 0.0). I’m not sure why the GLTF exporter does this, but my MakeHuman models are always exported with invisible hair, so I have to manulally correct the material’s BaseColor value

And your last problem might be due to the Node hierarchy that blender uses when it exports your models from blender in GLTF format. Do you also get this null pointer error if you try to run the animation in the SDK? Or do the animations run fine in the SDK’s scene editor?


#18

I’m wondering if an assimp importer could be beneficial here? Lwjgl 3 has bindings for it now. I might look into it.


#19

I tried this but i don’t understand how i can push down the GaelAction into the stack to make an nla strip.
Nothing look like a stack, nothing is named NLA on my screen (i suppose it’s the animation panel in which i can see the different frames ?).

I know i should actually learn Blender, for now all i did with it was this tutorial for animating with it:
https://drive.google.com/file/d/0B9hhZie2D-fEYmRkMTYwN2YtMzQ0My00NTM4LThhOTYtZTk1MTRlYTNjYTc3/view?hl=en
It worked well on that small example (and on another small non-human model i made), and i thought it would be the same with a model from Make Human, just with more bones to manage.

I know the model is massive, i don’t understand why because when i do MakeHuman -> Collada -> Jme3 it has the correct size


#20

Yes. To see the stack, when in the animation layout, at the left side, you will see this dope sheet button.

Click that and change it to NLA Editor.
If you see this,


With the skeleton selected, click the button and it will push it down into the stack.

Select the skeleton and mesh then file export it using ogre, following the rest of the instructions above.

If you dont see what i showed and you have a mess on your hands in the nla editor, just select an item, hit the X and clear everything untill you have nothing.

Go back to your dope sheet editor and select the dope sheet button and change it to Action Editor. Select your action and push it down into the stack from there.


remember to have the skeleton selected.

Go back to your NLA editor and check to see if its there, export and follow directions above.

Great thing is if you follow this mixamo tutorial, you can animate models quickly, append all your animations, and push into stack from there real fast.

Edit:
GLTF is definately what you need to learn but this will get you started and familiarize you with Ogre. Not sure if it will still work after Blender 2.8.