Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Assets/Resources/Shaders/FairyGUI-BMFont.shader
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ Shader "FairyGUI/BMFont"
#endif

#ifdef SOFT_CLIPPED
float2 factor;
float2 condition = step(i.clipPos.xy, 0);
float4 clip_softness = _ClipSoftness * float4(condition, 1 - condition);
factor.xy = (1.0 - abs(i.clipPos.xy)) * (clip_softness.xw + clip_softness.zy);
float2 cond = step(i.clipPos.xy, 0);
float2 softnessRT = float2(_ClipSoftness.z, _ClipSoftness.y);
float2 softnessLB = float2(_ClipSoftness.x, _ClipSoftness.w);
float2 softness = softnessRT + cond * (softnessLB - softnessRT);
float2 factor = (1.0 - abs(i.clipPos.xy)) * softness;
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
#endif
#ifdef CLIPPED
Expand Down
9 changes: 5 additions & 4 deletions Assets/Resources/Shaders/FairyGUI-Image.shader
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@ Shader "FairyGUI/Image"
#endif

#ifdef SOFT_CLIPPED
float2 factor;
float2 condition = step(i.clipPos.xy, 0);
float4 clip_softness = _ClipSoftness * float4(condition, 1 - condition);
factor.xy = (1.0 - abs(i.clipPos.xy)) * (clip_softness.xw + clip_softness.zy);
float2 cond = step(i.clipPos.xy, 0);
float2 softnessRT = float2(_ClipSoftness.z, _ClipSoftness.y);
float2 softnessLB = float2(_ClipSoftness.x, _ClipSoftness.w);
float2 softness = softnessRT + cond * (softnessLB - softnessRT);
float2 factor = (1.0 - abs(i.clipPos.xy)) * softness;
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
#endif

Expand Down
9 changes: 5 additions & 4 deletions Assets/Resources/Shaders/FairyGUI-Text.shader
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ Shader "FairyGUI/Text"
#endif

#ifdef SOFT_CLIPPED
float2 factor;
float2 condition = step(i.clipPos.xy, 0);
float4 clip_softness = _ClipSoftness * float4(condition, 1 - condition);
factor.xy = (1.0 - abs(i.clipPos.xy)) * (clip_softness.xw + clip_softness.zy);
float2 cond = step(i.clipPos.xy, 0);
float2 softnessRT = float2(_ClipSoftness.z, _ClipSoftness.y);
float2 softnessLB = float2(_ClipSoftness.x, _ClipSoftness.w);
float2 softness = softnessRT + cond * (softnessLB - softnessRT);
float2 factor = (1.0 - abs(i.clipPos.xy)) * softness;
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,11 @@ SubShader {
#endif

#ifdef SOFT_CLIPPED
float2 factor;
float2 condition = step(input.mask.xy, 0);
float4 clip_softness = _ClipSoftness * float4(condition, 1 - condition);
factor.xy = (1.0 - abs(input.mask.xy)) * (clip_softness.xw + clip_softness.zy);
float2 cond = step(i.clipPos.xy, 0);
float2 softnessRT = float2(_ClipSoftness.z, _ClipSoftness.y);
float2 softnessLB = float2(_ClipSoftness.x, _ClipSoftness.w);
float2 softness = softnessRT + cond * (softnessLB - softnessRT);
float2 factor = (1.0 - abs(i.clipPos.xy)) * softness;
faceColor.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
clip(faceColor.a - 0.001);
#endif
Expand Down