Search Unity

Bug Depth texture enabled in URP with ARKit scene creates black background

Discussion in 'AR' started by anamate23, Feb 24, 2021.

  1. anamate23

    anamate23

    Joined:
    Feb 5, 2015
    Posts:
    6
    I'm trying to get volumetric lights working by Kronnect, but the lights require me to have Depth texture enabled in the URP Asset settings, this unfortunately creates a black background when trying to detect a plane on my iPad Pro. I already have the seen set up with the ARbackground in the Forward Render... so not sure what is going on. When disabling the depth texture the camera feed works fine. I have tried it in 2020.2.2 and the most recent Beta release of unity 2021.1.0b7 but still problematic with the volumetric lights.
    If anyone knows why this might be happening or how to fix it , I'd appreciate it.
     
  2. anamate23

    anamate23

    Joined:
    Feb 5, 2015
    Posts:
    6
    some more info, when running debug while the iPad is running I get the following error, the depth texture is not enabled but I stilll get a black screen now:
    Camera "AR Camera" has a non-identity transform (position = (1.8, 1.0, 0.5), rotation = (0.1, -0.7, 0.1, 0.6)). The camera's local position and rotation will be overwritten by the XR device.

    UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)

    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])

    UnityEngine.Logger:Log(LogType, Object)

    UnityEngine.Debug:LogWarning(Object)

    UnityEngine.XR.ARFoundation.ARSessionOrigin:Awake()


    2021-02-24 17:31:44.985162+0000 Scale[1399:590290] UnityARKit: Updating ARSession configuration with <ARWorldTrackingConfiguration: 0x28115eaa0 worldAlignment=Gravity lightEstimation=Disabled frameSemantics=None videoFormat=<ARVideoFormat: 0x2806e2440 imageResolution=(1920, 1440) framesPerSecond=(60)> autoFocus=Enabled environmentTexturing=None wantsHDREnvironmentTextures=Enabled planeDetection=None collaboration=Disabled userFaceTracking=Disabled sceneReconstruction=None appClipCodeTracking=Disabled>

    2021-02-24 17:31:45.781331+0000 Scale[1399:590511] Compiler failed to build request

    2021-02-24 17:31:45.782240+0000 Scale[1399:590511] Compiler failed to build request

    Metal: Error creating pipeline state (Unlit/ARKitBackground): depthAttachmentPixelFormat is not valid and shader writes to depth

    (null)-> applicationWillResignActive()

    -> applicationDidEnterBackground()
     
  3. anamate23

    anamate23

    Joined:
    Feb 5, 2015
    Posts:
    6
    ah it turns out that it was not a problem with Kronnect, if you have Depth of Field enabled with the post processing on the URP side with the AR Sessions Camera then you get black screen, bit annoying that i can't have some depth of field, but it is ok for now without
     
  4. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,821
    Team took a look, and wanted me to pass along this:

    This error message is the critical issue.

    Metal: Error creating pipeline state (Unlit/ARKitBackground): depthAttachmentPixelFormat is not valid and shader writes to depth

    When the developer is rendering to a RenderTexture using the ARKitBackground shader, the RenderTexture must have a valid depth buffer.

    https://docs.unity3d.com/ScriptReference/RenderTexture-depth.html
     
    dylan-hart likes this.
  5. all_developers

    all_developers

    Joined:
    Aug 24, 2021
    Posts:
    1
    For anyone still having issues with this, the black background may be caused by an older version of AR Foundation (my project had version 4.1.1 installed when the bug appeared).

    Updating AR Foundation to version 4.2.0 fixed it for me :)