Shadows not casted/received with HDR environment texture

Hi there

I’ve been working on a scene where I add an environment texture such as:

    const environmentTexture = new HDRCubeTexture(
    scene.environmentTexture = environmentTexture;

All works as expected, I get proper reflections on PBR materials and some environment “illumination” but…

Whenever I try to add any lights, even the simplest spotlight or hemisphere, it doesn’t affect the scene?

I wanted to add lights to then be able to cast shadows with the ShadowGenerator.

I tried to add many lights of different intensities with a ShadowGenerator adding all meshes or not to be affected by light but the whole scene seems unaffected.

I also tagged all the meshes’ properties with mesh.receiveShadows = true but nothing.

I followed this guide: Shadows | Babylon.js Documentation

Anything stupid I might be missing that does not make sense? Is HDR within babylonjs compatible with casting/receiving shadows?

Everything should work, can you share your playground with the issue your seeing ?

1 Like

Have had that before. Found that the HDR “Lighting” overwhelmed the shadows, which were really faint. First test is to lower the environmentIntensity of the material of the mesh receiving the shadows. Maybe to 0.1. If you then see shadows, then polish as desired.


Thank you, I will work on a little replica playground!

Thank you that might be the culprit!

Even thought I tried to change the intensity of the environment texture (envText.intesity = 0.1 or whatever) to no luck but that might be something different.

You are saying I should change the environment intensity of the materials of the meshes?

Perfect I will try! thank you!

1 Like

Hello, just checking in, was your question answered? @MelMacaluso