JME GLTF Support

Merci./Thank you.

Testing this and it works awesomely! Great work.
Now if only sketchfab’s downloadable section wasn’t 90% nsfw junk and models too high poly to be useful :tired_face:

1 Like

you can import the models to blender and to optimize it, after this you can re-export to glTF the models from blender :wink:

But well then you could also use something like xbuf.
The SDK now also supports GLTF and it’s binary formats on latest master, but it could use some testing (I discovered a probably engine bug by trying to open duck.bin)

What problem ? Could you elaborate

An Exception has occured when trying to load asset Duck0
java.lang.ClassCastException: java.io.FileInputStream cannot be cast to com.jme3.asset.CloneableSmartAsset
	at com.jme3.asset.cache.WeakRefCloneAssetCache.addToCache(WeakRefCloneAssetCache.java:127)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:281)
	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.OpenModel$1.run(OpenModel.java:69)
	at java.lang.Thread.run(Thread.java:748)

Are you trying to load directly the bin file ?
You are suppose to load the gltf file the bin file can’t work on its own. I guess I can output a more explicit error.

1 Like

Hm, the loader works perfect in my cases, I can load scenes without additional actions from me:

great work! :wink:

4 Likes

but in some scenes from sketchfab I see very strange rotations…

Well I thought of this like with FBX where you can have ASCII and Binary Models.
So can you embed mesh data either directly in the GLTF or you can reference an external .bin?

No. Load the gltf file. The bin file is where the data is stored.

1 Like

I made a change that should return a proper error when ever you try to load a bin file directly.
I’ll implement the .glb support.

Added support for glTF binary files (.glb)

8 Likes

Hello everyone,

When I export the model in gltf from Blender using the Khronos script, I can export a single animation. (only one action)
It works fine then in the JDK and in JMB.
Unfortunately, I can not export multiple animations at the same time.

How to select and export multiple animations from Blender ?

Is it possible to export multiple actions ?

Currently I create a single action with all the animations put one after the other.

I then cut the animations via the JMB program.

thank you in advance

1 Like

Well sounds a lot like a question that could be asked to the Khronos blender plugin guy… I’d like an answer too
There is an open issue about it… I suggest you chime in and maybe they’ll put the issue at the top of the stack.

Also… there is another plugin. I didn’t test it but maybe it works better

And… in the end… another way (albeit convoluted) is to import your model in sketchfab, set it as downloadable and export it as gltf… I’m totally biased but to me, sketchfab has the most efficient gltf exporter.

3 Likes

Thanks for these informations,

I just tested the Kupoman script.
It exports many actions !!!

Too bad the material (PBR) does not export as well as with the Khronos script.

Unless it is me who takes it badly.

Thanks again
Thoced

1 Like

Well… I’d rather have the anims than the material tbh…
The material can be easily redone in JME…anim data aren’t
Thanks for the information though I’ll test it.

1 Like

The GltfLoader seems to get automatically registered with the AssetManager, but not the GlbLoader. Was this intentional?

Nope, gonna fix it. thanks

1 Like

Hello @nehon
I have problems with GLTF animation in j3o.
As you can see on screenshot, in blender I have two animation (walk, run), but in j3o model I have only one animation, that was active when I saved file (and without name).
Also after run animation, model jumps down, lower than axis
Also legs don’t moves, but moves feets.
Also hat is notconnected with head.

Files: Download