Skip to content

Commit

Permalink
Fixed URP color shader to properly render alpha-tested sprite outlines (
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvtesh committed Feb 15, 2021
1 parent 4ebd021 commit 13c8332
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,20 @@ Shader "Hidden/UnityFx/OutlineColor.URP"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl"

#if _ALPHATEST_ON

TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);

half _Cutoff;

#endif

half4 FragmentSimple(Varyings input) : SV_Target
{
return 1;
}

half4 FragmentAlphaTest(Varyings input) : SV_Target
{
#if _ALPHATEST_ON
half4 c = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv);
AlphaDiscard(c.a, _Cutoff);
#endif
clip(c.a - _Cutoff);
return 1;
}

Expand Down Expand Up @@ -63,7 +57,6 @@ Shader "Hidden/UnityFx/OutlineColor.URP"

HLSLPROGRAM

#pragma shader_feature _ALPHATEST_ON
#pragma multi_compile_instancing
#pragma vertex Vert
#pragma fragment FragmentAlphaTest
Expand Down

0 comments on commit 13c8332

Please sign in to comment.