Babylon Import the model and add external textures to the model

Hello, I introduced a model from outside and added a network linked texture to it. When I did not declare a material, the model can be displayed. However, after I gave the model a material, it will not be displayed. I need your help

The code is as follows:

  BABYLON.SceneLoader.ImportMesh('', "", "ea4f4e7f0a2d48e18b22b1b0cff68b66.glb", scene, (meshes) => {
        meshes.forEach((mesh) => {
            var stdMaterial = new BABYLON.StandardMaterial("stdMaterial", scene);
            stdMaterial.diffuseTexture = new BABYLON.Texture("", scene, false, false)
            stdMaterial.diffuseColor = new BABYLON.Color3(1, 1, 1);
            mesh.material = stdMaterial
        engine.runRenderLoop(() => {
    }, undefined, (error) => {

Is this an issue with importing the model or is there an issue with my code

Welcome aboard!

Here’s a PG with your code:

It does not work because your model does not have texture coordinates:


Even if you don’t set the diffuse texture, it still does not work because vertex colors are enabled for your mesh, but the colors are fully transparent:

You can disable using vertex colors like this:

1 Like

Thank you very much, but why is the imported model semi transparent? How should I solve it

That’s how it has been authored. Maybe it’s a problem during export?

If you want to fix it, you will have to edit it in a DCC tool (like Blender) and remove/fix the vertex colors + add texture coordinates.


Thank you very much

Thank you, according to your method, it can really be displayed. Thank you again, my brother