Lingering shadows that stick to the ground after movement - how to resolve?

image

So running the game, and then running the command
r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1

Shows the above image. Note that the top of my staff is sticking out. That is the culprit and what is causing the issues with “shadows sticking/lingering”.w

How to Fix
There were two ways that would accomplish the fix. The first is going into the skeletal mesh of the character in blueprint, (make sure the skeletal mesh is selected) and pulling its Bounds Scale.

image

Bumping this to 2.0 resulted in the following bounds being shown me in the editor when running the game:

This fixed the issue. However… this is not the best solution. Doing some research in Unreal docs regarding shadow maps found here: Virtual Shadow Maps in Unreal Engine | Unreal Engine 5.0 Documentation

The larger this area is that we are defining, the more space will be invalidated everytime we move. Now this can cause performance hits. We want these volumes to be as tight as possible.

I noticed that the staff had a volume as well. See how small that is in the image above? What if we set the bounds of the weapon instead? Because the issue is that the staff is causing these artifacts because the staff head and tail are sticking out of its bounding box (the tail tends to not cause the problem but thats because its encapsulated in the character box).

I set the character back to a 1.0 scale, and the staff after dorking around a bit found that 1.65 encapsulated it. See image above. (also note the sword guy next to him has the point of the sword sticking out of its box… which also can cause this problem)

2

That also fixes the problem as you can see in the gif. No more shadow relic. And the bounding boxes are tighter resulting in a better solution since I am making sure that the invalidation of the shadow map is as small as possible for better performance.

11 Likes