unity custom shader not receiving Shadow

1.4k views Asked by At
Shader "Custom/1_displayImageOnSlide" {
    Properties {
        _MainTex ("Texture", 2D) = "white" {}
        _CutoffX("CutoffX", Range(0.0,1.0)) = 1
        _CutoffY("CutoffY", Range(0.0,1.0)) = 1
    }

    Category {
        Cull off
        Blend SrcAlpha OneMinusSrcAlpha
        Lighting Off
    Fog { Mode Off }

        SubShader {    
//      Tags {"LighMode"="ForwardBase"}
        Tags {"Queue"="Transparent" "RenderType"="Transparent"}
        //UsePass "VertexLit/SHADOWCOLLECTOR"    
        //UsePass "VertexLit/SHADOWCASTER"

        CGPROGRAM
        #pragma surface surf Unlit 
        //#pragma surface surf Lambert

        // Inside CGPROGRAM block.


        half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
                half4 c;
                c.rgb = s.Albedo;
                c.a = s.Alpha;
                return c;
        }

        sampler2D _MainTex;

        struct Input {
                float2 uv_MainTex;
                float4 color : Color;
        };

        fixed _CutoffX;
        fixed _CutoffY;

        void surf (Input IN, inout SurfaceOutput o) {

        half4 tex = tex2D(_MainTex, IN.uv_MainTex);

        o.Albedo = IN.color.rgb * tex.rgb;
        o.Alpha = IN.uv_MainTex.x > _CutoffX ? 0 : IN.uv_MainTex.y > _CutoffY ? 0 : IN.color.a*tex.a;
        }
    ENDCG      
        }//sub Shader End
    }//Categoy End
     FallBack "VertexLit"    // Use VertexLit's shadow caster/receiver passes.
}

This is the code of my shader file and it is applied to a cube object. The problem is, shader is casting correctly by cube but cube is not receiving shader. Whats wrong in it? I don't have enough knowledge about shader programming so it is requested to share you answer with description

0

There are 0 answers