[UE5]Shadow Notes
keywords: UE5, Shadow, ShadowMap, VSM (Virtual Shadow Maps), TSR (Temporal Super Resolution), DirectX 12, D3D12, DirectX 11, D3D11
The previous article: UE4 Shadow Notes
Common
VSM Optimization
Experiment with reducing this value from the default of 8. The visual difference between any two adjacent values, e.g., 7 and 8, is nearly imperceptible. However, the performance benefit will not go unnoticed, especially in scenes with lots of shadow casting lights:
r.Shadow.Virtual.SMRT.SamplesPerRayLocal
The corresponding SamplesPerRayDirectional
has similarly low impact on visual fidelity, but only improves performance on your directional lights (e.g. sun, moon, etc.), which are generally less prevalent in most game levels. Thus modification of this parameter has less of an impact on performance.
r.Shadow.Virtual.SMRT.SamplesPerRayDirectional
Origin: Unreal Engine Performance Guide - AMD GPUOpen
How to go back to UE4 visual effect to save performance
Disable 4 features of UE5:
- Lumen: Settings -> Rendering -> Dynamic Global Illuminatioin Method :
Standalone Ray Traced
. - Nanite: Settings -> Rendering -> Uncheck
Nanite
. - Virtual Shadow Maps: Settings -> Rendering -> Shadow Map Method:
Shadow Maps
. - TSR: Settings -> Rendering -> Anti Aliasing Method: Temporal Anti-Aliasing (TAA).
Or alter Engine.ini:
[/Script/Engine.RendererSettings]
r.DynamicGlobalIlluminationMethod=3
r.Nanite.ProjectEnabled=False
r.Shadow.Virtual.Enable=0
r.AntiAliasingMethod=2
r.TemporalAA.Upsampling=True
Virtual Shadow Maps and Nanite require DirectX 12 or Vulkan, so if don’t use them, you can switch RHI to DirectX 11.
r.Nanite.ProjectEnabled=True
by default) before packaging, execute console command r.Nanite 0
at run-time to disable Nanite.
Engine.ini (set RHI to DirectX 11):
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX11
Comparison:
The main reason why the frame rate increased significantly is because TSR and RayTracing were turned off:
- The default value of
r.ScreenPercentage
for TSR is66.667
, when you switch from TSR to TAA, you need to increaser.ScreenPercentage
to improve image sharpness. - If switch from D3D12 to D3D11, the shadow computation will use the Shadow Map (UE4 style) instead of Virtual Shadow Map which using RayTracing.
Misc
Issues
Fixing the Ugly Shadow Issues in Unreal Engine 5 (Ray Traced Shadows Issue)
https://www.youtube.com/watch?v=F3XSKXhIAuU
References
Virtual Shadow Maps
https://docs.unrealengine.com/5.3/en-US/virtual-shadow-maps-in-unreal-engine/
Virtual Shadow Maps in Fortnite Battle Royale Chapter 4
https://www.unrealengine.com/en-US/tech-blog/virtual-shadow-maps-in-fortnite-battle-royale-chapter-4
Sparse Virtual Shadow Maps
https://ktstephano.github.io/rendering/stratusgfx/svsm
Lighting: Unreal 5 Features Reference (Recommended)
https://medium.com/@shinsoj/lighting-features-cheat-sheet-5b81b63b3ab7
I was angered, for I had no shoes. Then I met a man who had no feet. -Chinese Proverbs