From b268d7410c5b98edc8762efe4635468cecaa3409 Mon Sep 17 00:00:00 2001 From: Evan Pelle Date: Mon, 15 Jun 2026 03:23:34 +0000 Subject: [PATCH] Keep the classic bitmap name font crisp when magnified Antialias the coverage mask's 0.5 contour in screen space (fwidth) so large names stay ~1px-sharp instead of blurring when drawn big. Co-Authored-By: Claude Opus 4.8 --- src/client/render/gl/shaders/name/name.frag.glsl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/render/gl/shaders/name/name.frag.glsl b/src/client/render/gl/shaders/name/name.frag.glsl index 1991dc064..32550c2a6 100644 --- a/src/client/render/gl/shaders/name/name.frag.glsl +++ b/src/client/render/gl/shaders/name/name.frag.glsl @@ -31,9 +31,12 @@ void main() { vec3 fillColor = mix(vec3(vNameShade), vPlayerColor.rgb, uFillUsePlayerColor); // Classic Arial bitmap: the atlas is a coverage mask; tint it with the fill - // color, no outline (matching the old DOM-rendered names). + // color, no outline (matching the old DOM-rendered names). Antialias the 0.5 + // coverage contour in screen space (fwidth) so the edge stays ~1px sharp at + // any magnification instead of blurring when names are drawn large. if (uClassic == 1) { - float coverage = texture(uAtlas, vUV).a; + float a = texture(uAtlas, vUV).a; + float coverage = clamp((a - 0.5) / max(fwidth(a), 1e-5) + 0.5, 0.0, 1.0); if (coverage <= 0.0) discard; fragColor = vec4(fillColor, vPlayerColor.a * coverage); return;