[Solved] Does the Blender importer work with Animations?


#21

Never mind. Apparently my export sucks.


#22

If the asset doesn’t appear after a gltf export, restart the jdk. Usually happens if the sdk throws an exception related to a blender export. That’s been my experience with gltf and sdk.


#23

Well in that case, Bob forgot to copy the .bin file along with the gltf (sometimes gltf files are split into gltf and bin, don’t ask me what and why)


#24

To export the file, click on the File menu, hover over the Export menu option, and click either glTF 2.0 (.glTF) or glTF 2.0 (.glb). The difference between the output is that a .glTF will export a glTF file, a binary file for the mesh, and all of the textures as individual files where the .glb will export only one binary file with everything contained.


#25

So that got over the can’t find “bin” file issue. Up comes a new one :frowning:

An Exception has occured when trying to load asset Cubie
com.jme3.asset.AssetLoadException: An error occurred loading Models/Cubie/Cubie.gltf
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:150)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:78)
	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.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.core.assets.actions.ConvertModel$1.run(ConvertModel.java:65)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at com.jme3.math.Vector3f.set(Vector3f.java:152)
	at com.jme3.math.Transform.<init>(Transform.java:61)
	at com.jme3.scene.plugins.gltf.GltfLoader$BoneWrapper.update(GltfLoader.java:1226)
	at com.jme3.scene.plugins.gltf.GltfLoader.readAnimation(GltfLoader.java:819)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:136)
	... 7 more

Strange question though on this. Does the gtlf support work better in 3.2.2? I’m running 3.2.1 stable.


#26

Can you try it also with Editor: jMonkeyBuilder


#27

Just giving it a download. It’s getting flagged as a virus strangely.


#28

Ok. Got it installed. Still not converting.

com.jme3.asset.AssetLoadException: An error occurred loading Cubie.gltf
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:150)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:78)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.ss.editor.file.converter.impl.AbstractModelFileConverter.convertImpl(AbstractModelFileConverter.java:146)
	at com.ss.editor.file.converter.impl.AbstractModelFileConverter.lambda$convert$1(AbstractModelFileConverter.java:123)
	at com.ss.editor.executor.impl.BackgroundEditorTaskExecutor.doExecute(BackgroundEditorTaskExecutor.java:44)
	at com.ss.editor.executor.impl.AbstractEditorTaskExecutor.run(AbstractEditorTaskExecutor.java:150)
Caused by: java.lang.NullPointerException
	at com.jme3.math.Vector3f.set(Vector3f.java:152)
	at com.jme3.math.Transform.<init>(Transform.java:61)
	at com.jme3.scene.plugins.gltf.GltfLoader$BoneWrapper.update(GltfLoader.java:1226)
	at com.jme3.scene.plugins.gltf.GltfLoader.readAnimation(GltfLoader.java:819)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:136)
	... 7 more

 caused by java.lang.NullPointerException
	at com.jme3.math.Vector3f.set(Vector3f.java:152)
	at com.jme3.math.Transform.<init>(Transform.java:61)
	at com.jme3.scene.plugins.gltf.GltfLoader$BoneWrapper.update(GltfLoader.java:1226)
	at com.jme3.scene.plugins.gltf.GltfLoader.readAnimation(GltfLoader.java:819)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:136)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:78)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
	at com.ss.editor.file.converter.impl.AbstractModelFileConverter.convertImpl(AbstractModelFileConverter.java:146)
	at com.ss.editor.file.converter.impl.AbstractModelFileConverter.lambda$convert$1(AbstractModelFileConverter.java:123)
	at com.ss.editor.executor.impl.BackgroundEditorTaskExecutor.doExecute(BackgroundEditorTaskExecutor.java:44)
	at com.ss.editor.executor.impl.AbstractEditorTaskExecutor.run(AbstractEditorTaskExecutor.java:150)

#29

Can you try to load your gltf in these online viewers to see if it loads fine

https://sandbox.babylonjs.com/

https://gltf-viewer.donmccurdy.com/


#30

Well that is a bit peculiar.

So those 2 online viewers work for the glb file but not the gtlf.

I guess that’s because the glb as was mentioned earlier includes the binary?

One thing that I saw in the viewers is that there’s no texture defined. I didn’t define one. Is that a problem?


#31

Of-course, you should not upload gltf file separately. They should be uploaded with each other.

Not sure, but I don’t think it would be the problem. You can try though.
If you are using this add-on

make sure to follow this doc


#32

Finally you can also try with this add-on


#33

I’m going to try to make a smaller model test case. Just a bendy box thing to keep things super simple and see what happens then.

I thought the glTF-Blender-IO pluggin was for 2.80 and up. 2.79b and down was supposed to use the one you linked.

I’ll post my results. Shouldn’t take too long.


#34

It should work fine on 2.79 also.


#35

Correct, first link. The I/o didn’t work when I tried it.

Did you use the correct method for linking your nodes?


Read this User Doc also.

You need to read all three and may also need to create a material and use the jme PBRLighting material definition and manually link your assets there.

You will also need to add a light probe to your game.

and read,
https://wiki.jmonkeyengine.org/jme3/advanced/pbr_part1.html

If you want to convert images to a texture you will need a third party app to make your materials, like Materialize - handy free tool that converts an image to PBR textures
or
https://www.allegorithmic.com/products/bitmap2material

The good thing is that as of 2.8 gltf is already included.

Edit: substance vs materialize. I found materialize produced the best results by far and its free.

Edit: PBR kicks ass once you get the pipeline down.


#36

I read somewhere from remy that you could upload it to sketch fab and download it as gtlf. It’s not really the greatest workflow in the world but I believe their code is a higher standard than the Kronos one.


#37

Unless this policy has changed, not for free.


#38

Righto. I’ll give them a read. See how it goes. Annnnnd if things go bang I’ll be back… fresh tears in my eyes. :wink:

Thanks for your help!


#39

So I’ve had some luck with the whole gltf thing. The newer version for exporting works fine enough for a model that is just a model with no animations. Those web pages you linked earlier seems to work with my new “embedded gltf” file (although the animations are doing some seriously crazy things in there). But when I try to convert from gltf to j3o I get the following:

JME only supports linear interpolation for animations
JME only supports linear interpolation for animations
JME only supports linear interpolation for animations
JME only supports linear interpolation for animations
An Exception has occured when trying to load asset Cubie.gltf.glb
com.jme3.asset.AssetLoadException: An error occurred loading Models/Cubie/Cubie.gltf.glb.gltf
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:150)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:78)
	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.gde.core.assets.SpatialAssetDataObject.loadAsset(SpatialAssetDataObject.java:94)
	at com.jme3.gde.core.assets.actions.ConvertModel$1.run(ConvertModel.java:65)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.jme3.asset.AssetLoadException: Inconsistent animation sampling 
	at com.jme3.scene.plugins.gltf.TrackData.checkTimesConsistantcy(TrackData.java:139)
	at com.jme3.scene.plugins.gltf.TrackData.update(TrackData.java:130)
	at com.jme3.scene.plugins.gltf.GltfLoader.readAnimation(GltfLoader.java:805)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:136)
	... 7 more

Which is weird since my model only uses linear interpolation. I’m going to crack open the exported gltf file and see if there’s something awry in the json of it. Some left over saying something other than linear.


#40

Ah HA! There were some remnants of Cubespline in there. Friggin weird.

Going to also change the key frames instead of using location + rotation + scale to just rotation see if that sorts out the weird morphing I’m seeing.

Those 2… uhhh… wings?.. Tentacles?.. Are inverted arms. As in they morph through his body.