Search Unity

Works on windows, not on android?

Discussion in 'Shaders' started by Gibbonuk, Jun 8, 2016.

  1. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    Hi, im using the following shader to "catch" shadows but not show any data of its self. So its invisible, but still receives shadows. This works great on windows, and also in the editor when using android platform.

    However, when i build it and run it on my android the shadows do not show. I'm not sure if its the shadows, limitations or something completely different but just wondered if anyone would know why?

    Code (CSharp):
    1. Shader "Custom/shadowthing" {
    2. Properties {
    3.     _Color ("Shadow Color", Color) = (1,1,1,1)
    4.     _ShadowInt ("Shadow Intensity", Range(0,1)) = 1.0
    5.     _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    6. }
    7. SubShader {
    8.     Tags {
    9.         "Queue"="AlphaTest"
    10.         "IgnoreProjector"="True"
    11.         "RenderType"="TransparentCutout"
    12.     }
    13.     LOD 200
    14.     ZWrite off
    15.     Blend zero SrcColor
    16. CGPROGRAM
    17. #pragma surface surf ShadowOnly alphatest:_Cutoff
    18. fixed4 _Color;
    19. float _ShadowInt;
    20. struct Input {
    21.     float2 uv_MainTex;
    22. };
    23. inline fixed4 LightingShadowOnly (SurfaceOutput s, fixed3 lightDir, fixed atten)
    24. {
    25.     fixed4 c;
    26.     c.rgb = lerp(s.Albedo, float3(1.0,1.0,1.0), atten);
    27.     c.a = 1.0-atten;
    28.     return c;
    29. }
    30. void surf (Input IN, inout SurfaceOutput o) {
    31.     o.Albedo = lerp(float3(1.0,1.0,1.0), _Color.rgb, _ShadowInt);
    32.     o.Alpha = 1.0;
    33. }
    34. ENDCG
    35. }
    36. Fallback "Transparent/Cutout/VertexLit"
    37. }
    Thanks