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

1

Whenever I have a niagra effect finish, it leaves a shadow behind like its burnt into the world. Refer to animated gif, you can see the shadow remain after the firing animation completes.

This burnt in shadow lasts until I zoom in, after which the artifact corrects itself and goes away until I shoot again.

How does one correct this graphical issue with niagra fx? (or if its not just pertaining to niagra, in general?)

EDIT: This is not a niagara issue, this is a virtual shadow map issue and the actual problem is the top of the staff here is having its shadow linger on the ground until I zoom in or rotate. This is covered in the solution on how to fix.

1 Like

I notice someone here having the same problem

Have you tried changing the emitter to CPU?

I have not. I have been assembling some information that may solve the problem. Your reply is a new solution to try.

So far what I’ve found is that the issue derives from a virtual shadow map cache not updating itself properly.

Some solutions I have seen to try:

  • Disable Virtual Shadow Maps (not something I want to do unless I have to)
  • Disable shadow map caching if the performance hit is acceptable

Using console command “r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1” to show the actor bounds scale and see whats popping out thats not causing a refresh.

Also suggested to try: View Mode (usually Lit) in Viewport → Virtual Shadow Map → Cached Page to see valid and invalid spots.

Another person posted something about “character mesh bound scale works for him” and he showed him setting the BoundsScale to 100 on his character mesh.

This leads me to believe that the problem is the staff mesh in the mannequin’s hand is larger than the bounds scale, and it is that staff shadow that keeps getting left behind on the ground. Not just when he shoots like in my graphic, but when he’s walking around as well.

I will play around with a few of these and post what worked, and likely do a video on my youtube page highlighting this one simply because it was a bit more ornery. Thank you for the added suggestion to try and look into as well!

1 Like

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.

8 Likes

This answer was super helping in solving this for me. But when I use the command r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1 I don’t see any bounding boxes? Is there something else I need to enable? (fixed it by trial and erroring a value in the bounds box for now, but showing the bounds would be better).

1 Like

Same for me. I can’t manage to work r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1. And I don’t know how to change bounds on the mesh.

I have the same issue. I made it work by setting up the character’s physics asset

Did you manage to figure out how to be able to see the debug box using the command r.Shadow.Virtual.Cache.DrawInvalidatingBounds 1 and how to change the bounds on the mesh?