summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsLegacy/Assets/Avatars/Auri/materials/OptimizedShaders/body/Includes/CGI_PoiDithering.cginc
blob: 3a8ec332e01d6eee8d8dbb9d5044f897444e2417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef POI_DITHERING
    #define POI_DITHERING
    fixed _DitheringEnabled;
    fixed _DitherGradient;
    
    half calcDither(half2 grabPos)
    {
        half dither = Dither8x8Bayer(fmod(grabPos.x, 8), fmod(grabPos.y, 8));
        return dither;
    }
    
    #ifndef POI_SHADOW
        void applyDithering(inout float4 finalColor)
        {
            
            if (float(1))
            {
                half dither = calcDither(poiCam.screenUV.xy);
                finalColor.a = finalColor.a - (dither * (1 - finalColor.a) * float(0.1));
            }
        }
    #else
        void applyShadowDithering(inout float alpha, float2 screenUV)
        {
            
            if(float(1))
            {
                half dither = calcDither(screenUV);
                alpha = alpha - (dither * (1 - alpha) * float(0.1));
            }
        }
    #endif
    
#endif