Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Sixer's avatar
Sixer
Member
1 year ago

Quest 3 passthrough Masking Question

I've been trying to figure out how to replace the passthrough video ceiling with a VR scene like in the First Encounters demo or the Discover app on Github. I've tried working with the layers and copying the shaders from the Discover app, but haven't made any progress. Does anyone by chance know how to mask the passthrough video to reveal the VR scene underneath? I would be super grateful for any advice. Thanks!

2 Replies

Replies have been turned off for this discussion
  • If I'm understanding the question correctly, try messing with the textureOpacity on the OVR Passthrough Layer script.  Set it to 0 or set it to 1 depending on what you want to see.

  • Thanks so much for the response. I will continue trying to see if I can get it to work in the Passthrough layer script as well. Attached is a picture of what I am trying to achieve. In the Discovery demo app on GitHub I was able to achieve what is in the picture by using this code. 

        void InitializeRoom()
        {
            OVRSceneAnchor[] sceneAnchors = FindObjectsOfType<OVRSceneAnchor>();
            OVRSceneAnchor floorAnchor = null;
            if (sceneAnchors != null)
            {
                for (int i = 0; i < sceneAnchors.Length; i++)
                {
                    OVRSceneAnchor instance = sceneAnchors[i];
                    OVRSemanticClassification classification = instance.GetComponent<OVRSemanticClassification>();
     
                    if (//classification.Contains(OVRSceneManager.Classification.WallFace) 
                        //||
                        classification.Contains(OVRSceneManager.Classification.Ceiling) 
                        //||
                        //classification.Contains(OVRSceneManager.Classification.DoorFrame) ||
                        //classification.Contains(OVRSceneManager.Classification.WindowFrame)
                        )
                    {
                        Destroy(instance.gameObject);
     
    But when I try this same code in a blank project with only the Building Block Camera Rig, Passthrough, and Room Model. it hasnt worked. Been trying different things for a few days tryin g to figure out why this works in the Discovery demo app but not a new project. Anyone by chance run into this same kind of thing and found a solution?
    Here's the modified code that I wrote for the new blank project. No compiler errors, seemed fine, but didn't destroy the ceiling plane:
     
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    [RequireComponent(typeof(OVRSceneManager))]
     
    public class Ceiling : MonoBehaviour
    {
        public OVRSceneManager sceneManager;
        public OVRSceneModelLoader sceneModelLoader;
        
     
        // Start is called before the first frame update
        void Start()
        {
            sceneManager = GetComponent<OVRSceneManager>();
            RemoveCeiling();
        }
     
        public void RemoveCeiling()
        {
           
            if (sceneManager.LoadSceneModel())
            {
                OVRSceneAnchor[] sceneAnchors = FindObjectsOfType<OVRSceneAnchor>();
                if (sceneAnchors != null)
                {
                    for (int i = 0; i < sceneAnchors.Length; i++)
                    {
                        OVRSceneAnchor instance = sceneAnchors[i];
                        OVRSemanticClassification classification = instance.GetComponent<OVRSemanticClassification>();
     
                        if (
                            classification.Contains(OVRSceneManager.Classification.Ceiling)
     
                            )
                        {
                            Destroy(instance.gameObject);
                        }
     
                    }
                }
            }
            
        }
        
    }