Virtual Shadow and Local Lights Performance

I have a scene with lots of stationary omni lights with shadow. Frame is static.
shadow map performance : Shadow Depth = 0.02ms
VSM performance : Shadow Depth = 22.45ms

VSM claims that it should only render shadows on change:

Pages are allocated and rendered only as needed to shade on-screen pixels based on an analysis of the depth buffer. The pages are cached between frames unless they are invalidated by moving objects or light, which further improves performance.

But it seem this is not the case. Is that a bug?
UE 5.0.3


Are these Nanite meshes? Because Nanite meshes are pretty much required to get reasonable performance out of VSM.

Also you should use the profiler (ctrl shift ,) so that you can drill down on the cost.

You don’t mention how many lights are in view but for reference, here’s 72 point lights on an RTX3070:

  1. no, those are not nanite meshes. Why nanite is required for VSM? I’ve worked on several other engines and VSM worked just fine with conventional geometry.
    In this case all should be cached, it does not matter what geometry am I using because no invalidation occurs, no cache pages should update.

  1. 49 point, 4 spot lights. All with shadows.

Also, without profilers editor shows 13 ms vs 33ms frame time. The only difference is VSM enabled. I don’t see that 20ms difference in profiler.

Sounds like you know best, good luck

1 Like

well, thanks for the effort :slight_smile:

1 Like

Man, it’d be great if there was some feature that would improve performance with VSM…

" Multiple Lights Performance

Performance in scenes with many small local lights is still a work in progress. For the time being, the best strategy is to enable one pass projection and be very careful with invalidations to keep as many of the pages cached as possible. Multiple local lights will perform far better with Nanite geometry than non-Nanite geometry, so aggressively culling or disabling shadow casting on non-Nanite geometry in the distance can help a lot."

2 Likes

Thanks for the answer!
So, one-pass projection speeds-up shadow projection by 4ms, which is huge gain. Now clustered shading + VSM projection takes about 1ms. That seem reasonable.

But Shadow Depths are still there, doing God knows what. TAA caused some occasional page invalidation, so I’ve disabled it, now UE tells me that there are 0 Draw in pages goin on. Yet it still takes ~ 2ms :face_with_raised_eyebrow:
Most of that time in so-called RasterPasses per each light. Is this a constant overhead of VSM?