Search Issue Tracker

By Design

Votes

0

Found in [Package]

2018.4

2019.4.1f1

2020.2

Issue ID

1258275

Regression

No

[iOS][URP] Objects lose reflections when using ARCameraBackground.material and blitting Camera image to a Render Texture

Package: ARFoundation

-

How to reproduce:
1. Open the attached 'AR-ON iOS.zip' project
2. Build for iOS and open the Xcode project
3. Deploy the Xcode project to an iOS device
4. Press the 'Reset' button that sphere and cube would be visible
5. Press 'On' button to enable reflections

Expected results: Sphere and Cube are mirror-reflective
Actual results: Sphere and Cube are black

Reproducible with: 2019.4.4f1(4.0.2, preview.3-4.1.0), 2020.1.0b17(4.0.2, preview.3-4.1.0), 2020.2.0a18(4.0.2, preview.3-4.1.0)
Couldn't test with: 2018.4.26f1(because ARFoundation errors are thrown to the Console)

Reproducible with:
- iPhone 8 Plus (iOS 12.0)
- iPhone XR (iOS 13.4.1)

Not reproducible with:
- iPad 9.7 6th gen (iOS 12.1)
VLNQA00294, Oppo Reno Z 中国版 (PCDM10), Android 9, CPU: Mediatek MT6779 Helio P90, GPU: PowerVR Rogue GM9446
VLNQA00001, Google Pixel 2 (Pixel 2), Android 11, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00128, Samsung Galaxy Note8 (SM-N950F), Android 9, CPU: Exynos 9 Octa 8895, GPU: Mali-G71

Notes:
- Screenshots of the issue are attached in Edit
- Reproducible using Open GL and Metal
- Depth buffer of the Render Texture is set to 0
- Reproducible without URP package

  1. Resolution Note:

    With the given Unity project, the behavior is operating as designed.

    The ARKit background shader is different from the ARCore background shader. The difference is that the ARKit background shader requires a depth buffer when writing to the render texture.

    The error in the sample project is clearly reported when running the project on an iOS device. In the Xcode log after enabling the mirroring functionality for the first time, there is an error message that describes the issue with the project:

    > 2020-11-18 19:41:14.697114-0800 AR-ONtest[799:177212] Compiler failed to build request
    > 2020-11-18 19:41:14.698548-0800 AR-ONtest[799:177212] Compiler failed to build request
    > Metal: Error creating pipeline state (Unlit/ARKitBackground): depthAttachmentPixelFormat is not valid and shader writes to depth

    The solution to fix the error in the sample project is two steps:

    1. With the Unity project open, in the Project window, select Assets > Materials > Environment. With the Environment selected, in the Inspector, switch the DepthBuffer setting to AtLeast16BitsDepth.

    2. in the Assets/Scripts/ARCameraImageToMaterial.cs file, comment out line 39:
    // m_MyRenderTexture.depth = 0;

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.