summaryrefslogtreecommitdiff
path: root/VRCSDK3AvatarsLegacy/Assets/_PoiyomiShaders/Shaders/Patreon/VoxelCubed/Includes/PoiOutlineFrag.cginc
blob: 52cba1371c77beddae2a9a2454b4a7146bb8b3eb (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
    float4 frag(v2f i, float facing: VFACE): COLOR
    {
        float alphaMultiplier = smoothstep(_OutlineFadeDistance.x, _OutlineFadeDistance.y, distance(getCameraPosition(), i.worldPos));
        clip(_LineWidth - 0.001);
        float _alphaMask_tex_var = tex2D(_AlphaMask, TRANSFORM_TEX(i.uv, _AlphaMask));
        fixed4 _main_tex_var = UNITY_SAMPLE_TEX2D(_MainTex, TRANSFORM_TEX(i.uv, _MainTex));
        fixed4 col = tex2D(_OutlineTexture, TRANSFORM_TEX((i.uv + (_OutlineTexturePan.xy * _Time.g)), _OutlineTexture));
        col.a *= alphaMultiplier;
        
        clip(col.a * _alphaMask_tex_var - _Clip);
        
        col *= _LineColor;
        
        #ifdef LIGHTING
            calculateLighting(i);
        #endif
        
        float4 finalColor = col;
        
        #ifdef LIGHTING
            applyLighting(finalColor);
        #endif
        
        finalColor.rgb += (col.rgb * _OutlineEmission);
        return finalColor;
    }