Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Alpha Masking shader does not work in iOS

Discussion in 'Shaders' started by Pushkin, Sep 11, 2014.

  1. Pushkin

    Pushkin

    Joined:
    Jul 6, 2012
    Posts:
    6
    Hi All!

    can someone tell me why this shader does not work on iOS devices. It uses a grayscale texture to clip another texture. It works in the Unity editor. On the device the texture is not clipped.


    Code (CSharp):
    1. Shader "MaskedTexture"
    2. {
    3.    Properties
    4.    {
    5.       _MainTex ("Base (RGB)", 2D) = "white" {}
    6.       _Mask ("Culling Mask", 2D) = "white" {}
    7.       _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
    8.    }
    9.    SubShader
    10.    {
    11.       Tags {"Queue"="Transparent"}
    12.       Lighting Off
    13.       ZWrite Off
    14.       Blend SrcAlpha OneMinusSrcAlpha
    15.       AlphaTest GEqual [_Cutoff]
    16.       Pass
    17.       {
    18.          SetTexture [_Mask] {combine texture}
    19.          SetTexture [_MainTex] {combine texture, previous}
    20.       }
    21.    }
    22. }

    BR,

    Andreas