Unity Oculus Integration Passthrough
Ashley Kwon (Spring 2023)
Passthrough is a layer in which users can see their surrounding in real-time while wearing their VR headset. In this tutorial, I talk about how to implement passthrough for Oculus in Unity. I referred to this YouTube video when making this tutorial: How to build your ARapp for Quest in Unity - Oculus Passthrough API tutorial [UPDATE IN DESCRIPTION] - YouTube
Make sure that developer mode is enabled in your headset. This tutorial shows you how to do so.
Make a new Unity project. Once Unity finishes the initial project setup, open Build Settings under the File tab and change the platform to Android
In the Build Settings window, click Player Settings at the bottom left corner. This should open another window. In the menu on the left-hand side, find XR Plug-in Management and install the package if it hasn't been installed yet.
Once you finish installing the package, under the tab with the Android icon, choose Oculus as your Plug-in provider as in the screenshot below.
5. In the menu on the left-hand side, click Player. Scroll down to find the "Configuration" section and make sure that Scripting Backend is set to "IL2CPP" as in the screenshot below.
6. Download the Oculus Integration package from Unity's Asset Store and import it into your project. You may be asked in pop-up windows if you want a newer version of certain prefabs, plug-ins ... etc. You can click "Yes" in all of them. Doing so may restart your Unity project.
7. When you finish importing the package, you should see the Oculus folder under the Assets folder. In your project tab at the bottom of the editor window, search for the OVRCameraRig prefab as in the screenshot below. Once you find the prefab, drag and drop it into your current scene. Then, delete the Main Camera that is in the scene by default.
8. Click the OVRCameraRig in your scene and visualize the inspector window on the right-hand side. You will find that the camera rig already has a script called "OVRManager" attached to it. Scroll down in the inspector window to find the "Quest Features" section and click the "General" tab. You should see at the bottom of the section a checkbox for "Passthrough Capability". As in the screenshot below, click this checkbox and the "Enable Passthrough" checkbox in the "Mixed Reality Capture" section.
9. Search for the OVRPassthroughLayer script in the Oculus folder as you did in 7. Drag and drop this to the OVRCameraRig prefab in your current scene to attach the script to the prefab. Once you attach the script and click the prefab, you should see OVRPassthroughLayer in the inspector window. If you want virtual contents to be rendered on top of the passthrough layer, choose "Underlay" for Placement in the "Compositing" tab as in the screenshot below.
10. You should be able to see the passthrough layer when you build and run your project in your Oculus headset!