Editor shadowing options

Hi all,

I’ve played around with shadowing options for lights in the editor and seemingly there are several bugs which I’d like to report.

  1. There are several options for shadow maps algorithms which have the appropriate checkboxes:

It seems that there should be not checkboxes but radiobuttons instead, or a droplist which allows to choose only one option. At the moment the checkboxes work like that: if you switch on one option - it is shown in the preview window. But then if you switch on the second option - then the second option is shown in the preview, but the first one is not visible anymore, only the second one, though the checkbox for the first option is still switched on. Moreover, when you switch off the second option - then the preview is not reset to the first option, instead it only switches off the second option returning the scene to the initial state with no options at all, though the first option is still on. In order to re-apply the first option you have to switch it off and on again for it to take effect in the preview again.
So the question is if there should be an ability to choose several options simultaneously or only one at a time. And then in either way the corresponding activation and deactivation mechanism should be implemented.

  1. The shadowing algorithms themselves seem to work in a rather strange way. I struggled to achieve more or less realistic shadows in the editor and by far had no success. Either I have hard and very rough shadow edges or I have some unexpected results at all like the following:

    So I’ve tried different options and combinations of options and different settings and different values of everything there, and I can’t achieve a good-looking shadow. So is this a bug, or I do something wrong?

@julien-moreau what do you think?

Pinging @julien-moreau

@artteq thanks for reporting! I’m checking ASAP!

@artteq found your issue!
I think that you are using blur exponential shadows while casters are also receiving shadows. This is not possible. You can see this playground that works well: https://www.babylonjs-playground.com/#KWS7KD#0 and this playground broken when you allow receiving shadows https://www.babylonjs-playground.com/#KWS7KD#10

Maybe @Deltakosh can explain more the behavior and tell why it is not possible.

@artteq what do you suggest in the editor to do if this kind of rule happens?

It is only a matter of precision unfortunately. Self shadowing required highly precised shadows that you can barely simulate with webGL.
More info: Shadows - Babylon.js Documentation

1 Like

@Deltakosh thanks for the tips!