Search Unity

Question Transparency Cutout custom shader fully transparent on Unity 2021 build for some iOS devices

Discussion in 'Shaders' started by Raysangar, Sep 5, 2022.

  1. Raysangar

    Raysangar

    Joined:
    Nov 13, 2015
    Posts:
    1
    Hello!
    I've recently upgraded a project from Unity 2018.4 to Unity 2021.3. This project uses some cutout shaders for the geometry that after the upgrade are not showing at all in some iOS devices (Android devices and editor look good.

    We've tested on an iPad Air 4, iPhone 13 Pro, iPhone XS and iPhone 11. iPhone XS and iPhone 11 are the ones with rendering issues while the other two devices work fine. Any idea why is this happening?

    Here's an axemple of one of our shaders:

    Code (CSharp):
    1. Shader "Custom/Transparent/Cutout/Diffuse"
    2. {
    3.     Properties
    4.     {
    5.         _Color ("Main Color", Color) = (1,1,1,1)
    6.         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    7.         _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    8.     }
    9.  
    10.     SubShader
    11.     {
    12.         Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout" "LightMode" = "ForwardBase"}
    13.         LOD 200
    14.    
    15.         CGPROGRAM
    16.         #pragma surface surf Lambert noforwardadd exclude_path:prepass approxview halfasview
    17.  
    18.         sampler2D _MainTex;
    19.         fixed4 _Color;
    20.         fixed _Cutoff;
    21.  
    22.         struct Input
    23.         {
    24.             float2 uv_MainTex;
    25.         };
    26.  
    27.         void surf (Input IN, inout SurfaceOutput o)
    28.         {
    29.             fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    30.             o.Albedo = c.rgb;
    31.             clip(_Color.a - _Cutoff);
    32.         }
    33.         ENDCG
    34.     }
    35.  
    36.     Fallback "Legacy Shaders/Transparent/Cutout/Diffuse"
    37. }
    IMG_6744-min.png
     
    hbtmHolo likes this.