LoD works fine. I use it to hide far away tiles of in OSM render.
Shadows are great to, makes the virtual world way more realistic.
If a tile gets invisible, its shadow should get invisible to, shouldn’t it?
But it doesn’t! (see appended picture).
The LoD visibility depends to the distance to the camera; fine.
The shadow visibility depends to the distance to the Shadow Camera? No please.
The GPU doing the cyclically LoD check and switching, not by BJS code, right?
I checked the BJS forum for that topic and found nothing.
But I found this related Playground https://www.babylonjs-playground.com/#RLQ5JX#5
by Babylon.js Documentation
And, o wonder, it works fine. The (box) shadows disappear with the boxes and are replaced by the sphere shadows.
So I checked, what’s different to my code: the playground uses instances.
LoD of shadows work fine with instances but NOT with the originals!
That’s not as it should be, hm?
Is it an error of the (my) GPU or is it caused and correctable by BJS code?
So what, I changed my code and used instances.
And yes, it works BUT the CPU load is twice as high, not useful to me.
To hand you a playground, I edited another example:
This time, even if I did not use instances, the shadow disappeared correctly
Why? Because this time I did not use addLODLevel with the second parameter as null.
Only by using null, the BJS error occurs, if I many call it an error.
That means, I have a nice workaround: replace the near mesh by an (invisible) dummy-far-mesh
!!! NOT working. Please wait …