Search Issue Tracker

By Design

By Design in 6000.2.X

Votes

0

Found in

2022.3.63f1

6000.0.51f1

6000.1.7f1

6000.2.0b5

Issue ID

UUM-109135

Regression

No

Depth Texture is inverted in Android build when Graphics API is set to OpenGLES3

GLES

-

Reproduction steps:
1. Open the attached “DepthShadows” project
2. Open the “Assets/Scenes/SampleScene” Scene
3. Enter Play Mode
4. In the Game View, observe the shadows below the GameObjects
5. Build and run the project on an Android device
6. On the device, observe the shadows below the GameObjects

Expected result: The shadows look the same in steps 4 and 6
Actual result: The shadows are inverted in step 6

Reproducible with: 2022.3.63f1, 6000.0.51f1, 6000.1.7f1, 6000.2.0b5

Testing environment: macOS Sequoia 15.5 (M1 Max)

Reproducible with these devices:
VLNQA00123, Google Pixel 2 XL, OS:  11, CPU: Snapdragon 835 MSM8998, GPU: Adreno 540
VLNQA00363, Samsung Galaxy Z Fold 2, OS: 12, CPU: Snapdragon 865 SM8250, GPU: Adreno 650
VLNQA00639, Samsung Galaxy S25, OS: 15, CPU: Snapdragon 9 Elite, GPU: Adreno 830

Workaround: Switch to Vulkan in the Graphics API’s setting

Note: Not reproducible on iOS Metal API

  1. Resolution Note:

    Thank you for reporting this issue.

    After investigation, we’ve confirmed the behavior is in line with current design. In your setup, the Shader Graph uses a generic 'Sample Texture 2D' node to read from a depth `RenderTexture`. That node is intentionally API‑agnostic and does not treat the input as a special 'depth texture', so it does not automatically account for differences in depth conventions (e.g. reversed Z on some APIs versus non‑reversed Z on OpenGLES3). As a result, the sampled depth appears inverted on GLES compared to DirectX/Vulkan/Metal. See the following for more information: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html

    To handle this case, the graph needs an explicit adjustment based on the platform’s depth convention, for example:

    - In the Shader Graph add a 'One Minus' after 'Sample Texture 2D' and feed it into a 'Branch' node.
    - In the script drive the branch via `SystemInfo.usesReversedZBuffer`, e.g.:

    ```
    bool inverted = !SystemInfo.usesReversedZBuffer;
    material.SetFloat("_usesReversedZBuffer", inverted ? 1.0f : 0.0f);
    ```

    Alternatively, using the 'Scene Depth' node or switching the Graphics API to Vulkan also avoids this discrepancy.

    We will close this case as "As Designed." Thank you again for the report, and please let us know if you have further feedback on how this workflow could better meet your needs.

  2. Resolution Note (6000.2.X):

    Thank you for reporting this issue.

    After investigation, we’ve confirmed the behavior is in line with current design. In your setup, the Shader Graph uses a generic 'Sample Texture 2D' node to read from a depth `RenderTexture`. That node is intentionally API‑agnostic and does not treat the input as a special 'depth texture', so it does not automatically account for differences in depth conventions (e.g. reversed Z on some APIs versus non‑reversed Z on OpenGLES3). As a result, the sampled depth appears inverted on GLES compared to DirectX/Vulkan/Metal. See the following for more information: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html

    To handle this case, the graph needs an explicit adjustment based on the platform’s depth convention, for example:

    - In the Shader Graph add a 'One Minus' after 'Sample Texture 2D' and feed it into a 'Branch' node.
    - In the script drive the branch via `SystemInfo.usesReversedZBuffer`, e.g.:

    ```
    bool inverted = !SystemInfo.usesReversedZBuffer;
    material.SetFloat("_usesReversedZBuffer", inverted ? 1.0f : 0.0f);
    ```

    Alternatively, using the 'Scene Depth' node or switching the Graphics API to Vulkan also avoids this discrepancy.

    We will close this case as "As Designed." Thank you again for the report, and please let us know if you have further feedback on how this workflow could better meet your needs.

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.