Passthrough transparency with MRTK2 and 3 on Quest 2/Pro
Recently I had an informal talk with a fellow Mixed Reality developer who was convinced it was not possible to use Quest passtrough transparency with MRTK. However, that is perfectly possible - as you can see below, on my Quest 2
I was a bit surpised, I thought this was common knowlegde after Davide Zordan tweeted about it in October 2022 and although that was not the complete story, there was very little missing. However, I decided to write a little blog post about it, if only because that’s easier for myself to find back than someone else’s tweet from 5 months ago.
Set up an MRTK project
First, set up an MRTK project normally. I used MRTK3, but 2 would work just as fine. I added a little floating cube (kept in view by an MRTK RadialView and a Solver) to it to have something to look at. Check if it works on the Quest. Make sure the camera background is solid black (so no skybox)
Import Oculus integration package
Import Oculus integration package from the asset store by clicking “Open in Unity”:
That will open the package managager
Click Import. You probably don’t need to import everything, but I have not taken the trouble yet to find out the minimal import.
After the import, it asks you a couple of questions:
- Update the OVR plugin? Choose upgrade
- Choose OpenXR? Yep
- Upgrade the spatializer? Indeed
- Restart the editor? Yes
- After the restart, it will ask you to enable OculusXR Feature. Choose upgrade
Add passtrough to your scene
I usually make an empty gameobject named “Oculus PassThrough” and add these scripts to it:
- OVR Manager
- OVR Passthrough Layer
In the OVR manager, you will need to scroll all the way to the bottom and make these two settings:
And on the OVR PassTrough Layer, set the Opacity to 0.3
Make sure the Placement is Overlay, otherwise it won’t work. Now this may look odd, because you would like to have reality as background, so you would be inclined to set it to Underlay (as I did initially). Funny thing is, then you will simply get a black background. It probably conflicts with the way the MRTK camera works. However, by using a partly transparent overlay on top, you will get a very HoloLens-like effect: the reality isa bit darker than with passthrough on the Quest home itself, and the virtual objects are just that little bit transparent - but that enables you to navigate through reality with confidence while still being able to the virtual objects. The key difference is reality looks really cr*p compared to HoloLens - grainy and in black and white - but for situations where this is not important, this solution might just be ‘good enough’. Choose the transparency value that suits your use case. I found 0.3 to be pretty good for most cases.
The amusing thing is: even after adding all the Oculus stuff, the app still works on HoloLens. I usually make a script that disables the “Oculus PassThrough” gameobject when the app is on a HoloLens, to make sure it does not interfere or uses resources unnecessarily.
A little sample project can be found here. The branch baseversion will shows you the base project without the Quest integration package and configuration.