Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

LODGroup crossfade shader var issue

Discussion in 'General Graphics' started by kilian277, Jun 24, 2015.

  1. kilian277

    kilian277

    Joined:
    Jul 13, 2012
    Posts:
    54
    Hi,


    I have some props that i want to nicely blend in to reduce the lod popping , i use lerping and clipping in my shader along with the built-in unity_LODFade float2.

    Now it works perfectly however when the player is at 100% and keeps getting closer to the object the first dither mask appears instead of the full opaque mask (attached)

    Here's my shader code (jsut standard with clipping function):

    Code (CSharp):
    1. void surf (Input IN, inout SurfaceOutputStandard o) {
    2.  
    3.             clip(lerp(tex2D (_Dither1, IN.uv_Dither1),
    4.                 lerp(tex2D (_Dither2, IN.uv_Dither1),
    5.                 lerp(tex2D (_Dither3, IN.uv_Dither1),
    6.                 lerp(tex2D (_Dither4, IN.uv_Dither1),
    7.                 lerp(tex2D (_Dither5, IN.uv_Dither1),
    8.                 lerp(tex2D (_Dither6, IN.uv_Dither1),
    9.                 lerp(tex2D (_Dither7, IN.uv_Dither1),
    10.                 lerp(tex2D (_Dither8, IN.uv_Dither1),
    11.                 tex2D (_Dither9, IN.uv_Dither1),
    12.                 unity_LODFade.x),
    13.                 unity_LODFade.x),
    14.                 unity_LODFade.x),
    15.                 unity_LODFade.x),
    16.                 unity_LODFade.x),
    17.                 unity_LODFade.x),
    18.                 unity_LODFade.x),
    19.                 unity_LODFade.x) - _SliceAmount);
    20.                
    21.                
    22.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
    23.             fixed3 n = UnpackNormal(tex2D(_MainTexn, IN.uv_MainTex));
    24.             o.Albedo = c.rgb;
    25.             o.Normal = n.rgb;
    26.         }

    Some more insight would be appreciated !
     

    Attached Files:

unityunity