Search Unity

Alpha mask help

Discussion in 'Shaders' started by jarden, Jun 15, 2017.

  1. jarden

    jarden

    Joined:
    Mar 29, 2011
    Posts:
    74
    Hi, I have this shader that I want to add an alpha mask to:

    Code (CSharp):
    1.  
    2. Shader "Kybernetik/Simple Sun"
    3. {
    4.     Properties
    5.     {
    6.         _Color("Color", Color) = (1,1,1,1)
    7.         _BallRadius("Ball Radius", Range(0, 0.5)) = 0.45
    8.         _BallSharpness("Ball Sharpness", float) = 6
    9.         _RaySpeed("Ray Speed", float) = 3
    10.         _RayFrequency("Ray Frequency", float) = 2// Whole numbers are recommended to avoid creating a seam.
    11.         _RayIntensity("Ray Intensity", float) = 100
    12.         _RayRoughness("Ray Roughness", Range(0, 1.5)) = 1
    13.         _Noise("Noise", 2D) = "white" {}
    14.         _Alpha("Alpha (A)", 2D) = "white" {}
    15.     }
    16.  
    17.     Category
    18.     {
    19.  
    20.         Tags
    21.         {
    22.             "Queue" = "Transparent"
    23.             "IgnoreProjector" = "True"
    24.             "RenderType" = "Transparent"
    25.             "PreviewType" = "Plane"
    26.         }
    27.  
    28.         LOD 200
    29.                
    30.         Blend SrcAlpha OneMinusSrcAlpha
    31.         Alphatest Greater 0
    32.         ZWrite Off
    33.  
    34.         SubShader
    35.         {
    36.             Pass
    37.             {
    38.  
    39.                 CGPROGRAM
    40.        
    41. ........
    42.  
    43.                 ENDCG
    44.                     SetTexture[_MainTex]{
    45.                     Combine texture
    46.                 }
    47.                     SetTexture[_Alpha]{
    48.                     Combine previous, texture
    49.                 }
    50.             }
    51.         }
    52.     }
    53.  
    54.     FallBack "Diffuse"
    55.  
    56. }
    57.  
    I read around and found this settexture method (line 44-49) but my shader has no _MainTex property. Is there a way I can still put a mask in?