Search Unity

Shader not working on Windows Phone 8.1

Discussion in 'Shaders' started by pat68, Apr 27, 2017.

  1. pat68

    pat68

    Joined:
    Dec 15, 2013
    Posts:
    34
    I want to use the following shader to generate shadows for 2d sprites:

    https://github.com/anlev/Unity-2D-Sprite-cast-and-receive-shadows

    In the editor it works fine and looks like this:


    If I deploy to the device, no shadow is shown instead shader warnings (see below 'Custom/SpriteShadow' warnings):

    Code (CSharp):
    1. Module information:
    2. Built with Compiler Ver '180040629'
    3. Built from '5.5/release' branch
    4. Version is '5.5.2f1 (3829d7f588f3)'
    5. Debug build
    6. Application type 'XAML'
    7. Used 'PhoneSDK 8.1'
    8.  
    9. '2DShadowTest.exe' (CoreCLR: .): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
    10. Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
    11. OS 'Windows Phone 8.1 (6.3.9651)'
    12.  
    13. PlayerConnection initialized from C:/Data/SharedData/PhoneTools/AppxLayouts/ae91cb92-6289-4b5b-bbdf-bf14658943bcVS.Debug_ARM.Patrick/Data (debug = 0)
    14.  
    15. Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
    16. PlayerConnection initialized network socket : 0.0.0.0 55491
    17.  
    18. Multi-casting "[IP] 192.168.178.20 [Port] 55491 [Flags] 2 [Guid] 4270911577 [EditorId] 1404364021 [Version] 1048832 [Id] MetroPlayerARM(Windows-Phone) [Debug] 0" to [225.0.0.222:54997]...
    19.  
    20. Started listening to [0.0.0.0:55491]
    21.  
    22. GfxDevice: creating device client; threaded=1
    23.  
    24. Direct3D:
    25.  
    26.     Version:  Direct3D 11.0 [level 9.3]
    27.  
    28.     Renderer: Qualcomm Adreno 225 (WDDM v1.2) (ID=0x32303032)
    29.  
    30.     Vendor:   Qualcomm
    31.  
    32.     VRAM:     449 MB
    33.  
    34. Initialize engine version: 5.5.2f1 (3829d7f588f3)
    35.  
    36. '2DShadowTest.exe' (CoreCLR: .): Loaded 'C:\data\ProgramData\Microsoft\Windows\AppRepository\Packages\ae91cb92-6289-4b5b-bbdf-bf14658943bc_1.0.0.0_arm__pzq3xp76mxafg\NI\UnityEngineProxy.ni.DLL'. Cannot find or open the PDB file.
    37. '2DShadowTest.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.RUNTIME.INTEROPSERVICES.NI.DLL'. Symbols loaded.
    38. WARNING: Shader
    39. Unsupported: 'Hidden/Internal-DeferredShading' - Pass '' has no vertex shader
    40.  
    41. WARNING: Shader
    42. Unsupported: 'Hidden/Internal-DeferredShading' - Setting to default shader.
    43.  
    44. WARNING: Shader
    45. Unsupported: 'Hidden/Internal-DeferredReflections' - Pass '' has no vertex shader
    46.  
    47. WARNING: Shader
    48. Unsupported: 'Hidden/Internal-DeferredReflections' - Setting to default shader.
    49.  
    50. WARNING: Shader
    51. Unsupported: 'Hidden/Internal-ScreenSpaceShadows' - Pass '' has no vertex shader
    52.  
    53. WARNING: Shader
    54. Unsupported: 'Hidden/Internal-ScreenSpaceShadows' - Pass '' has no vertex shader
    55.  
    56. WARNING: Shader
    57. Unsupported: 'Hidden/Internal-PrePassLighting' - Pass '' has no vertex shader
    58.  
    59. WARNING: Shader
    60. Unsupported: 'Hidden/Internal-PrePassLighting' - Setting to default shader.
    61.  
    62. WARNING: Shader
    63. Unsupported: 'Legacy Shaders/VertexLit' - Pass 'SHADOWCASTER' has no vertex shader
    64.  
    65. WARNING: Shader
    66. Unsupported: 'Hidden/CubeBlur' - Pass '' has no vertex shader
    67.  
    68. WARNING: Shader
    69. Unsupported: 'Hidden/CubeCopy' - Pass '' has no vertex shader
    70.  
    71. WARNING: Shader
    72. Unsupported: 'Hidden/CubeBlend' - Pass '' has no vertex shader
    73.  
    74. Logical Screen DPI is 172.80.
    75.  
    76. Begin showing splash screen.
    77.  
    78. The following GlobalManagers were stripped from the build (Either because they're not used or not supported on this platform):
    79.  NetworkManager
    80.  MasterServerInterface
    81.  UnityAdsManager
    82.  ClusterInputManager
    83.  UnityAnalyticsManager
    84.  CrashReportManager
    85.  
    86. WARNING: Shader
    87. Unsupported: 'Custom/SpriteShadow' - Pass 'FORWARD' has no vertex shader
    88.  
    89. WARNING: Shader
    90. Unsupported: 'Custom/SpriteShadow' - Pass 'FORWARD' has no vertex shader
    91.  
    92. WARNING: Shader
    93. Unsupported: 'Custom/SpriteShadow' - Pass 'PREPASS' has no vertex shader
    94.  
    95. WARNING: Shader
    96. Unsupported: 'Custom/SpriteShadow' - Pass 'PREPASS' has no vertex shader
    97.  
    98. WARNING: Shader
    99. Unsupported: 'Custom/SpriteShadow' - Pass 'SHADOWCASTER' has no vertex shader
    100.  
    101. WARNING: Shader
    102. Unsupported: 'Custom/SpriteShadow' - Pass 'META' has no vertex shader
    103.  
    104. WARNING: Shader
    105. Unsupported: 'Custom/SpriteShadow' - All passes removed
    106.  
    107. UnloadTime: 56.026814 ms
    108.  
    109. End showing splash screen.
    110.  
    111. The thread 0xe6c has exited with code 0 (0x0).
    112. The program '[2976] 2DShadowTest.exe' has exited with code -1 (0xffffffff).
    The sourcecode from the shader:
    Code (CSharp):
    1. Shader "Custom/SpriteShadow" {
    2.     Properties {
    3.         _Color ("Color", Color) = (1,1,1,1)
    4.         [PerRendererData]_MainTex ("Sprite Texture", 2D) = "white" {}
    5.         _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.5
    6.     }
    7.     SubShader {
    8.         Tags
    9.         {
    10.             "Queue"="Geometry"
    11.             "RenderType"="TransparentCutout"
    12.         }
    13.         LOD 200
    14.  
    15.         Cull Off
    16.  
    17.         CGPROGRAM
    18.         // Lambert lighting model, and enable shadows on all light types
    19.         #pragma surface surf Lambert addshadow fullforwardshadows
    20.  
    21.         // Use shader model 3.0 target, to get nicer looking lighting
    22.         #pragma target 3.0
    23.  
    24.         sampler2D _MainTex;
    25.         fixed4 _Color;
    26.         fixed _Cutoff;
    27.  
    28.         struct Input
    29.         {
    30.             float2 uv_MainTex;
    31.         };
    32.  
    33.         void surf (Input IN, inout SurfaceOutput o) {
    34.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    35.             o.Albedo = c.rgb;
    36.             o.Alpha = c.a;
    37.             clip(o.Alpha - _Cutoff);
    38.         }
    39.         ENDCG
    40.     }
    41.     FallBack "Diffuse"
    42. }
    What can I do to get this work on the phone?

    Greetings
    Pat
     
    Last edited: Apr 28, 2017
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
  3. pat68

    pat68

    Joined:
    Dec 15, 2013
    Posts:
    34
    Good idea.
    @forum admins: could you pleas move this post? Thx.