Search Issue Tracker

Fixed in 2021.1.X

Votes

0

Found in

2018.4

2018.4.11f1

2020.2

Issue ID

1271588

Regression

No

[iOS] Transparent objects are not rendered when ZTest LEqual is set and custom PP effect uses BeforeTransparent attribute

Metal

-

Fix:
Changeset https://github.com/Unity-Technologies/PostProcessing/commit/192fb9b6747495b971c040d4abdf127159b94cb6 adds an optional "preserveDepth" argument to CommandBuffer.BlitFullscreenTriangle. Setting preserveDepth to true for mid-frame post processing passes will fix the issue.

Currently, this functionality is not yet part of a release of the Post Processing package, but is only available on GitHub.

How to reproduce:
1. Open the attached 'PPv2 Reproduction.zip' project
2. Open 'SampleScene' Scene
3. Observe that 'Transparent Z-Test LEqual' GameObject is visible in the Scene and Game Views
4. Switch Platform to iOS
5. Build for iOS and open the Xcode project
6. Deploy Xcode's project to an iOS device

Expected result: 'Transparent Z-Test LEqual' GameObject is visible
Actual result: 'Transparent Z-Test LEqual' GameObject is invisible

Reproducible with: 2018.4.27f1, 2019.4.11f1, 2020.1.6f1, 2020.2.0b3

Reproducible with:
iPhone 8+ (iOS 12.0)
iPhone XR (iOS 13.4.1)
iPad Air 2 (iOS 11.0.3)
iPad 9.7 6th gen (iOS 14.0b7)

Not reproducible with:
Mac Standalone
Windows Standalone (DX11, DX12)
VLNQA00220, Samsung Galaxy Note9 (SM-N960F), Android 8.1.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72
VLNQA00123, Google Pixel 2 XL (Pixel 2 XL), Android R, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00313, Huawei Y6 \xe2\x85\xa1 Compact (HUAWEI LYO-L01), Android 5.1, CPU: MediaTek MT6735, GPU: Mali-T720
----------, Samsung Galaxy S20+ 5G (SM-G986B), Android 10, CPU: NOT FOUND, GPU: Mali-G77

Notes:
- Not reproducible when ZTest is set to always with transparent materials, not reproducible with ZTest LEqual and opaque materials
- Not reproducible on Android Vulkan and Open GLES 3, not reproducible on Windows (DX11, DX12)

Details:
The reason this happens is because CommandBuffer.BlitFullscreenTriangle (defined in RuntimeUtilities) may corrupt the depth buffer on iOS Metal. So calling this method after rendering opaques, but before transparents, as is done in the repro project, may result in incorrect data in the depth buffer while rendering transparents. This is addressed in PR #893 of the Post Processing package, which adds an optional "preserveDepth" argument to BlitFullscreenTriangle. Setting this to true prevents the depth buffer from being corrupted, and is advised when using the method mid-frame. As of now, the PR in question has not been released yet in an update to the Post Processing Package, and is only available on GitHub.

This issue may be reproducible on Vulkan.

  1. Resolution Note (fix version 2021.1):

    Changeset https://github.com/Unity-Technologies/PostProcessing/commit/192fb9b6747495b971c040d4abdf127159b94cb6 adds an optional "preserveDepth" argument to CommandBuffer.BlitFullscreenTriangle. Setting preserveDepth to true for mid-frame post processing passes will fix the issue.

    Currently, this functionality is not yet part of a release of the Post Processing package, but is only available on GitHub.

    Fixed in 2021.2.0a19

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.