Search Unity

UNITY_APPLY_DITHER_CROSSFADE() Not working in Unity 2017.3.1f1

Discussion in 'Shaders' started by Harrison_Perry, Mar 28, 2018.

  1. Harrison_Perry

    Harrison_Perry

    Joined:
    Jan 16, 2017
    Posts:
    9
    Hey all,

    UNITY_APPLY_DITHER_CROSSFADE doesn't seem to be working in Unity 2017.3.1f1 . I'm getting these errors:

    Shader error in 'VP/VPDiffuseTransparentDecal': incompatible type for parameter #1 ("vpos") at line 51 (on d3d9)

    Shader error in 'VP/VPDiffuseTransparentDecal': unable to generate code, no legal types for 
    program. at line 13492 (on d3d9


    Shader error in 'VP/VPDiffuseTransparentDecal': incompatible type for parameter #2 ("s") invalid operands to
    "div" invalid operands to "div" incompatible type for parameter #2 ("s") incompatible type for parameter #2
    ("s") incompatible type for parameter #2 ("s") incompatible type for parameter #2 ("s") assignment among
    incompatible concrete types at /UnityCG.cginc(1055) (on d3d9)


    Searching doesn't seem to bring anything up.

    This was working in Unity 5.6.x. But now, in 2017.3.1f1, all the models are white.

    Here's the shader: (Everything works fine with that line commented out (Apart from nice lodding!))

    Many thanks,

    Harrison


    // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
    Shader "VP/VPDiffuseTransparentDecal" {
    Properties{
    _Color("Main Color", Color) = (1,1,1,1)
    _MainTex("Base (RGB)", 2D) = "white" {}
    _AOTex("AO (RGB)", 2D) = "white" {}
    _AO2Tex("AO2 (RGB)", 2D) = "white" {}
    }
    SubShader{
    Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+100" "ForceNoShadowCasting" = "True" }
    AlphaToMask On
    LOD 200
    offset -0.5,-0.5
    CGPROGRAM
    #include "UnityCG.cginc"
    #include "customLighting.cginc"
    #pragma multi_compile _ LOD_FADE_CROSSFADE
    #pragma surface surf NormalizedLambert keepalpha decal:blend vertex:vert
    #pragma target 3.5
    sampler2D _MainTex;
    fixed4 _Color;
    sampler2D _AOTex;
    sampler2D _AO2Tex;
    struct Input {
    float2 uv_MainTex : TEXCOORD0;
    float2 uv2_AOTex : TEXCOORD1;
    float2 uv3_AO2Tex : TEXCOORD2;
    #ifdef LOD_FADE_CROSSFADE
    UNITY_DITHER_CROSSFADE_COORDS
    #endif
    };
    void vert(inout appdata_full v, out Input o)
    {
    UNITY_INITIALIZE_OUTPUT(Input, o);
    #ifdef LOD_FADE_CROSSFADE
    UNITY_TRANSFER_DITHER_CROSSFADE(o, v.vertex);
    #endif
    }
    void surf(Input IN, inout SurfaceOutput o) {
    #ifdef LOD_FADE_CROSSFADE
    UNITY_APPLY_DITHER_CROSSFADE(IN);
    #endif
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    fixed4 ao = tex2D(_AOTex, IN.uv2_AOTex);
    fixed4 ao2 = tex2D(_AO2Tex, IN.uv3_AO2Tex);
    o.Albedo = c.rgb * ao.rgb * ao2.rgb;
    o.Alpha = c.a * ao.a * ao2.a;
    }
    ENDCG
    Pass
    {
    Tags{ "LightMode" = "ShadowCaster" "Queue" = "Geometry" }
    CGPROGRAM
    #pragma vertex vert
    #pragma fragment frag
    #pragma multi_compile_shadowcaster
    #include "UnityCG.cginc"

    sampler2D _MainTex;
    float4 _MainTex_ST;
    struct v2f {
    float2 uv_MainTex : TEXCOORD0;
    V2F_SHADOW_CASTER;
    };
    v2f vert(appdata_base v)
    {
    v2f o;
    o.uv_MainTex = TRANSFORM_TEX(v.texcoord, _MainTex);
    TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
    return o;
    }
    float4 frag(v2f i) : SV_Target
    {
    fixed4 c = tex2D(_MainTex, i.uv_MainTex);
    if (c.a < 0.05)
    discard;
    return 1;
    }
    ENDCG
    }
    }
    Fallback "Legacy Shaders/VertexLit"
    }

     
  2. AlexUniy

    AlexUniy

    Joined:
    Nov 10, 2015
    Posts:
    5
    The same problem.
    and problem in this string UNITY_APPLY_DITHER_CROSSFADE(IN);

    Are you found solution?
     
  3. Harrison_Perry

    Harrison_Perry

    Joined:
    Jan 16, 2017
    Posts:
    9
    Nope! I've moved projects since, so maybe this is fixed in later versions?
     
  4. ITRick

    ITRick

    Joined:
    Apr 12, 2018
    Posts:
    3