VR - Sphere trace disrupts the camera, and doesnt work

Hello everybody. I am new here, thanks in advance for welcoming me :slight_smile:
I have a project that i started up as TopDown template, then I have migrated it into VR Template, because i wanted to try a topdown game with a VR camera.
The version I use is Unreal 5.3.2

When I try and use the Nodes ā€œSphere Traceā€ or any ā€œTraceā€ node, that messes up the camera.
I have tried the nodes in all the other non-VR templates (FPS, ThirdPerson, Topdown,etcā€¦) everything works.
But in the VR Template and in my TopDown migrated into VR Template, that doesnt work at all.
Sometimes it crashes the game preview (in selected viewport), this is the log i get after pressing X for my ā€œSphere traceā€ action crashing :

PIE: Play in editor total start time 0,125 seconds.
LogBlueprintUserMessages: [VRPawn_C_0] PRESS X
LogOutputDevice: Warning: Script Stack (0 frames) :
LogStats: FPlatformStackWalk::StackWalkAndDump - 0.023 s
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: DepthStencilRenderTarget.DepthStencilTarget->GetNumSamples() == NumSamples [File:D:\build++UE5\Sync\Engine\Source\Runtime\RHI\Private\RHI.cpp] [Line: 1606]
LogOutputDevice: Error: Stack:
LogOutputDevice: Error: [Callstack] 0x00007ffab6b8aaa6 UnrealEditor-RHI.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa89616f0c UnrealEditor-RenderCore.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa89615927 UnrealEditor-RenderCore.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa895dc2e2 UnrealEditor-RenderCore.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa8964f237 UnrealEditor-RenderCore.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa895f3414 UnrealEditor-RenderCore.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76ad8cd5 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76ad8a7c UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76ab80e2 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76b008c2 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76ac8b60 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa76caf773 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa770e4e32 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffa770d8667 UnrealEditor-Core.dll!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffac7ef53e0 KERNEL32.DLL!UnknownFunction
LogOutputDevice: Error: [Callstack] 0x00007ffac818485b ntdll.dll!UnknownFunction
LogStats: SubmitErrorReport - 0.000 s
LogRHI: Error: Breadcrumbs ā€˜RenderingThreadā€™
Context 1/2
00 Scene
01 Translucency

Thanks !

Hey there @tekmoh777! Welcome to the community! Looks like a depth pass issue, are you using custom depth stencils?

When you mention the traces ā€œmess up the cameraā€. Do you mean the crash is caused when debug traces (the visible lines) are trying to render?

Does it still crash if the debug visuals arenā€™t enabled?

Hello SupportiveEntity, thanks for replying.

Does it still crash if the debug visuals arenā€™t enabled?

You found it right !
When I disable debug drawing in the node ā€œSphere traceā€¦ā€, it doesnt crash or mess camera anymore :+1:

However, I have never set up personnally ā€œcustom depth stencilsā€ in my project.
It seems like VR template has set up something about ā€œcustom depth stencilsā€ that we are not aware of. In fact, I have tried every template, and only VR Template reproduces the problem.
And I have found this post too here, same problem and using VR template ā€œMetaHuman with VR settings crashes edtior with DepthStencilRenderTarget.DepthStencilTarget->GetNumSamples() == NumSamplesā€.

I dont know yet what is custom depth stencils, but i need to understand how and why its configured in VR Template, and if i need it in my project, because Debug Drawing for Sphere Trace functions seems really useful .

What do you think about that?

Custom Depth Stencils are primarily used for masking objects through walls or changing the way the depth of that masked object appears on the depth map. Itā€™s often used for highlighting things through other meshes. I am going to set up a test bed to replicate this to see if I can discern where the depth buffer is being altered. Which HMD are you using for reference?

I am very interested in the results of your tests.

Regarding the HMD, i dont use yet a HMD.
The purpose is to build a prototype before getting the HMD. (the prototype needs only the VR camera, and no VR interactions like VRGrab etc.)

The fail occurs in 2 projects :

  • the vanilla VR template. When i add my nodes into the blueprint ā€œVRPawnā€, and press assigned key in game preview for event to launch
  • my own project which i started from TopDown template and then migrated to VR Template. The main Blueprint remains my TopDown blueprint, with its own classic camera. And i placed a VRPawn camera (slighly customized) that is quite useless for the moment, until i can try with the future HMD. I added the nodes in the main blueprint (TopDownCharacter). The game runs decently (character, non-VR camera, etcā€¦), until i try Sphere trace with Debug Draw.

I canā€™t seem to replicate the issue itself. Does any debug line being rendered cause it? May I know your specs?

I have not set up debug lines manually. Maybe there is debug line from VR template ? Where should i look ?

Regarding the specs, i have reproduced the same crash on a second PC, it crashed and i sent the report.

My specs are :

  • cpu : i7 11390H
  • gpu : Mesa Intel Xe Graphicd
  • Ram : 16gb

The other pc is like :

  • cpu : i5 3570
  • gpu : nvidia 960
  • ram : 8gb

Iā€™m getting reports of this error in other contexts, but still canā€™t replicate it. Trying to dig a bit deeper, though this might be an environmental concern.

Are you by chance using a metahuman?

For example:

No, i dont use Metahumans.
Have you tried to reproduce it on VR template without HMD ?
Because it really seems related to VR template, and i have not installed any third party driver for VR (like Windows Mixed Reality or other) :

  • VR template
  • No HMD
  • No third party VR driver
  • No MetaHumans
  • Sphere trace with Debug Draw on VRPawn (or in topdown character)
  • Unreal Editor 5.3.2
  • Windows 11 professionnal
  • directx 12
  • .net 4.0.30319

Iā€™ve tried with a Quest 2 through OpenXR, standalone without the HMD, and PIE without the HMD in windows 10 and DX12. After firing the debug draw there are no errors, stalls, or anything. It might be best to report the bug as itā€™s likely something environmental.

https://www.unrealengine.com/en-US/support/report-a-bug

Thank you for the efforts, you did your best and I appreciate.
Now Iā€™ll try to report that behavior as a bug as you suggest

Thanks! If you find a variable that can help reproduction, or any new information please let me know!

Have this happening sometimes too in the default VR template