Meshes black when imported into scene

Hello,

I’m still a newbie in Babylon.js and guess that I’m missing something here. Maybe you can help me.

I’m trying to import meshes that I’ve created in Blender into a Babylon.js scene, in either .glb or .gltf format. In the Babylon.js sandbox they are displayed perfectly and all materials and textures show up in the scene explorer. So I assume the mesh export from Blender was well.

However, when I try to load the mesh into my scene, it appears completely black. Here’s the code that I use for loading:

BABYLON.SceneLoader.ImportMeshAsync(“Central Pool”, “models/”, “The-Persian-Garden_CentralPool.gltf”, scene).then((result) => {

    var centralPool = result.meshes[0];  
    centralPool.position.x = 0; 
    centralPool.position.z = 0;
    centralPool.position.y = 0; 
    
    }       

I hope I have included the correct Babylon.js files. Here are the respective lines from the header:

   <script src="https://cdn.babylonjs.com/babylon.js"></script>
    <script src="https://cdn.babylonjs.com/loaders/babylon.glTFFileLoader.js"></script> 
    <script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.js"></script>
    <script src="https://cdn.babylonjs.com/materialsLibrary/babylonjs.materials.js"></script>

The strange thing is that when I zoom on the mesh, I see vague lines ot tiling, like from the materials that I’ve applied. So after all could it have something to do with the light? The mesh seems not to reflecting any light from the central light source.

Maybe you have some hints for me. Many thanks in advance!
Hayden

Hey! we will need to see a repro in the Playground to help further. Looking at your code, there is nothing obvious that jumped at me

Hi Dalkatosh,

not necessary. The problem is solved. I simply had to use a hemispherical light instead of a point light. All is perfectly visible now.

But maybe you can help me with something else. When moving my camera it moves right through the imported meshes although I have activated collision detection both for the meshes and the camera. Do I maybe have to activate physics before I export the meshes from Blender?

Sigh, so much to learn before I know how to use it all correctly …

Many thanks in advance!
Hayden

This should help:
Camera Collisions | Babylon.js Documentation (babylonjs.com)

Thanks, Dakota. I will check this and open a new topic if I need help.

We can regard this one as closed.

Thanks!
Hayden