Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL - WARNING: Shader Unsupported: '' - Pass has no vertex shader

Discussion in 'Shaders' started by ARLG, Oct 10, 2016.

  1. ARLG

    ARLG

    Joined:
    Mar 5, 2015
    Posts:
    11
  2. ARLG

    ARLG

    Joined:
    Mar 5, 2015
    Posts:
    11
    I tried on every platform (editor, android, standalone, WebPlayer & WebGL with Unity 5.3.6 & 5.4.1.
    This shader don't work on WebGL but work on the other.

    CGPROGRAM don't work in WebGL ?

    Code (CSharp):
    1. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
    2.  
    3. // Alan Zucconi
    4. // www.alanzucconi.com
    5. Shader "Hidden/Heatmap" {
    6.         Properties{
    7.             _HeatTex("Texture", 2D) = "white" {}
    8.         }
    9.             SubShader{
    10.             Tags{ "Queue" = "Transparent" }
    11.             Blend SrcAlpha OneMinusSrcAlpha // Alpha blend
    12.             Cull Off
    13.  
    14.             Pass{
    15.             CGPROGRAM
    16. #pragma vertex vert          
    17. #pragma fragment frag
    18.  
    19.         struct vertInput {
    20.             float4 pos : POSITION;
    21.         };
    22.  
    23.         struct vertOutput {
    24.             float4 pos : POSITION;
    25.             fixed3 worldPos : TEXCOORD1;
    26.         };
    27.  
    28.         vertOutput vert(vertInput input) {
    29.             vertOutput o;
    30.             o.pos = mul(UNITY_MATRIX_MVP, input.pos);
    31.             o.worldPos = mul(_Object2World, input.pos).xyz;
    32.             return o;
    33.         }
    34.  
    35.         uniform int _Points_Length = 0;
    36.         uniform float3 _Points[100];        // (x, y, z) = position
    37.         uniform float2 _Properties[100];    // x = radius, y = intensity
    38.  
    39.         sampler2D _HeatTex;
    40.  
    41.         half4 frag(vertOutput output) : COLOR{
    42.             // Loops over all the points
    43.             half h = 0;
    44.         for (int i = 0; i < _Points_Length; i++)
    45.         {
    46.             // Calculates the contribution of each point
    47.             half di = distance(output.worldPos, _Points[i].xyz);
    48.  
    49.             half ri = _Properties[i].x;
    50.             half hi = 1 - saturate(di / ri);
    51.  
    52.             h += hi * _Properties[i].y;
    53.         }
    54.  
    55.         // Converts (0-1) according to the heat texture
    56.         h = saturate(h);
    57.         half4 color = tex2D(_HeatTex, fixed2(h, 0.5));
    58.         return color;
    59.         }
    60.             ENDCG
    61.         }
    62.         }
    63.             Fallback "Diffuse"
    64.     }
     
  3. ARLG

    ARLG

    Joined:
    Mar 5, 2015
    Posts:
    11