Search Unity

Flickering bug (Unity 2018.3.0.f2 + PPS)

Discussion in 'Image Effects' started by Kronnect, Jan 28, 2019.

  1. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    Hi,

    I've managed to create repro for an issue I found using current PPS and Unity 2018.3.0f2:


    Code (CSharp):
    1. Shader "Hidden/Custom/Grayscale"
    2. {
    3.     HLSLINCLUDE
    4.  
    5. #include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"
    6.  
    7.     TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
    8.     float _Blend;
    9.  
    10.  
    11.  
    12.     struct VaryingsExtra
    13.     {
    14.         float4 vertex : SV_POSITION;
    15.         float2 texcoord : TEXCOORD0;
    16.         float2 texcoordStereo : TEXCOORD1;
    17.         float2 texcoordStereo2 : TEXCOORD2;
    18.     };
    19.  
    20.     VaryingsExtra Vert(AttributesDefault v)
    21.     {
    22.         VaryingsExtra o;
    23.         o.vertex = float4(v.vertex.xy, 0.0, 1.0);
    24.         o.texcoord = TransformTriangleVertexToUV(v.vertex.xy);
    25.  
    26. #if UNITY_UV_STARTS_AT_TOP
    27.         o.texcoord = o.texcoord * float2(1.0, -1.0) + float2(0.0, 1.0);
    28. #endif
    29.  
    30.         o.texcoordStereo = TransformStereoScreenSpaceTex(o.texcoord, 1.0);
    31.         o.texcoordStereo2 = o.texcoordStereo;
    32.  
    33.         return o;
    34.     }
    35.  
    36.  
    37.  
    38.  
    39.     float4 Frag(VaryingsExtra i) : SV_Target
    40.     {
    41.         float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoordStereo2);
    42.         float luminance = dot(color.rgb, float3(0.2126729, 0.7151522, 0.0721750));
    43.         color.rgb = lerp(color.rgb, luminance.xxx, _Blend.xxx);
    44.         return color;
    45.     }
    46.  
    47.         ENDHLSL
    48.  
    49.         SubShader
    50.     {
    51.         Cull Off ZWrite Off ZTest Always
    52.  
    53.             Pass
    54.         {
    55.             HLSLPROGRAM
    56.  
    57.                 #pragma vertex Vert
    58.                 #pragma fragment Frag
    59.  
    60.             ENDHLSL
    61.         }
    62.     }
    63. }

    Unity QA has been able to reproduce it and they have passed it to the developers (case 1115278). They think it could be a compile optimization issue.

    I'd appreciate any insight on this issue. Thanks.