OculusXR Passthrough Layer

I have a character in a simple environment, but I’m trying to make it so the the environment disappears and the character stays in so you have an AR view of the character in your room. I’m using the Quest Pro. So far all I can do is have Passthrough turned on entirely with nothing around you or completely off. There is an opacity slider where you can get a ghostly in-between of both passthough and the virtual world. But I want the character in the Passthrough one.


2 Likes

Generally for an AR view, you’ll want to put the passthrough layer behind the app content and output a transparent alpha in the framebuffer where you want the passthough to be visible. By default Unreal doesn’t output the alpha, and renders it in inverse, so the alpha is 0 in areas rendered too, and 1 in clear areas.

The documentation here seems to suggest that the OculusXR plugin sets up the alpha automatically though, all you should need to do is set the layer to Underlay, and not render anything in transparent areas:
https://developer.oculus.com/documentation/unreal/unreal-customize-passthrough/#compositing-and-masking

Do have an idea on which Stereo Layer Shape I should use for that?

Likely the same one as above.

I got it working for a second. Then randomly it stopped working. Might just be a bug

1 Like

may i ask how you exactly managed to do it? i have managed to have passthrough and to switch between passthrough and VR mode but im lost on how to display an object in passthrough mode, if you could tell me the steps you took to achieve that i would highly appreciate it

I found that if your headset screen turns off after you connected it to the computer. Passthrough is disabled until you disconnnect and reconnect the headset. Don’t let the headset screen turn off! It should work.

2 Likes

May I ask how to turn off the passthrough layer after I using the node “add passthrough layer”?Thanks.

May I ask how to turn off the passthrough layer,I turn on it by adding a passthrough layer node on level blueprint. Thanks.

ok ill leave this for future people who might stumble upon here, here is what i have found:
1_ your material needs to be in translucent mode you can have opacity all the way to 1 but the mode needs to be translucent in order for the object to be shown in passthrough mode
2_ passthrough API s as of now really new, there will be lots of weird bugs and problems and etc and there isnt much documentations or tutorials, so you have to learn most stuff on your own
3_ the performance might suck, but thats just in editor, once you package it it should be nice and smooth…but rn for some reason passthrough layer is not visible in packaged version while it works in editor, if i find a solution for it ill write it here

to do so, make sure your passthrough is set to overlay and the visibility is off, to get back to passthrough turn visibility on and set passthrough to underlay

Apparently passthough for Meta headsets on PC is only supported for development. The plugin seems to disable it for PC builds.

i managed to make it working by deleting the skybox and by doing that all the meshes could be visible not just assets with translucent materials…but its really weird cuz in editor you could have the sky box on but then only assets with translucent materials could e shown and it was really interesting cuz i could make a portal and within passthrough mode i could see thru the portal and see the VR world…but for some reason i cant do it in build version, i can only see passthrough once i disable skybox which is really annoying

if what you saying is the cause of that do you know by any chance if there is a way to keep the plugin active even after packaging the build?

It sounds like the translucent materials are working in the editor because they are writing to the framebuffer alpha channel, and that is making its way to the output. I don’t know how the Meta plugin handles alpha compositing, but normally Unreal doesn’t have proper support for writing alpha from materials in the main render pass. There doesn’t seem to be any way to directly make it output a transparent alpha from opaque materials, apart from modifying the engine.

One option on PC is to have postprocess material that takes depth or a custom stencil, and writes out alpha based on that. It may interfere with the Meta plugin though.

I have no idea about keeping the plugin active. A lot of the code for it seems to be hidden in a closed-source library.

Thanks for your reply,but if I set the it overlay and visible is off,then I can not see the real world, only I set the visible is on it works. I have no idea how to go back to the virtual world.

Can you explain more what you mean? I’m having the same problem. did you finally solve the problem? What do you mean turn off the headset screen? You are doing play in editor or app build?

When you open up the Unreal Project, make sure the VR headset is already on, do not let the VR screen go to sleep while it is connected to Unreal. Otherwise you’ll get a black background.

It may need to open the through tonemapper in the project setting. Passthrough over Oculus Link: Unreal | Oculus Developers

Hello,

I have been trying with the OculusXRPasstroughLayer for awhile with little success.

I deleted everything in the scene (including te skysphere and any kight) and just put a sphere with transluscent red material.

When I put the LayerPlacement to Underlay, I just see an empty dark VR scene with my sphere.

When I switch it to Overlay, then I see the Passtrough but no VR object. If I change the Alpha of my Overlay, I can start to see my sphere.

I also tried using PostProcessMaterials, along with PostProcessVolumes and StencilDEpth as in this tutorial:: How to Create Masks With the Custom Stencil Buffer | Tips & Tricks | Unreal Engine - YouTube

Nevertheless, it does not work more. It seems I am getting too complicated. There must be an option I gorgot to clic somewhere. It seems too complicated.

Can someone jhelp me please ?

 Thanks and regards,

Just had the exact same problem with meta quest 3 and UE 5.2 … and found a solution, which I posted here:

In short: The “Underlay” functionality started to work as expected after I changed the Mobile Antialiasing Method from “None” to “Multisample Anti-Aliasing (MSAA)”.

In case this still doesn’t help, I recommend comparing and matching your rendering settings against the ones from epic’s VR template.

Hope this helps

2 Likes