Here I will explain how to get the underlay passthrough working for the quests on the MRTK3 systems. This can be really useful for cross platform development for the Hololens 2 and other Quest devices.
- This project uses Unity version: 2022.2.3f1
-
If you build the project, MAKE SURE you have set the Android plugin provider to OpenXR, otherwise you don't have hand tracking.
-
With underlay, objects are fully opaque, so you cannot see the passthrough behind objects. So if you want to be able to always see the passthrough or have the same feel as a Hololens, set the passthrough layer on overlay and set the opacity to 0.2-0.3.
- You can copy the demo project from this repository to use as a base or you can create your own project.
- With your own project you need to install MRTK3 and the Oculus Intergration package into it.
- Drag the MRTK XR Rig into your scene
- Open the rig and click on the Main Camera object
- Turn off HDR on the camera, and then you can close the rig
- Create and empty object and call it "Passthrough", on this object add the "OVR Manager" and "OVR Passthrough Layer" compontents
- In the OVR Manager, set Hand tracking support to 'Controller and hands' and set the frequency to 'MAX'.
- Then set the Passthrough support to 'Supported' and make sure 'Enable Passthrough' is checked.
- Open the OVR Passthrough Layer and set the Placement to Underlay
- And to make sure the passthrough works you need to add the 'Enable Unpremultiplied Alpha' component to the object
If you want to know what the script does, you can open it and it explains why the script is important
When you want to test something in play mode inside the editor, you need to change this setting EVERYTIME you open the project, else the editor will crash.
Go to your project settings, and under XR Plug-in Management open the OpenXR tab. You should see the option "Play Mode OpenXR Runtime"
Make sure to change this to "Windows Mixed Reality", this will fix the crash problem.
- Last thing you need to do if you want to use the application for a Hololens, the object needs to be disabled if running on a Hololens otherwise it will crash.
- Simply use a script that uses 'Preceding Conditional Compilation' to disable the object when running on 'UNITY_WSA' (this is the platform the Hololens runs on) and then it will get disabled on the Hololens and you can use all the features as normal! I have a script that handles this in the repository so you could use that.
- You can find the script in the Assets folder, the script is called "DisableForHololens".
Yerio Janssen
I got the idea to figure this out from "Joost van Schaik"