Weapon shadow problem

Hello, I have a very strange problem with the shadow of the player’s sword. A shadow remains for some time after weapon’s movement and this happens with every weapon and does not look so good.
I would greatly appreciate your help. I took a video to show the problem in a better way:

someone?

It looks normal to me, what am I missing?

Hi, look at the floor after the swing of the sword . yo can see it has an incorrect shadow, that stays after the swing for some time.

Screenshot 2022-09-21 210737

Ok, bizarre, I have no idea, and can’t find anything about it either…

I’d turn off all the new 5 stuff and see what happens, especially virtual shadow maps.

I know that’s no solution, but it might give you an area to look in.

It’s so strange… none of the shadow settings help either.

did you try turning off virtual shadow maps ( project settings )?

Yes, and according to what I see, this solves the problem.
But can I package the game like this?
I mean it’s not a problem?

Well, the shadows are better with them. It depends how close you are to packaging.

It could be a setting you need to tweak, or a bug. You might need to wait for a fix ( I don’t know ).

If you have to package soon, you can disable it for now, and patch it later when its fixed.

That kind of thing.

I believe it’s from VSM failing to update cached shadows correctly, it can be related to the object bounds. Check the documentation Virtual Shadow Maps in Unreal Engine | Unreal Engine 5.0 Documentation particularly the Managing Cache Invalidations section.

1 Like

I did what is written and unfortunately it doesn’t help. Is there anything else I can try?

Changing it off “virtual shadow maps” worked for me (for a similar, but not identical problem)!

That is one way to avoid the issue. Fixing it requires increasing the object’s bounds. Bounds should be set as small as possible to avoid unnecessarily invalidating the cache, but large enough that a cache doesn’t fail to update. Bounds are also used for culling purposes, so the impact to that must also be considered.

1 Like

Thanks! This reference helped me figure out the source of the problem.

Using the virtual shadow map cache visualization, I could see that the tip of my weapon was casting a shadow into a VSM page that was outside the constantly updated page around my character (visualised in blue). The lingering shadow fragments wouldn’t get invalidated away until I walked near them again.

The Fix: Check Include Component Location Into Bounds for the skeletal mesh casting the problematic shadow.

You could also try simply increasing the bounds scale of the thing casting the shadows (e.g. from 1 to 1.5), but IMO this seems like it’s stepping around the problem rather than addressing it directly.

Probably worth experimenting with those other bounds-related checkboxes too if your problem is a bit different to mine.

There may be different performance implications of one or the other method, I’m not sure.

Similar answer with same conclusion(s) here: Can someone explain why the shadows are trailing? - #6 by cgnrat

1 Like