[UE5.8.1] How to fix Cascade shadows disappearing?

I’m building a tower defense game. I’m working on level 6. All other levels work fine. I only have cascade shadows on with one directional light. No nanite. No VSM. No DFS (so I can try to debug this). No far shadows. The directional light is stationary though it does the same thing with movable. The assets are stationary as well.

Notice there’s a section of shadows near the camera fading out. Why is it doing this? There are only 100 assets in my level and they’re all in a small rectangular area except for the landscape that extends out 50k in all directions. 100k wide. I thought maybe it was the landscape. If I make them invisible, the problem is still there as seen in the screenshot below in the bottom right.

If I turn CSM caching off, then it renders correctly. Raytracing also renders correctly. But I’d like this to work on older video cards.

I’ve tried asking different AI for solutions and after trying a million different things, nothing helped except turning off CSM caching.

Anyone know how to fix this?

I finally found it. When you move the camera along the ground, this is called CSM scrolling or camera scrolling (in the source code). What the engine does when new actors enter the view is to group them into clusters. These are dynamic. But the engine will group actors in a rather large area. I could not find anything to set these bounds. My level sits within a 4k by 4k area. And I think this is exactly the grid size it uses. So anything in there can be put together into a single cluster. So what happens is that there is a setting that limits how many new shadows in a cluster the engine will render in a single frame. It is set to 5. So if your cluster has more than 5 actors when it enters the view, only 5 will have shadows. The rest will not have shadows. I have no clue why it doesn’t render the rest of the shadows on the next frames but it does not render them.

Anyhow, the setting is:

r.Shadow.MaxCSMScrollingStaticShadowSubjects

Set it to 100 or something and it will force it to draw all the shadows.