Search Issue Tracker
By Design
Votes
0
Found in
2021.1
2021.1.24f1
2021.2
2022.1
Issue ID
1372504
Regression
Yes
[iOS] Shaders are invisible when using Transparent Queue
Reproduction steps:
1. Download and open the attached "UnityXRayShaderBug.zip" project
2. Build and deploy the project to iOS
3. Observe the spheres in the device
Expected result: There are two spheres behind the cube
Actual result: There is only one sphere
Reproducible with: 2021.1.0f1, 2021.1.26f1, 2021.2.0b16, 2022.1.0a13
Not reproducible with: 2019.4, 2020.3.21f1
Reproduced with: iPhone 12 Pro (iOS 14.2.1)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note:
The problem why custom shader didn't work correctly was because of missing proper Pass Tags to indicate that shader does lighting.
Since Pass Tags weren't defined in shader, the default is "Always" pass tag which doesn't apply any lighting.
Therefore the result of the lighting calculations was that objects were invisible as _WorldSpaceLightPos0 had value of (0.f, 0.f, 0.f, 0.f).
Adding Pass Tag "LightMode" = "ForwardBase" as denoted by https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html fixes the problem with zeroed _WorldSpaceLightPos0 constant value and shader works as expected.