Why does the shadow edge will keep shaking as long as the camera moves when the autoCalcDepthBounds set to true in cascaded shadows?

Hello,I turned on autoCalcDepthBounds and when the camera moves, the shadows wobble a lot .I wonder if there is a way to prevent the edge of the shadow from shaking in cascading shadows when setting autoCalcDepthBounds to true and camera moving.

I set autoCalcDepthBounds to true in this PG and the edges of the shadows shake a little when the camera moves.

I set autoCalcDepthBounds to true in this PG and the edges of the shadows shake much when the camera moves.

cc @Evgeni_Popov

You can’t stabilize the cascades in the auto calc depth bounds mode, as the camera extents are updated each frame, depending on the min/max values of the depth buffer.

Having said that, I can’t really see the shadow edges shaking, even in the 2nd PG when I enable auto calc depth bounds…

You can try to change the number of cascades, size of textures or lambda parameter to mitigate the artifacts.

In both scenes, shadowMap size is 1024, Lambda is 1.0 and Auto_Calc depth bounds is true.The edge of the shadow wobbles a lot more in the scene with people when camera moving or rotating, but in contrast the other one wobbles a little .
The following is the screen recording of two scenes:

I ask this question because when I turn on cascade shadow in a large scene, I can adjust various parameters (such as lambda/shadow MaxZ/Num Cascades/shadowMap size/stabilize cascades) to achieve the effect that the shadow edge does not shake when autoCalcDepthBounds is not turned on
and camera moving or rotating.

However, after autoCalcDepthBounds is turned on in the same scene with the same parameters (except stabilize cascades set to false), the shadow effect is very good when the camera is not moving. Once the camera starts to move, especially rotation, the edge of shadow will shake very badly. I want to see if I’m missing some key parameters.

I think I found the difference between the first two scenes, mainly because camera.inertia in one scenario is 0, the other is 0.9 . But unfortunately, this parameter doesn’t have much effect on my scene.


I don’t see any problems with shadows in your last 2 PG? In the 3rd before last, I’m not sure if it’s possible to do any better without increasing the texture size, as the features of the portal are quite thin… Also, I guess you already read the doc page related to CSM:


I’ve read read the doc page related to CSM several times, but I didn’t find a good solution.It’s not just this thin shadow that wobbles around the edges, other edges wobble a lot too.

I used cascaded shadows, but did not turn on autoCalcDepthBounds in the third scene. I adjusted shadowMaxZ,lambda and stabilize cascades , the edges did not shake at all, even if the camera keeps moving or rotating.That’s what I want it to be. I put it here, mainly with the 4th scene turned onautoCalcDepthBounds to contrast.

The 4th and 3rd scenarios differ only in that autoCalcDepthBounds is turned on and stabilize cascades is turned off.It works very well when the camera is not moving, and once the camera moves, the edges including the edges of non-thin objects such as walls shake a lot.

The sharpness of the shadow I can improve with the size of the shadow map, my main problem at the moment is that the edge wobbles too much when the camera is moved or rotated and autoCalcDepthBounds is turned on.

I don’t see how to fix it, unfortunately, stabilizing cascades is not supported by the algorithm used when autoCalcDepthBounds is true. Maybe (probably) implementing the second stage of the SDSM algorithm would help, but it’s not straightforward and wouldn’t be without some GPU cost.

1 Like

Thank you very much for your reply.
I’m trying not to open autoCalcDepthBounds for now.Because when wandering, the shadow edge shaking can make people feel dizzy.
Looking forward to seeing SDSM algorithm on babylon.