Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.25f1

2022.2.19f1

2023.1.0b16

2023.2.0a14

2023.3.0a3

6000.0.0b11

6000.1.0a7

6000.2.0a1

6000.3.0a1

7000.0.0a1

Issue ID

UUM-35206

Regression

Yes

RBR/CommonOpaque shader gradient is rendered incorrectly when the iOS build platform is selected

-

Reproduction steps:
1. Open the attached "repro_IN-39543.zip" project
2. Open the “Test“ Scene
3. Change the platform to “iOS”
4. Open the Game view
5. Observe the shader on the "Capsule" and "Capsule (1)" GameObjects

Expected result: The shader gradient is visible
Actual result: The shader gradient is not visible

Reproduced with: 2021.2.0b13, 2021.3.25f1, 2022.2.19f1, 2023.1.0b16, 2023.2.0a14
Not reproduced with: 2020.3.48f1, 2021.2.0b12

Reproduced on: Windows 10
Not reproduced on: macOS

Note: Reproduced on NVIDIA Geforce GTX 1650 Ti GPU

  1. Resolution Note:

    We acknowledge the problem with the HLSL built-in function lerp(), when using half precision floating point. The instructions emitted by the shader compiler on DX11 translate lerp(a, b, t) into a + (b - a) * t. This can lead into catastrophic loss of precision, when the values of variables a and b are close together, when using half precision.

    We have no control over the instruction emitted by the shader compiler on DX11, unless we redefine the built-in function lerp() ourselves, but many customer projects already rely on the current behavior of that function, so by redefining the function, we risk breaking many existing projects.

    As a workaround, if a more accurate lerp() function with half precision is absolutely needed, it can be defined manually as a * ((half)1.0 - t) + b * t, which retains more precision in some cases.

    That being said, the original bug report is a case, where the build target is set to iOS, and we try to render the Game view as seen on the target platform. We emulate iOS rendering on DX11, which in this case happens to be inaccurate, because of the differences in compiler/driver lerp() implementations between iOS and DX11. The visual artifacts in the editor can be eliminated by replacing the lerp() implementation with the manual code as explained above. However, it may not be beneficial to leave that code for the final product, because it may slow down the player on the target platform. Also the visual artifacts may not be visible on the target platform, because it's shader compiler is different.

    We are sorry for any troubles caused by the issue.

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.