Shadow degradation

Is there a way to prevent the shadows from degrading and eventually disappearing?
This is what happens:

My shadow map is 4096 in size in the video above. If I make it 16384 it kills my framerate but the shadows still degrade anyway. What would be ideal is to have the same shadow quality whereever my avatar is. Is this possible with webGL?

Is that not due to your light position (if it’s a dir light) ? Shadows - Babylon.js Documentation

The light’s position, as well as the positions of the mesh that you have pushed into the renderlist, determine where the shadows will appear. Note that your light point-of-view from this position have to view all meshes in the renderList; otherwise the shadows may not be rendered.

Yeah like @Vinc3r said, you shadow will extend its rendering to embrace the full scene (resulting in a loss of quality) unless you manually move the light to stay close to the center of interest

Other option: Prevent the light from adapting with

light.autoUpdateExtends = false;

Well I thought that would be a funny solution but it actually worked well for my needs. I could even reduce size of the shadow map.

I just made the light stay the same relative distance from the avatar and now I have a consistent shadow where it counts. I tried making the avatar a parent of the light but that made the light source rotate with the avatar which gave a weird effect. Now I just keep setting the relative distance from avatar within the render loop

1 Like