How to Disable Depth Occlusion in Needle Engine (Unity + Quick Look on iOS)?

I’m working on an AR project using Unity and Needle Engine, and I want my AR object to always be visible, even if real-world objects (e.g., doors) are in front of it. Currently, when I place my AR object in space and a real object is positioned in front of it, the AR object gets occluded.

I’m using Quick Look on iOS, which seems to apply automatic depth occlusion. However, I want my AR object to always render on top and never be hidden by real-world objects.

What I’ve Tried:

  1. Disabling Depth Occlusion in Unity – I checked if there are any occlusion settings in Needle Engine but couldn’t find an explicit option to disable it.
  2. I tried this part of code but is still the same.
import { Behaviour } from "@needle-tools/engine";
import { WebXR } from "@needle-tools/engine/components";

export class DisableDepthSensing extends Behaviour {

    configureWebXR() {
        const webXRComponent = this.gameObject.getComponent(WebXR);
        if (webXRComponent) {
            webXRComponent.useDepthSensing = false; // Disable depth sensing
            console.log("Depth sensing disabled for WebXR sessions.");
        }
    }

    start() {
        this.configureWebXR();
    }
}

My Question:

• How can I disable depth occlusion in Needle Engine so that my AR object is always visible, even if real-world objects are in front of it?

• Is there a setting in Needle Engine, Unity, or Quick Look that allows me to force my AR object to render on top of everything?

Any help or suggestions would be greatly appreciated! :rocket:

Hi Nemanja,

To get your AR object to always render on top of other real-world objects in your AR project using Needle Engine, you can follow these steps:

  1. Disable Depth Sensing in WebXR:
    The code you’ve shared disables depth sensing, which is a good first step. Ensure that your WebXR component is configured correctly, and make sure you’re using the latest version of Needle Engine.

  2. Adjust Rendering Settings:
    In addition to disabling depth sensing, you can use layers to handle rendering order. Ensure your AR object is rendered in a layer that takes priority in rendering order. Here’s how you can do it with Needle Engine:

import { Behaviour } from "@needle-tools/engine";
import { WebXR } from "@needle-tools/engine/components";

export class DisableDepthSensing extends Behaviour {

    configureWebXR() {
        const webXRComponent = this.gameObject.getComponent(WebXR);
        if (webXRComponent) {
            webXRComponent.useDepthSensing = false;
            console.log("Depth sensing disabled for WebXR sessions.");
        }
    }

    forceRenderOnTop() {
        this.gameObject.layer = 1; // Set layer to a higher priority
        console.log("Rendering layer adjusted to ensure visibility.");
    }

    start() {
        this.configureWebXR();
        this.forceRenderOnTop();
    }
}
  1. Check Quick Look Settings:
    Quick Look may also default to certain settings for rendering. Ensure there are no global settings in your AR environment that enforce occlusion.

  2. Layer Priority in Unity:
    If you’re configuring your scene directly through Unity, make sure to set the layer through the Inspector on your GameObject and that your camera is set to render that layer.

If after trying these suggestions the problem persists, please provide more details regarding your setup (Needle Engine version, Unity version, etc.) for additional support.

You can check further settings and options in the Needle Engine documentation for AR components and camera configurations.

Feel free to ask if you need more specific examples or explanations! :rocket:

1 replies left - Get a PRO license for more AI replies.
thread_p8649guj7om9sEik11Vcn7fj
Reply to this message to continue the conversation

Hi there! Unfortunately Apple does not allow control over depth occlusion in QuickLook, since they seem to favor realism over creative freedom.

We hope that some of the changes that Apple has landed in iOS 18 and later will allow us to give you a bit more creative control there, but so far that’s not the case. The code changes you made apply to WebXR, which is used for Android, Quest, etc. – where WebXR is available – but on iOS we’re converting to the format that QuickLook requires (USDZ) which restricts what we can do.

Okay, thank you for the fast reply. Wish you all the best! :blush:

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.