GLTF conversion/loading issue

Hello,

I’ve tried importing a store bought, animated model into jme 3.5, so far with limited success.

  1. I tried converting it with the SDK. Worked fine, showed up fine in SceneComposer. Fails to load with NPE (AnimComposer is missing). Although I’m fairly certain I got a different exception earlier, ‘trying to access member of unnamed module’, or something like that.

  2. I tried using jmeconvert. I get the following exception during conversion:

08:15:03,659 INFO  [AssetReader] Loading asset:sailor.gltf
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/***/jmec-1.2.0/lib/jme3-core-3.3.2-stable.jar) to method sun.nio.ch.DirectBuffer.cleaner()
08:15:04,389 INFO  [Convert] Processing:sailor.gltf```

And then during loading:

java.lang.IllegalAccessException: class com.jme3.export.SavableClassUtil cannot access a member of class com.jme3.anim.AnimClip with modifiers "protected"
3. I’ve tried loading the unconverted gltf. It loads in some instances, controls are present. But at some point that I haven’t had time to pin down yet, probably when setting the animation it throws:

java.lang.NoSuchMethodError: 'com.jme3.math.Matrix4f com.jme3.math.Transform.toTransformMatrix(com.jme3.math.Matrix4f)'

Is there a fail-safe way to get animated gltf’s into jme?

Thanks

1 Like

Hi

What JDK version are you using?

If it is 11+ then try adding

"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED"

into applicationDefaultJvmArgs in build.gradle and see if it makes any changes. Afaik this allows using reflection in apps that do not use Java Modules.

I am also using JMEConvert (with the above JVM arg set) to convert Gltf models and I have had no issue so far.

Also, test it in these online Gltf viewers/validators and see if there is no issue with your model.

and

2 Likes

Any additional information like a stack trace? Or loading code… or?

Is it a case of just looking for AnimComposer in the wrong place?

1 Like

No. I’m a bit confused over this as well. But I have tried a bunch of different export options and such, so I’m unsure of what happened there. But I’ve also looked for the control in all of the children of the node, so I think I’ve ruled it out. But consider that one a bit fuzzy.

I tried saving the loaded gltf, then loading the resulting j3o with a similar exception as when using jmeconvert:

java.lang.IllegalAccessException: class com.jme3.export.SavableClassUtil cannot access a member of class com.jme3.anim.SkinningControl with modifiers "protected"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
	at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
	at java.base/java.lang.Class.newInstance(Class.java:579)
	at com.jme3.export.SavableClassUtil.fromName(SavableClassUtil.java:172)

@Ali_RS 
I'm using JDK 11. Adding the default jvm arg didn't help.

The model produced by the SDK now has an AnimControl. Which explains why it didn’t find an AnimComposer, I guess. But I’m about 90% sure there was an AnimComposer produced earlier, because that was the reason I wanted to convert my classes to use it.
I will try the migration tools later and see if that works. But I assume the results will be similar. At least now I can convert back to using AnimControl.

In any case, I’m not asking anyone to dig deep into this. I only wanted to know if it was a known issue or if someone had encountered anything similar.

If you found an AnimControl instead of an AnimComposer then it was using the older gltf code… maybe from 3.2? Or 3.1? I can’t remember.

Until you get the JDK 11 module issue sorted, you won’t be able to save/load j3os I think.

1 Like

Yeah, SDK 3.3 uses jME 3.3 and has AnimComposer. Maybe an older SDK was used at some point by OP.

2 Likes

Maybe an older SDK was used at some point by OP.

OP can confirm that fact. But I did rerun it in the latest SDK to verify. Maybe some case of SDK’s magical caching abilities.

Until you get the JDK 11 module issue sorted, you won’t be able to save/load j3os I think.

Thanks. I’ll try to sort it out tonight.

TL;DR
I ended up with JDK8, and a fresh Ant project.

Maybe something is wrong with my Gradle or SDK setup. But at least I get to use the new animation system. Always something.

I noticed there wasn’t any wiki page on the new animation system, so I started one. Just some basic stuff in there so far based on what I have trawled off the forum.
https://wiki.jmonkeyengine.org/docs/3.4/core/animation/animation_new.html

3 Likes