UE5.4 (and 5.4.1) shadows are broken in VR (VR Template, default settings)

Please select what you are reporting on:

Creative

What Type of Bug are you experiencing?

Other

Summary

I noticed this problem first in my project after I migrated to UE5.4. The shadows from objects were all broken. They are semi-transparent, distorted and jump all over the place when I turn my head. I then tried to create a project with VR Template from scratch and got the same result. We are talking about default rendering settings: Forward Shader, Virtual Shadow Maps, Lumen, Nanite. On top of that Niagara particles experience the same issue (e.g., rain or snow from Ultra Dynamic Sky).

Steps to Reproduce

Create a VR Template and run it in VR Preview on PC (Meta Quest Link, Quest 3 if it makes any difference).

Expected Result

Hands and objects cast correct clearly visible shadows.

Observed Result

Shadows from hands and objects jump around, semi-transparent, and distorted.

Platform(s)

Windows 11

Additional Notes

I’m on NVIDIA GeForce RTX 3080. I re-tested, I don’t experience these shadow issues on UE 5.3.2, neither in my project, nor in VR Template.

Bro, u are not alone!!!
I have the same issue. Looks like the dynamic light is totally broken :frowning:

9 Likes

Same, glad it’s not just me having this issue.

Unreal 5.4 (launcher build), default VRTemplate. I’m getting some odd shadow artifacting when running VRPreview (Quest3). Image attached.

10 Likes

I have found a fix on the UE github repository(commit). You can temporary update the lines in the file until devs release the update.

Old
File: Engine/Shaders/Private/ShadowProjectionPixelShader.usf

float4 ShadowPosition = float4(0, 0, 0, 0);

#if MOBILE_MULTI_VIEW || INSTANCED_STEREO
	ShadowPosition = mul(ScreenPosition, ResolvedView.MobileMultiviewShadowTransform);
	ShadowPosition = mul(ShadowPosition, ScreenToShadowMatrix);
#else

New
File: Engine/Shaders/Private/ShadowProjectionPixelShader.usf

float4 ShadowPosition = float4(0, 0, 0, 0);

#if ((MOBILE_MULTI_VIEW || INSTANCED_STEREO) && SHADING_PATH_MOBILE)
	ShadowPosition = mul(ScreenPosition, ResolvedView.MobileMultiviewShadowTransform);
	ShadowPosition = mul(ShadowPosition, ScreenToShadowMatrix);
#else

Commit also include changes in the Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp but for the temporal fix you can skip them(unlees you want to recompile the engine).

File: Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp
Function: void FDeferredShadingSceneRenderer::BeginInitViews

// Create GPU-side representation of the view for instance culling.
	InstanceCullingManager.AllocateViews(Views.Num());
	for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ++ViewIndex)
	{
		Views[ViewIndex].GPUSceneViewId = InstanceCullingManager.RegisterView(Views[ViewIndex]);

		uint32 InstanceFactor = Views[ViewIndex].GetStereoPassInstanceFactor();
		Views[ViewIndex].InstanceFactor = InstanceFactor > 0 ? InstanceFactor : 1;
	}
3 Likes

Thank you so much! It’s good to know that I’m not alone and the bug can be fixed. I’m a bit cautious to go back to 5.4, though. :smiley: I also saw some reports that the performance is compromised, although I didn’t notice it. I wonder if it is, when you fix the shadows.

1 Like