Submit depth texture from camera to OpenXR runtime

Hello, I’m using custom OpenXR plugin to VR/AR project and Unreal Engine version 5.3.2.
Is it possible and how, to submit depth texture from camera to OpenXR runtime in Unreal engine?

The default OpenXR plugin at least submits depth by default if the runtime supports the XR_KHR_composition_layer_depth extension (except the combination of SteamVR and Vulkan is actively blocked). It is controllable with the xr.OpenXRAllowDepthLayer console variable.

What custom plugin are you using?

Does this mean that Stereolayers WorldLocked will be compliant with depth on platforms like MetaXR using only OpenXR?

Currently stereolayers are always rendered infront (unreal 5.7). I want it to respect scene depth.

That would require using a vendor extension like XR_FB_composition_layer_depth_test, and I don’t think that’s implemented into the Unreal OpenXR plugin currently.

I tested, it seems to work fine. Opaque materials are placed in front.

You’re right! Looking at the code, it was added almost a year ago for 5.6.

1 Like

Not sure if this fits the context or not but I’d like to ask you if you know…

Do you know if any color fading works with vanilla OpenXR on quest on all compositor layers, including the scene?

MetaXR has a “SetColorScaleAndOffset” function which is similar to OpenXR “SetColorScalAndBias”. Their differences is that the former includes a “ApplyToAllLayers” and the latter doesn’t. So the fading only happens on the scene and not my spawned StereoLayers.

I’ve never used it, so no Idea really.

Looking at the code, it only applies the output of SetColorScaleAndBias to the scene layer, and doesn’t seem to have any similar code for the other layers. It does seem like it would be relatively easy to write a plugin that implements the UpdateCompositionLayers_RHIThreadcallback, and duplicates the values from the scene layer to the others.

1 Like

Cheers @Rectus I just tested it out and it works brilliantly.