Fixing virtual shadow map bugs in Unreal Engine 5 and Lumen

Hello, I ran into two shadow bugs that come with virtual shadow maps.
blocky shadows and jagged or missing shadows.
It was quite a journey to find solutions for this and thought it might help when i post my findings.
if you find missing shadows,
image

you might want to try this console command:

r.Shadow.Virtual.OnePassProjection.MaxLightsPerPixel 32

but for the pixelated shadows,

you also need to change something in the DefaultEngine.ini.
Put all of it like this:

; fix shadowbugs
r.Shadow.Virtual.MaxPhysicalPages=16384
r.Shadow.Virtual.ResolutionLodBiasLocal=-2
r.Shadow.Virtual.OnePassProjection.MaxLightsPerPixel=32

for detailed explanation with pictures, pls read my blog post
https://www.artstation.com/blogs/saschahenrichs/b38B/fixing-virtual-shadow-bugs-in-unreal-engine-5-and-lumen

3 Likes