PICO 4 Development: How To Enable See-Through Features In Unity

Over the last few weeks I have been experimenting with PICO 4 features which led me to talk a bit about how See-Through can be enabled for any experiences created by using Unity and a PICO 4, in addition PICO also states that you could enable See-Through features by using a PICO Neo3 but that information goes beyond this article where I like to solely focus on PICO 4 development with Unity.

Today I walk you through how you can create a camera script to enable PICO 4 See-Through features among other settings required to make this work. See-Through features is equivalent term to what Meta calls as “Passthrough” since their initial released of the “Oculus Quest “ then rebranded to “Meta Quest”.

💡 How do we go about enabling See-Through with a PICO 4 device?

Fig 1.0 Camera Background Color

Honestly this is super super easy and I was surprised that we didn’t need to set special android manifest permissions unlike the Meta Quest 2 which requires a bit more setup but it also provides additional options which I also covered on this video series with Meta Passthrough.

So with a PICO 4 headset all you need to do is follow the steps below:

  • First set the main camera clear flags to “Solid Color” and make sure the background camera color is set to 0 on all color properties including the alpha channel as shown on Fig 1.0.

  • Make a call to PXR_Boundary.EnableSeeThroughManual(true) and the boolean value of “true” determines if you like to enable See-Through features or not, also there is one caveat to this, if the application is suspended (goes to pause state) then the Boundary system automatically disables See-Through features which mean that you will need to bind to that event and re-enabled it once the game or app is resumed.

  • If you don’t have the PXR_* classes in your Unity project then it means you missed my previous video where I walk you through setting up Unity with PICO 4, be sure to watch this before trying to implement the steps in this article.

I’ve also created a new script which I called "EnableSeeThrough” and available on this GitHub repository or you could simply implement it by copying the code below and pasting it to a new “MonoBehaviour” then attach it to your Camera. The "EnableSeeThrough” script has two options, first is the mainCamera which is optional if the component contains the camera itself and second a float enableSeeThroughAfter which allows you to enable See-Through after x amount of time.

PICO 4 Enable See-Through source code is available below:

using System.Collections;
using Unity.XR.PXR;
using UnityEngine;

public class EnableSeeThrough : MonoBehaviour
{
    [SerializeField]
    private Camera mainCamera;

    [SerializeField]
    private float enableSeeThroughAfter = 0.1f;

    private void Awake()
    {
        if (mainCamera == null) mainCamera = GetComponent<Camera>();

        if (mainCamera)
        {
            Debug.Log(nameof(ToggleSeeThrough));
            StartCoroutine(ToggleSeeThrough(true));
            mainCamera.backgroundColor = new Color(0, 0, 0, 0);
            mainCamera.clearFlags = CameraClearFlags.SolidColor;
        }
        else
        {
            Debug.LogError("A camera must be referenced or be part of this game object");
        }

    }

    private IEnumerator ToggleSeeThrough(bool enable)
    {
        yield return new WaitForSeconds(enableSeeThroughAfter);

        PXR_Boundary.EnableSeeThroughManual(enable);
        Debug.Log($"See through is set to ({enabled})");
    }

    private void OnApplicationPause(bool pause)
    {
        if (!pause)
        {
            PXR_Boundary.EnableSeeThroughManual(true);
        }
    }
}

Well that wasn’t too bad was it ? Let me know if you’ve any questions as it relates to PICO 4 with Unity or XR development in general.

Thank you !

Previous
Previous

Unity XR Hands Setup: Platform Agnostic Hand Tracking Features Are Here !

Next
Next

PICO 4 Development: Unity Setup Guide !