Why SceneLoader.ImportMesh doesn't recognise skeleton and meshes from Blender created gltf?

I created mannequin in blender and trying to use it with babylon. My problem is that babylon doesn’t recognise gltf file created with blender.

Here is basic example with predefined dummy3.babylon https://playground.babylonjs.com/#CN4KJL#42
When I console.log(skeleton, meshes) I see this

Here is example with my file https://playground.babylonjs.com/#CN4KJL#41
When I console.log(skeleton, meshes) I see this

Here is link on my file Dropbox - man_wo.gltf - Simplify your life
I added bones and connected them with meshes

Maybe I missed something and I need to add something extra to my file?

P.S. One more issue. Even if my file is loaded, but it doesn’t fit screen and I can’t zoom out to see whole image. How to solve this?

invoking our Blender exporter architect @JCPalmer

Maybe @JCPalmer will be able to help, but I feel it is more a question for the Blender forum as the problem is how to link a skeleton to a mesh in Blender.

Regarding

Make sure the camera controls are attached to the canvas.

The easiest way to do it is to make this call after the file is loaded:

scene.createDefaultCamera(true, true, true);

Yeah, I do not even fix people’s blend file that use the .babylon format. That’s for them to do. Just a wild guess, but the most likely cause is the lack of an armature modifier on the mesh(es) pointing the mesh to use. If missing, unless added using parenting (where automatic weights can be specified), then the next problem would be lack of matrix weights / indices.

Usually you would join all those objects into one, then parent the mesh to the armature. Then you open the action manager and name an action like “walk”. It looks like they are all separate objects. I just started using Babylon, but have been using Blender for a while. Normally, if using another model, you have a single skin which is parented to the armature. You can parent objects to bones, but generally that’s for something like a hat or whatever. It might work all separate like that, but it would probably be better to do a small tutorial on a simple mesh parented to an armature, and then name some actions and see if it exports.

I’m not sure I understand what you mean by this:

I do not even fix people’s blend file that use the .babylon format

My file is not in .babylon format, it is in .gltf format. Here is the link Dropbox - man_wo.gltf - Simplify your life

Maybe you meant that you don’t fix NOT babylon format. In that case I managed to save my file from blender to .babylon format Dropbox - man2608(6).babylon - Simplify your life. Here how it looks it blender

I added some animation, and now in sandbox it shows me that it finally has skeleton, but as you can see it collapsed all meshes

This happens only when I save to .babylon format, when I save to .gltf or .obj it looks ok in sandbox, but doesn’t have any skeletons

maybe @PirateJC can help as well

Anything on this?

Hey @Online_Zakaz - Sorry for the delay.

Ok - a couple of things.

  1. How do you zoom out so you can see the entire asset: If you simply remove this line:
    camera.upperRadiusLimit = 10;

This line is limiting the amount that the camera can travel backwards, so removing it allows you to zoom out as far as you want.

Here’s the new playground saved with that line removed:
https://playground.babylonjs.com/#CN4KJL#45

  1. Can you explain how you created the .babylon file from your gltf file? It seems broken to me. One way you can test is to follow these instructions:
    a) First open the sandbox.
    b) drag your gltf file into the sandbox:

    c) use the tools tab to export to .babylon
    image
    image
    d) drag that new .babylon file into the sandbox.

So when you go this route to test, you can see that the .babylon format is working just fine. So if you could tell us a little more about how you created your .babylon file, that would be very helpful.

  1. Back to your original question…

It looks like the export from blender to .gltf is working just fine. The objects import into Babylon in the correct positions. So I’m not quite understanding what’s not working. The reason the console.log looks different, is because the dummy model is all one mesh…as you can see in the heirarchy:
image
Where your model looks like it is authored as multiple meshes:

I believe this is what @fire7side was pointing out.

So if your ultimate goal is to have one single mesh, then you would need to author your object that way in Blender.

Hope this is a little bit more helpful…and again sorry about the delayed response

3 Likes

Thank you very much! You covered all my questions!

1 Like