GLTF questions

Mostly, I use gltf and it just works. Occassionally I will come across something that behaves in a really bizarre way and I think to myself “Gee, I should poke at that some day.”

I have run into another one of those cases and I believe it’s simple enough that I’d like to understand why it breaks and maybe fix/streamline some issues in JME’s gltf support and/or JmeConvert.

As a stand-in model, I downloaded this from sketchfab: Chicken - rigged - Download Free 3D model by Maf'j Alvarez (@blujay) [6e3b93c] - Sketchfab

A simple low-poly chicken.

The gltf provided by sketchfab converted just fine with an older jmec (using JME 3.2)… and other than the fact that the chicken was 11,000 meters tall (yes, really) it worked pretty much ok.

Some days later, I decided I wanted to use animation but would rather use the newer animation from 3.3 GLTF… so I updated my JMEC to use a newer JME. (3.3.2 stable)

Bizarrely, now the chicken doesn’t render. Even though it still says it’s huge, it renders super tiny and some parts appear/disappear as the camera moves as if it’s out of frame. The different animations all loaded, though, and I can see the idle animation cycle in whatever tiny parts happen to be there.

If I mess with the scale of the chicken to the point where I can see it, I can never look straight at it.

So something that worked fine in JME 3.2’s gltf loader is not working find in 3.3’s loader.

I then decided to try to use the FBX and export directly from blender (2.82). This works better. Scale is more reasonable. I can look almost directly at the chicken but still parts get culled at strange times. All of the animations but idle are also gone… so sketchfab knows some magic that blender doesn’t or I’ve selected some incorrect options on export.

I hope those of you more familiar with using GLTF can help me figure out which parts of this are bugs in JME, which parts are bugs in Blender’s exporter, and which are “operator error”.

It’s especially troubling that this actually worked better in an older version of JME.

i dont even see this chicken in Blender, also have culling there. sketchfab preview seems to fix a lot issues.

and yes, FBX source seems to work fine, so sketchfab autoconvert made somethign crazy. i will check gltf convert.

But it’s important to remember that the same GLTF basically worked fine in jme 3.2. (other than the giant scaling)

do you think it might be related to format changes? (not sure if there were significant changes since 3.2)

when i re-expoerted to GLTF via blender it works fine. (animations too, if NLA track setup properly)

Maybe GLTF changed in 3.3 to new format-changes while 3.2 still use old ones? (and sketchfab autoconvert didnt updated to new)

oh, i need update post now, i noticed some missing elements at some angle.

for example when its in center:

and when its on left side on window:

sorry i didnt noticed it earlier.

not sure what might casue it tho.

edit:

after some investigation, looks like Geometry might be “out of view”, while animation cause it to be “inside view”(even when idle)

I would almost certainly think it is an issue with the model or the way it was created, if it weren’t for this point that it worked before.

I just tried downloading the autoconverted GLTF version of this model from sketchfab, and experienced the same issues you described.

I also tried downloading the original FBX model, and it crashed Blender on the first import attempt, but worked similar to how you both described on the second import attempt.

The only major thing that (I think) changed from 3.2 to 3.3 with the converter would be the support of morph animations. Maybe the model has corrupt morph animations, but due to JME 3.2 not supporting morph animations, it was not appearing as corrupt in JME until 3.3? Just a guess, since all of my instincts are telling me this is a corrupt model, aside from the fact that it was working for you in 3.2

model has no shape keys.

tho model does not have applied transforms, and i belive this might cause some issues. (still investigating)
still it also does not explain why it was all fine in 3.2

True, I did not check to see if it had morph anims.

Regardless, I would think that the j3o converter code still had to change a lot from 3.2 to 3.3 in order to create an Armature and AnimComposer instead of making the old SkeletonControl and AnimControl- so even if the model does not have morph anims, it could still be a bug with the converter code that creates the Armature control based off of the data in the GLTF file.

So, I haven’t had a chance to check this yet… but I sort of remember that the JME 3.3 “starting pose” might be different than the JME 3.2 “starting pose”… which is essentially nothing at all. I’d been thinking about that possibility since yesterday.

Your notice that the animation might be putting things in a weird place adds evidence to that. So perhaps the reason it breaks on 3.3 is because it tries to set a default pose.

Edit: and by the way, thanks for looking into this guys. I have a dream that someday we might get gltf to work flawlessly 95% of the time instead of what feels like 50-60% of the time. (Though in this case, if I’d just make my own chicken I wouldn’t have an issue… probably.)

I have seen this same issue on a building that was in FBX format that I converted to GLTF using blender 2.8. It was massive and randomly glitched between visible and not visible on different faces. Yet the FBX would import fine. I had the original blend file for the building and just exported that to gltf and everything was great. So perhaps this is an issue that occurs on using blender to convert fbx to gltf.

I’ve confirmed that this is why it works on 3.2.

I had the 3.2 converted j3o still in git so I loaded that one and rebooted the part of my brain that remembers the old animation system and set it to the idle animation. Boom… no more geometry and the same weird behavior. Just like when I first tried to load the 3.3 version.

So it’s the animations that are messed up.

If anyone has some steps to (easily) fix them and get the different animations exported, I’d appreciate it… more for curiosity and to help future explores (unless it’s already on the wiki then an RTFM link is fine).

I don’t actually need this chicken animated. Just thought it would be cool and then started pulling the loose thread when I noticed a problem.

(I tried starting on implementing the basic simple AI for Mythruna a couple weeks ago and have been side-tracked by interruption after interruption… this is just the most recent one. :))

1 Like

I don’t recall anything in the wiki or in my use of gltf that would help here.

I am nearing the point where I can start catching up as my life projects are finally almost over, months longer than expected. Things take longer to get done and you cant rely on anything these days due to the insanity going on.

I doubt my input would be that insightful in any case but sometimes I get lucky.

Checked the Sketchfab exported Gltf model in two online Gltf viewers (https://gltf-viewer.donmccurdy.com/, https://sandbox.babylonjs.com/) and seems it is not a valid Gltf file. (found 333 errors)

I just gave those a try with the other copy of the model ( the one that was downloaded from sketchfab as FBX, imported to blender, and exported from Blender as GLTF) and although it loads up in these online editors, the animations are still missing, and it gives this report with a single warning.

https://i.imgur.com/ThPssmI.png

Also it seems strange that the model has 7 materials for a low poly chicken - that is another sign to me that it may have been quickly or carelessly created, and may have been a wonky asset upon creation. Unless its an error with the sketchfab downloads, which could also be possible since it works with animations on their site, but not on any other standard GLTF viewer.

well, we usually re-create animations ourselfs since most models anyway have lack of many animations (animals/monsters/characters/etc).

In this case we didnt had much issues with animations (same workflow so it always work same)

But yes, i agree there is something wrong that some Sketchfab models have issues.

not only Sketchfab, i had a similar problem with a gltf file exported from blender.

OMG this was my first or second ever rigged model, or model even - the chicken!. So sorry you discovered how basic and badly made it was. Lol - had to laugh out loud reading this thread but also glad you worked out some stuff. I really had to laugh about the model being 11,000 metres tall! Please if you find that you have improved the model - i can try to upload a revision to sketchfab. It’s still my baby but very very happy to see people using it :smiley:
:smiley: :smiley:

4 Likes

Hahah. No worries.

I haven’t made any changes to the model. It’s just a placeholder for me and works for that as is.

I was mostly curious why it displays fine in Sketchfab but doesn’t in JME.

2 Likes