This question was created in reference to: [r.Shadow.LODDistanceFactor [Content removed]
Hi, our issue isn’t directly related to the referenced issue, but was discovered as a result. It still happens with an unmodified 5.5.4 and 5.6.0 engine (see repro project). We flagged r.Shadow.LODDistanceFactor as ECVF_Scalability so we could increase it for our lower scalability settings, revealing that our foliage meshes go through a different code path for CSM shadows that doesn’t seem to correctly account for that cvar when the mesh has WPO in one of it’s materials. This manifests as the shadows for that mesh getting culled much closer to the camera than intended. See the attached video.
My best guess is that this is an issue in the bounds calculation for culling the shadows (due to the fact that decreasing r.Shadow.RadiusThreshold to a very small value, artificially expanding the static mesh bounds to a very large value, and removing WPO are all attributes that mitigate the issue). I can confirm they’re following the code path in NaniteCullingCommon.ush (despite having nanite disabled) where it passes the following condition (when it shouldn’t succeed at that distance):
if (RadiusSq < NaniteView.CullingViewMinRadiusTestFactorSq * InstanceDrawDistSq)
{
bIsVisible = false;
return bIsVisible;
}
That said, I’m not able to pin down what aspect of that flow needs to be changed specifically in order to account for that cvar correctly. Any suggestions would be appreciated.