VSM invalidation during nanite streaming

During cinematics we some some camera cuts. When the camera cuts to a very big nanite mesh, the shadows on the mesh look incorrect. Disabling/enabling VSM cache fixes the shadow issue (as that forces the mesh to be re-rendered into the VSM). If I mark the mesh to always invalidate shadow maps that also fixes the issue, but is not ideal for performance reasons.

What feels like its happening is that when the camera cut happens, the nanite mesh is very low quality as nanite data is not yet streamed in (This can be seen for a few frames as the mesh looks very quality until it streams in). I believe the VSM pages for the mesh get rendered while the mesh is still very low quality, and then they don’t get updated once the mesh is fully streamed in, so the shadow looks incorrect.

Could you confirm that nanite streaming will not invalidate the VSM pages? If so, what is the intended way to get around this issue (especially for camera cuts)?

I feel there must be some logic for invalidating the VSM as you move through the world, as otherwise we would be seeing shadowing artifacts elsewhere, but the above explanation is currently the only one that makes sense for the issue we have.

Steps to Reproduce

Hi Marko,

Camera cuts are known to clash with how VSM and Nanite streaming work together, and this has been called out in our public documentation: https://dev.epicgames.com/documentation/en\-us/unreal\-engine/virtual\-shadow\-maps\-in\-unreal\-engine\#caching. At this point, nanite mesh streaming does not invalidate VSM cache pages. We are still working on improving this area of the caching feature and currently have an experimental car that you could enable that will force VSM cache page invalidations on streamed nanite meshes (r.Nanite.VSMInvalidateOnLODDelta) if the LOD delta would usually create an invalidation. If you enable this, I would also recommend that you profile your game to ensure this does not overwhelm your streaming manager. Please let me know if you have any further questions.

Cheers,

Tim