Glb file exported from sandbox is not giving same look when I import that on my code

Pinging @bghgary

Just wondering - are you using babylon to render the glb as well, or is it a different renderer?

yes i’m using babylon

What kind of materials are you using in the original scene? Do you see any console warnings when exporting?

I’m using PBR materials,
This is another shortcode in which I have removed all my customizations, and materials also but still couldn’t find any change in result.
Is it compulsory to use materials?
And no I don’t get any error during exporting Babylon file but when I export glb file it throws warning, attached in media.
Also attaching result of this code

            var canvas  = document.getElementById("canvas");
            var engine = new BABYLON.Engine(canvas,true);
            var createScene = ()=>{
                var scene = new BABYLON.Scene(engine);
                engine.enableOfflineSupport = false;
                scene.clearColor = new BABYLON.Color3.White();

                var camera = new BABYLON.ArcRotateCamera("arcCamera",BABYLON.Tools.ToRadians(0),BABYLON.Tools.ToRadians(0),10.0,BABYLON.Vector3.Zero(),scene);

                var light  = new BABYLON.PointLight("pointlight",new BABYLON.Vector3(0,0,0),scene);
                light.parent = camera;
                light.intensity = 1.5;

                // create model                                        BABYLON.SceneLoader.ImportMesh("","","mymodel.babylon",scene,(loadedMeshes)=>{

                return  scene;

            var scene = createScene();

I’m still not sure what you are doing. Can you provide a repro or attach the original scene? Thanks.

I want to use babylon file instead of glb file.
I found a playground
I’m trying to add my babylon file here. It gets loaded but does not look the same as in Babylon sandbox.
I can’t figure out the reason why this is appearing like this
attaching my scene and output screenshot.

My scene

The issue was importing the .babylon file as a single mesh instead of a scene. When you load as a mesh, the file’s hierarchy gets messed up instead of the proper hierarchy, which is this one (the same one as the sandbox):

Here’s the playground: fff | Babylon.js Playground ( (the link to the file seems to be temporarily down for now)

I am able to repro exporting to glb looking off. Investigating.

1 Like

Ohh… Thanks it worked. Thank you so much.

I’m facing one more problem,
It loaded fine but when I zoom in the scen it scatters the material, because of this I can’t set camera’s upperRadiusLimit less than 3.

camera.lowerRadiusLimit = 4;
camera.upperRadiusLimit = 3;
at these values it looks fine but looks very small.
Can you tell me why this is happening.
attaching pictures for reference.

Hi! This is probably caused by the camera’s near and far plane settings. When setting up a camera for a 3D scene, we have to define its viewing frustum, which is the region the camera is capable of seeing:


If a object is outside of this area, it’s clipped, meaning it isn’t shown at all. And when the object is partly inside and partly outside, it causes this “cut” effect. So one solution is to decrease the near clip plane, so that you can actually see objects close to the camera. You can set this using the minZ property on the camera: TargetCamera | Babylon.js Documentation (

I figured out why the materials are different between .babylon and .glb. The issue is that some of these materials are marked with disableLighting = true and also has emissive textures. The issue with this is that the glb exporter interprets this to mean that it should use the glTF unlit extension which only looks at the diffuse texture and ignores the emissive texture.

The exporter can’t actually export this to glTF since it’s not possible. The exporter should log a warning and not export the emissive texture since it won’t not be used by the loader. @Soniya_Kukreja Do you mind filing an issue for this?

For now, if you want this .babylon scene to export to glTF, you can set disableLighting = false for the materials that are using emissive to fake not having lighting.