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. Dismiss Notice

Question Shader error in 'SG/SG Reflect': Duplicated input semantics can't change type, size, or layout ('TEX

Discussion in 'General Graphics' started by laurentlavigne, May 23, 2020.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,994
    do you know what that means and how to fix it?

    Code (CSharp):
    1. Shader error in 'SG/SG Reflect': Duplicated input semantics can't change type, size, or layout ('TEXCOORD0').
    2.  
    3. Compiling Fragment program with FOG_EXP2
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    5.  
    the shader is this
    Code (CSharp):
    1.   Shader "SG/SG Reflect" {
    2.     Properties {
    3.     [HDR]        _Color ("Color",Color) = (1,1,1,1)
    4.       _MainTex ("Texture", 2D) = "white" {}
    5.       //_Cube ("Cubemap", CUBE) = "" {}
    6.         _Metallic ("Metallic", RANGE(0,1)) = 0.5
    7.         _Smoothness ("Smoothness", RANGE(0,1)) = 1
    8.       _HealColor ("Heal Color", Color) = (0,1,0,1)
    9.       _HealPulseVal ("Heal Pulse", RANGE(0,1)) = 0
    10.       _DamageColor ("Damage Color", Color) = (1,0,0,1)
    11.       _DamagePulseVal ("Damage Pulse", RANGE(0,1)) = 0
    12.      _OutlineColor ("Outline Color", Color) = (0,0,0,1)
    13.     _Outline ("Outline width", float) = .005
    14.         }
    15.    
    16.     SubShader {
    17.       Tags { "RenderType" = "Opaque" }
    18.       CGPROGRAM
    19.    
    20.         #pragma surface surf Standard approxview  vertex:vert noforwardadd nodirlightmap
    21.        float4 _Color;
    22.       float4 _RimColor;    
    23.       float _RimPower;
    24.       float _Metallic;
    25.       float _Smoothness;
    26.         uniform float _DamagePulseVal;
    27.       uniform float _HealPulseVal;
    28.       uniform float4 _DamageColor;
    29.       uniform float4 _HealColor;
    30.      
    31.       struct Input
    32.       {
    33.           float2 uv_MainTex;
    34.           float3 worldRefl;
    35.           float3 vertexColor;
    36.           float3 viewDir;
    37.       };
    38.          
    39.       void vert (inout appdata_full v, out Input o)
    40.       {
    41.           UNITY_INITIALIZE_OUTPUT(Input,o);
    42.           o.vertexColor = v.color.rgb;
    43.       }
    44.    
    45.       sampler2D _MainTex;
    46.       samplerCUBE _Cube;
    47.      
    48.       void surf (Input IN, inout SurfaceOutputStandard o)
    49.       {
    50.              half3 c = tex2D (_MainTex, IN.uv_MainTex).rgb * IN.vertexColor *2* _Color;        
    51.              c = c*(1-_DamagePulseVal) + _DamagePulseVal*_DamageColor.rgb;      
    52.             c = c*(1-_HealPulseVal) + _HealPulseVal*_HealColor.rgb;
    53.           c *= IN.vertexColor;
    54.             o.Albedo = c;
    55.           o.Smoothness = _Smoothness;
    56.           o.Metallic = _Metallic;
    57.       }
    58.       ENDCG
    59.      UsePass "Toon/Basic Outline/OUTLINE"
    60.     }
    61.    
    62.     Fallback "Diffuse"
    63.   }
     
  2. asa989

    asa989

    Joined:
    Dec 18, 2015
    Posts:
    52
    Did you figure it out? i have the same problem!
     
  3. georgerh

    georgerh

    Joined:
    Feb 28, 2020
    Posts:
    72
    Just a wild guess, but maybe check if you are using the same semantic twice. For example SV_Position and POSITION could be the same as well as TEXCOORD_0 and UNITY_FOG_COORDS(0).
     
    laurentlavigne likes this.
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,994
    I fixed it but that was so long ago I don't remember.
    Lemme exhume that old project.
    Oh I switched to URP and rewrote the shader in SG.
    Sorry can't help on this one.