On the topic of fixing the shadow artifacts related to Virtual Shadow Maps:
Firstly you can test if it is caused by shadow maps by using the console command r.Shadow.Virtual.Cache 0
and seeing if this removes the artifacts.
If you go to the docs on Virtual Shadow Maps it says:
Geometry that can be deformed using Skeletal animation, or materials using World Position Offset or Pixel Depth Offset always invalidates cached pages every frame. By definition, these cases must also be non-Nanite — which is more expensive — and therefore it is extremely important to ensure that these features are used carefully and bounds are kept under control.
It seems the main issue is that auto generated bounds are not fully containing the mesh after the vertex anims are applied. So you need to extend the mesh bounds fully contain the mesh with Vertex Anims.
To fix this:
- Run your game and enable the console command:
r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1
- Open your static mesh and adjust the
Postive Bounds Extension
until it contains the mesh (is there a better way to adjust the bounds?) - Shouldn’t have any shadow issues if the bounds are applied correctly
See video below:
I don’t know about the performance considerations of what I have described here. It says in the docs that “materials using World Position Offset always invalidates cached pages” and I assume extending the bounds of the mesh will worsen the performance.
If anyone knows a better solution to this, please let me know.