VSM Page Invalidation Logic for Local Light and WPO casters

To whom it may concern:

Hello. I found even a slight intersection between a spot light frustum and WPO shadow casters will invalidate all page caches belonging to this spot light. I am not sure if it’s the expected behaviour as it wastes many page cache. I also find a finer page invalidation control logic in VirtualShadowMapCacheInvalidation.ush, but the shader involves it (InvalidateInstancePagesLoadBalancerCS) seems never launched.

重现步骤

  1. Create a new basic map.
  2. Make sure VSM is on.
  3. Put a spot light, a WPO mesh and a wind field into the scene. Make sure the mesh only overlaps slightly with the light frustum.
  4. Look at the Cached Page visualization for VSM.

Hi ,

Using the provided steps to reproduce I have successfully confirmed the behavior that you have reported. After some investigation this does not seem like intended behavior and I have submitted a bug report to epic.

You can track progress on the issue here when it becomes publicly available.

Many Thanks

Hi,

We’ve been seeing the same problem with VSMs on UE5.6. It seems to happen when the mesh bounds center is outside of the light cone, but the bounds extent into the light cone.

We’ve done a bit of debugging internally, and it looks like this is due to some of the culling logic in BoxCullFrustumPerspective , specifically this block:

	if (MinW <= 0.0f && MaxW > 0.0f)
	{
		Cull.RectMin = float3(-1, -1, -1);
		Cull.RectMax = float3(+1, +1, +1);
	}
	else
	{
		Cull.RectMin.z = MinZ / MaxW;
		Cull.RectMax.z = MaxZ / MinW;
	}

Because RectMin and RectMax are getting set to cover [-1,1], the entire light ends up getting marked dirty in ProcessCluster() in NaniteClusterCulling.usf.

I’m not sure what the right fix to make is here, because I haven’t dug into all the places the Nanite culling code is used, but this seems to be the root cause of this whole-light invalidation.

Hi

Thanks for sharing progress on this. I’ve been caught up by other issues and didn’t really look into this ever since, hoping Epic to solve it. Given there is no quick solution I think I will come back to this later, in a few days. Please keep sharing if you find anything new and I will very appreciate that.

Best regards.

Thank you for the additional information. I will include it in the bug ticket information to ensure that the engineer looking at the issue can determine its relevancy.