Can't load/display some .glb files

Hello, I am new to BabylonJS and 3D games in general.

I display some .glb models in my application but it does not always work, some other .glb files just don’t appear on the stage.
The problem is that I don’t see any warning or error message.

I have tried to use Mars model available here:

It does not work for some reason.

I have tried to use other free models available on the internet and I have no problems.
Also, I’ve tried different ways importing/displaying models, here are 3 examples:

Note, if I use “sun.glb” in any of these examples, everything is OK, but if try “mars.glb” instead, nothing happens.

BABYLON.SceneLoader.Append("model/", "mars.glb", scene, (scene)=> {
    
    });


BABYLON.SceneLoader.ImportMesh("", "model/", "sun.glb", scene);


BABYLON.SceneLoader.ImportMesh("", "model/", "sun.glb", scene, (newMeshes, particleSystems, skeletons) => {
        newMeshes[0].position = BABYLON.Vector3.Zero();
    });

Mars
mars

Sun
sun

Hi BJS,

Welcome to Babylon! I downloaded that Mars model and drag-and-dropped it into the Babylon.js Sandbox (which is one of the best ways to view a model and see if it can be loaded); it seemed to display correctly, so I don’t think there’s anything wrong with that model, at least. When it comes to loading GLBs through the SceneLoader, I’d definitely recommend the async variants of the loading methods as being much cleaner and easier to use than their blocking counterparts. For example, here’s a really quick Playground that pulls down and displays that Mars model from its NASA hosting location.

Mars model from NASA | Babylon.js Playground (babylonjs.com)

I’d recommend building off that Playground’s approach to see if you can get all your models loading as expected. Then, if you run into issues where things aren’t loading in the Playground, all you have to do is save your Playground and drop a link to it here, and we’ll be able to help look at it directly. Hope this helps, and best of luck!

6 Likes