Font working

This commit is contained in:
2026-05-05 23:47:08 +10:00
parent 3e8b472f74
commit 62c3ded1f8
9 changed files with 220 additions and 36 deletions

View File

@@ -15,11 +15,16 @@ float4 shadeVideo(ShaderContext context)
float2 resolution = max(context.outputResolution, float2(1.0, 1.0));
float aspect = resolution.x / resolution.y;
float2 textSize = float2(0.72 * scale, 0.09 * scale * aspect);
float2 textUv = (context.uv - position) / max(textSize, float2(0.0001, 0.0001));
float2 safeTextSize = max(textSize, float2(0.0001, 0.0001));
float2 textUv = (context.uv - position) / safeTextSize;
bool insideTextRect = textUv.x >= 0.0 && textUv.x <= 1.0 && textUv.y >= 0.0 && textUv.y <= 1.0;
float mask = sampleTitleText(textUv);
float mask = insideTextRect ? sampleTitleText(textUv) : 0.0;
float fill = smoothstep(0.48, 0.54, mask);
float outline = smoothstep(0.48 - outlineWidth, 0.54 - outlineWidth, mask);
float textAlpha = max(fill * fillColor.a, outline * outlineColor.a);
if (textAlpha <= 0.0001)
return context.sourceColor;
float4 base = context.sourceColor;
float4 outlineLayer = float4(outlineColor.rgb * outlineColor.a, outline * outlineColor.a);