diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-Mobile-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-Mobile-UIEffect-Unity6.shader index c6e6c02..c4563c6 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-Mobile-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-Mobile-UIEffect-Unity6.shader @@ -159,7 +159,7 @@ SubShader { { v2f IN = _fragInput; float2 uvMove = uv - IN.texcoord0; - fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0 + uvMove).a); + fixed4 color = fixed4(IN.color.rgb, tex2D(_MainTex, IN.texcoord0 + uvMove).a); color.rgb *= color.a; return color; } @@ -171,6 +171,7 @@ SubShader { { _fragInput = IN; half4 color = uieffect(IN.texcoord0, IN.uvMask, IN.worldPosition); + color *= IN.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-UIEffect-Unity6.shader index df783d5..a0e087c 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_Bitmap-UIEffect-Unity6.shader @@ -165,7 +165,7 @@ SubShader{ v2f IN = _fragInput; float2 uvMove = uv - IN.texcoord0; fixed4 color = tex2D(_MainTex, IN.texcoord0 + uvMove); - color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); + color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, color.a); color.rgb *= color.a; return color; } @@ -177,6 +177,7 @@ SubShader{ { _fragInput = IN; half4 color = uieffect(IN.texcoord0, IN.uvMask, IN.worldPosition); + color *= IN.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF Overlay-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF Overlay-UIEffect-Unity6.shader index c93f798..634dc33 100644 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF Overlay-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF Overlay-UIEffect-Unity6.shader @@ -344,7 +344,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } #define UIEFFECT_TEXTMESHPRO 1 @@ -356,6 +356,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); + faceColor *= input.color.a; #if UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF SSD-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF SSD-UIEffect-Unity6.shader index 3141939..7a5f480 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF SSD-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF SSD-UIEffect-Unity6.shader @@ -338,7 +338,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } @@ -351,6 +351,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); + faceColor *= input.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile Overlay-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile Overlay-UIEffect-Unity6.shader index 53992de..3fb830b 100644 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile Overlay-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile Overlay-UIEffect-Unity6.shader @@ -146,6 +146,7 @@ SubShader { // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD5; float4 worldPosition : TEXCOORD6; + fixed alpha : TEXCOORD7; // ==== UIEFFECT END ==== }; @@ -189,17 +190,17 @@ SubShader { { input.color.rgb = UIGammaToLinear(input.color.rgb); } - float opacity = input.color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; - // faceColor.rgb *= faceColor.a; + faceColor.rgb *= faceColor.a; fixed4 outlineColor = _OutlineColor; outlineColor.a *= opacity; - // outlineColor.rgb *= outlineColor.a; + outlineColor.rgb *= outlineColor.a; outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); #if (UNDERLAY_ON | UNDERLAY_INNER) @@ -224,13 +225,14 @@ SubShader { const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY)); output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy)); #if (UNDERLAY_ON || UNDERLAY_INNER) - output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.texcoord1 = float4(input.texcoord0 + layerOffset, 1, 0); output.underlayParam = half2(layerScale, layerBias); #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.vertex; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -277,6 +279,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 c = uieffect(input.texcoord0.xy, input.uvMask, input.worldPosition); + c *= input.alpha; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile SSD-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile SSD-UIEffect-Unity6.shader index fe18906..e653cd6 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile SSD-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile SSD-UIEffect-Unity6.shader @@ -145,7 +145,8 @@ SubShader { #endif // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD4; - float4 worldPosition :TEXCOORD5; + float4 worldPosition : TEXCOORD5; + fixed alpha : TEXCOORD6; // ==== UIEFFECT END ==== }; @@ -185,7 +186,7 @@ SubShader { color = SRGBToLinear(input.color); #endif - float opacity = color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif @@ -216,13 +217,14 @@ SubShader { float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; - output.texcoord2 = float4(input.texcoord0 + float2(x, y), input.color.a, 0); + output.texcoord2 = float4(input.texcoord0 + float2(x, y), 1, 0); output.underlayColor = underlayColor; #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.position; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -291,6 +293,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.texcoord0, input.uvMask, input.worldPosition); + faceColor *= input.alpha; // Alternative implementation to UnityGet2DClipping with support for softness #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile-UIEffect-Unity6.shader index b157daf..4bff6fe 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-Mobile-UIEffect-Unity6.shader @@ -144,6 +144,7 @@ SubShader { // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD5; float4 worldPosition : TEXCOORD6; + fixed alpha : TEXCOORD7; // ==== UIEFFECT END ==== }; @@ -187,17 +188,17 @@ SubShader { { input.color.rgb = UIGammaToLinear(input.color.rgb); } - float opacity = input.color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; - //faceColor.rgb *= faceColor.a; + faceColor.rgb *= faceColor.a; fixed4 outlineColor = _OutlineColor; outlineColor.a *= opacity; - //outlineColor.rgb *= outlineColor.a; + outlineColor.rgb *= outlineColor.a; outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); #if (UNDERLAY_ON | UNDERLAY_INNER) @@ -223,13 +224,14 @@ SubShader { const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY)); output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy)); #if (UNDERLAY_ON || UNDERLAY_INNER) - output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.texcoord1 = float4(input.texcoord0 + layerOffset, 1, 0); output.underlayParam = half2(layerScale, layerBias); #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.vertex; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -278,7 +280,8 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 c = uieffect(input.texcoord0.xy, input.uvMask, input.worldPosition); - + c *= input.alpha; + // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); diff --git a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-UIEffect-Unity6.shader b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-UIEffect-Unity6.shader index fdf33ee..8b48ef8 100755 --- a/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-UIEffect-Unity6.shader +++ b/Packages/src/Samples~/TextMeshPro Support (Unity 6)~/Hidden-TMP_SDF-UIEffect-Unity6.shader @@ -346,7 +346,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } #define UIEFFECT_TEXTMESHPRO 1 #include "Packages/com.coffee.ui-effect/Shaders/UIEffect.cginc" @@ -357,7 +357,8 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); - + faceColor *= input.color.a; + #if UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); faceColor *= m.x * m.y; diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-Mobile-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-Mobile-UIEffect.shader index 704ee10..17e654f 100755 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-Mobile-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-Mobile-UIEffect.shader @@ -152,7 +152,7 @@ SubShader { { v2f IN = _fragInput; float2 uvMove = uv - IN.texcoord0; - fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0 + uvMove).a); + fixed4 color = fixed4(IN.color.rgb, tex2D(_MainTex, IN.texcoord0 + uvMove).a); color.rgb *= color.a; return color; } @@ -165,6 +165,7 @@ SubShader { { _fragInput = IN; fixed4 color = uieffect(IN.texcoord0, IN.uvMask, IN.worldPosition); + color *= IN.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-UIEffect.shader index 9bb50f8..49d5eff 100755 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_Bitmap-UIEffect.shader @@ -166,7 +166,7 @@ SubShader{ v2f IN = _fragInput; float2 uvMove = uv - IN.texcoord0; fixed4 color = tex2D(_MainTex, IN.texcoord0 + uvMove); - color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); + color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, color.a); color.rgb *= color.a; return color; } @@ -179,6 +179,7 @@ SubShader{ { _fragInput = IN; fixed4 color = uieffect(IN.texcoord0, IN.uvMask, IN.worldPosition); + color *= IN.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF Overlay-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF Overlay-UIEffect.shader index 05f3953..5b17a56 100644 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF Overlay-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF Overlay-UIEffect.shader @@ -338,7 +338,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } #define UIEFFECT_TEXTMESHPRO 1 @@ -350,6 +350,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); + faceColor *= input.color.a; #if UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF SSD-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF SSD-UIEffect.shader index ffdf179..9380f84 100755 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF SSD-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF SSD-UIEffect.shader @@ -329,7 +329,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } #define UIEFFECT_TEXTMESHPRO 1 @@ -341,6 +341,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); + faceColor *= input.color.a; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile Overlay-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile Overlay-UIEffect.shader index 9aa934d..48246df 100644 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile Overlay-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile Overlay-UIEffect.shader @@ -143,6 +143,7 @@ SubShader { // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD5; float4 worldPosition : TEXCOORD6; + fixed alpha : TEXCOORD7; // ==== UIEFFECT END ==== }; @@ -181,17 +182,17 @@ SubShader { float bias = (0.5 - weight) * scale - 0.5; float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; - float opacity = input.color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; - // faceColor.rgb *= faceColor.a; + faceColor.rgb *= faceColor.a; fixed4 outlineColor = _OutlineColor; outlineColor.a *= opacity; - // outlineColor.rgb *= outlineColor.a; + outlineColor.rgb *= outlineColor.a; outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); #if (UNDERLAY_ON | UNDERLAY_INNER) @@ -216,13 +217,14 @@ SubShader { const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY)); output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy)); #if (UNDERLAY_ON || UNDERLAY_INNER) - output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.texcoord1 = float4(input.texcoord0 + layerOffset, 1, 0); output.underlayParam = half2(layerScale, layerBias); #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.vertex; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -269,6 +271,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 c = uieffect(input.texcoord0.xy, input.uvMask, input.worldPosition); + c *= input.alpha; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile SSD-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile SSD-UIEffect.shader index 87bfde3..3d6e20f 100755 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile SSD-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile SSD-UIEffect.shader @@ -146,6 +146,7 @@ SubShader { // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD4; float4 worldPosition : TEXCOORD5; + fixed alpha : TEXCOORD6; // ==== UIEFFECT END ==== }; @@ -185,7 +186,7 @@ SubShader { color = SRGBToLinear(input.color); #endif - float opacity = color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif @@ -216,13 +217,14 @@ SubShader { float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; - output.texcoord2 = float4(input.texcoord0 + float2(x, y), input.color.a, 0); + output.texcoord2 = float4(input.texcoord0 + float2(x, y), 1, 0); output.underlayColor = underlayColor; #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.position; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -291,6 +293,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.texcoord0, input.uvMask, input.worldPosition); + faceColor *= input.alpha; // Alternative implementation to UnityGet2DClipping with support for softness #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile-UIEffect.shader index 994caf3..f7b4e80 100644 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-Mobile-UIEffect.shader @@ -144,6 +144,7 @@ SubShader { // ==== UIEFFECT START ==== float4 uvMask : TEXCOORD5; float4 worldPosition : TEXCOORD6; + fixed alpha : TEXCOORD7; // ==== UIEFFECT END ==== }; @@ -182,17 +183,17 @@ SubShader { float bias = (0.5 - weight) * scale - 0.5; float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; - float opacity = input.color.a; + float opacity = 1; #if (UNDERLAY_ON | UNDERLAY_INNER) opacity = 1.0; #endif fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; - // faceColor.rgb *= faceColor.a; + faceColor.rgb *= faceColor.a; fixed4 outlineColor = _OutlineColor; outlineColor.a *= opacity; - // outlineColor.rgb *= outlineColor.a; + outlineColor.rgb *= outlineColor.a; outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); #if (UNDERLAY_ON | UNDERLAY_INNER) @@ -217,13 +218,14 @@ SubShader { const half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY)); output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * maskSoftness + pixelSize.xy)); #if (UNDERLAY_ON || UNDERLAY_INNER) - output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.texcoord1 = float4(input.texcoord0 + layerOffset, 1, 0); output.underlayParam = half2(layerScale, layerBias); #endif // ==== UIEFFECT START ==== output.uvMask = input.texcoord2; output.worldPosition = input.vertex; + output.alpha = input.color.a; // ==== UIEFFECT END ==== return output; @@ -270,6 +272,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 c = uieffect(input.texcoord0.xy, input.uvMask, input.worldPosition); + c *= input.alpha; // Alternative implementation to UnityGet2DClipping with support for softness. #if UNITY_UI_CLIP_RECT diff --git a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-UIEffect.shader b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-UIEffect.shader index 3efe18b..957f2ea 100644 --- a/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-UIEffect.shader +++ b/Packages/src/Samples~/TextMeshPro Support~/Hidden-TMP_SDF-UIEffect.shader @@ -338,7 +338,7 @@ SubShader { faceColor.rgb += glowColor.rgb * glowColor.a; #endif - return faceColor * input.color.a; + return faceColor; } #define UIEFFECT_TEXTMESHPRO 1 @@ -350,6 +350,7 @@ SubShader { UNITY_SETUP_INSTANCE_ID(input); _fragInput = input; half4 faceColor = uieffect(input.atlas, input.uvMask, input.worldPosition); + faceColor *= input.color.a; #if UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); diff --git a/Packages/src/Shaders/UIEffect.shader b/Packages/src/Shaders/UIEffect.shader index 30cd7f9..d0c9406 100644 --- a/Packages/src/Shaders/UIEffect.shader +++ b/Packages/src/Shaders/UIEffect.shader @@ -154,7 +154,7 @@ Shader "Hidden/UI/Default (UIEffect)" fixed4 uieffect_frag(float2 uv) { v2f IN = _fragInput; - half4 color = IN.color * (tex2D(_MainTex, uv) + _TextureSampleAdd); + half4 color = (tex2D(_MainTex, uv) + _TextureSampleAdd); color.rgb *= color.a; return color; } @@ -173,6 +173,8 @@ Shader "Hidden/UI/Default (UIEffect)" _fragInput = IN; half4 c = uieffect(IN.texcoord, IN.uvMask, IN.worldPosition); + c.rgb *= IN.color.rgb; + c *= IN.color.a; #ifdef UNITY_UI_CLIP_RECT half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw);