From f53a8af3a6b60ff486b984f473f75ab7e13cafc9 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 3 Feb 2023 19:21:27 -0800 Subject: Add hack to reduce outlines around emotes Don't render any part of an emote with alpha < 0.5. Improves visual clarity in the common case at the cost of generality. * Emotes now use physically-based shading. * Use round() to denoise shader parameters instead of floor() --- Shaders/TaSTT_lighting_template.cginc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Shaders') diff --git a/Shaders/TaSTT_lighting_template.cginc b/Shaders/TaSTT_lighting_template.cginc index aa20751..48d776d 100644 --- a/Shaders/TaSTT_lighting_template.cginc +++ b/Shaders/TaSTT_lighting_template.cginc @@ -688,8 +688,12 @@ fixed4 frag(v2f i) : SV_Target } else { bg = light(i, Background_Color); } - if (is_emote) { - bg.rgb = lerp(bg.rgb, text.rgb, text.w); + // Hack: If alpha (text.w) is less than 0.5, don't render it. This + // eliminates outlines around simple emotes with transparent backgrounds. + if (is_emote && text.w > 0.5) { + // Use emote alpha to mix emote color with background color (compositing). + text.rgb = lerp(bg.rgb, text.rgb, text.w); + bg = light(i, fixed4(text.rgb, 1.0)); } return bg; } else { -- cgit v1.2.3