keywords: UE5, Shadow, ShadowMap, VSM (Virtual Shadow Maps), 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 Super Resolution (TSR).

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.

If forgot to disable Nanite in project settings (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 was turned off.
The default value of r.ScreenPercentage for TSR is 66.667, when your switch from TSR to TAA, you need to increase r.ScreenPercentage to improve image sharpness.

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


I was angered, for I had no shoes. Then I met a man who had no feet. -Chinese Proverbs