Issue with a spotlight

Hi everybody,

I have 2 issues with my spotlight

1 - Why is the light so shiny on the ground and so dull on the table ?

2 - Why can’t I see the shadows of the table on the ground ?

Here’s the PG :

If anybody could help…

Thanks in advance,


Hey @bvaisman , how are you doing?

For the shadows on the ground. The correct way to add you object to the ShadowGenerator would be to use the addShadowCaster helper function.

Your bias values also seemed to be wrong (I’m not sure why), but removing it seems to make the scene look right.

Babylon.js Playground (

  1. You have a point light under the table

  2. Add all meshes to generator:

    data.meshes.forEach(x => {

And tune bias


Ok @srzerbetto , you’ve found the solution, thanks very much .

But i don’t understand why the shadowGenerator.addShadowCaster(mesh, true) function works and the shadowGenerator.getShadowMap().renderList.push(mesh) does not.

When can we use the first and the second ?

It’s the same thing, but make sure that shadowGenerator.getShadowMap().renderList is not null (initialize it with an empty array).

No, i’m sorry @Evgeni_Popov but it does not work, even if I initialise my array.

My PG with shadowGenerator.getShadowMap().renderList.push(mesh)

My PG with shadowGenerator.addShadowCaster(mesh, true)

Anyway, the solution has been found but maybe it’s a bug with the spotlights. I always use the first syntax which works with directional lights and i thought it worked the same way with spotlights.

The difference is that you pass true to addShadowCaster, which will also add all descendants of the mesh to the array, whereas push(mesh) only adds mesh to the array.

An equivalent of addShadowCaster(mesg, true) would be something like shadowGenerator.getShadowMap().renderList.push(mesh, ...mesh.getChildMeshes(false)).

1 Like

Ok, you’re right, that was not exactly the same code…