Setting receiveShdaows for imported mesh is not working

Hi everyone.
I’m learning to work with “imported meshes” but I’m running into a problem.
I created a simple scene with light and shadow. They work as expected for built-in meshes.
However, setting receiveShdaows = true seems to make no effect for imported meshes.

SceneLoader.ImportMeshAsync('', 'path/to/models/', 'plant_celandines.glb', scene)
        .then(({ meshes }) => {
            const plant = meshes[0];
            plant.scaling = new Vector3(5, 5, 5);
            plant.receiveShadows = true; // not working
            shadowGenerator.addShadowCaster(plant); // this is working
        });

The parts of the mesh that are inside the shadows look exactly the same as the parts that are outside the shadows. There is no shadow on its surface.

Playground is here:

Any help would be appreciated. Thanks!

Hi,

For your mesh import, it’s a glb. All gltf and glb meshes have a meshes[0] root node.
To display shadows you must use the meshes[1].

To better understand open the inspector and look at the hierarchy of your model.

Works on this PG :

2 Likes

Thank you so much!
Is there any article about the difference between root node and its children? I’m guessing there might be other differences besides shadows.

In fact with the glb and gltf files only the position, rotation and scale can be manipulated with node 0 (if I’m not mistaken). The other modifications are on node 1.

1 Like