Need help with ShadowGenerator

I’m using three SpotLights to light up my scene. I want shadows from all the three lights. Problem is, shadow generated by one light is removed by the other ie. the shadowed area created by one light is lighted up by another.
How do I get shadows from all three lights at the same time ?
Please check the below screenshot.
screenshot-1

When I switch on the opposite light, the shadow disappears. I want it to stay. Please help.

Hello, we will need a repro in the Playground to help you.

Sorry.
Please check Babylon.js Playground

You can switch on and off the lights in lines 56 and 57. When both lights are on, the shadows naturally disappear. But I want them to say. I basically want to reproduce the shadow arrangement from threed.io. Please check attached pic.

Hello this is because each light boost the intensity to the max level and thus the additional light cannot boost it more

Here is an example (I added blurred shadows as well) with less powerful lights:
https://www.babylonjs-playground.com/#5LY1CB#2

1 Like

Hi,

I am kinda thinking that you can cheat that effect. Just a theory tho. You can use 1 light instead of 3 (lights are expensive) and maybe place a sphere somewhere in between the ground and light, and use shadow from the sphere instead shadow from the phone.
Shadow from the sphere will be beneath the phone, with some parameter tweaking maybe you can get that effect.

something like this (i just played around with few parameters)
https://playground.babylonjs.com/#99XUYS#1

Also for this to work, you cannot set sphere.isVisible = false, there will be no shadow. Instead you assign a material to sphere, and set alpha of that material to 0; And then you set shadowGenerator.setTransparencyShadow(true);

You can play with
spotLight angle (line 17)
light intensity (line 19)
blurKernel (line 28)
sphere size, (line 34)

to see some different results.