(Self)shadow disappears on mesh? It's a mystery

Hi everyone,

I have downloaded this scene to my own ftp:

and only replaced the “skull.babylon” with a 3DS Max teapot (with Physical material), exported as a .babylon model.

Now the weirdest thing happens: after a second or so the self-shadow just disappears.

I have attached a video that shows how the self-shadow vanishes… POOFF.

Another strange thing is that the same teapot exported as a .glb model doesn’t show any shadows at all.

Any suggestions for these two issues? I’m probably missing some additional settings?

Thanks! :relaxed: :relaxed:

pinging @Evgeni_Popov

1 Like

Your video is just a blank screen for me for 17s…

Also, we will probably need a repro somewhere to be helpful.

1 Like

Hi @Evgeni_Popov, sorry! When you download the video it works as expected.

But I’ll also prepare a repro and screenshots, although it’s an exact downloaded copy from here:

The PG is working, so we would need you update it to make it fail in the same way than in the video.

1 Like

Hi @Evgeni_Popov, thank you for your patience with me :smile:

I’ve uploaded the teapot to github and created this new Playground:


When you hit the play button repeatedly SUPER fast (rapidfire), you can see the self-shadow for a fraction of a second before it disappears.

So there is something wrong with my model? I’m using the Babylon 3DS Max export plugin to export models.

(By the way, I know the model is not ‘watertight/STL proof’ for correct shadow calculations, but I have the same issue with models that are ‘watertight’.)

Thank you so much!

I could not reproduce the problem even by clicking the “play” button frantically…

Try to have a look at the console log when the bug occurs, it could give you some clues. Also, the Playground is a specific environment not really representative of a real production environment because a number of things are not reset when clicking the “play” button, meaning you are not in the same conditions than if you started over from a clean refresh. So the problems you face of could be only an artefact of the playground settings…

1 Like

Thank you @Evgeni_Popov, but don’t you see the same as me? I have attached a screenshot for you.

It’s clear that the self-shadow is all wrong, there is a strange ‘shadow dot’ on the top and slight shadow on the handle.

The shadows are wrong because the light is not located at the right position and the shadow generator / light parameters need to be tweeked a bit:

1 Like

Great @Evgeni_Popov! It seems I didn’t fully understand the shadow parameters.

I’ve created a ‘watertight’ teapot, exported as a .babylon model, which also works fine indeed:


but when I export the exact same model as glb, there is no self-shadowing:


Do you have a tip on how to fix that? Thanks!

When importing a gltf/glb file the first node is a special root node that is created automatically by the loader.

So, you change var skull = newMeshes[0]; to var skull = newMeshes[1]; to target your mesh.

1 Like

Oh sorry, I should have known that! Because I use glbs with a multimaterial. Well I think I tried it yesterday that way, but due to the wrong shadowgenerator settings that didn’t work.

Thank you SO MUCH @Evgeni_Popov, you saved me, AGAIN! :smile: :smile: