Fix SDF font outline sizes. (#435)

This commit is contained in:
Skyth (Asilkan) 2025-02-20 21:14:32 +03:00 committed by GitHub
parent b101e016cf
commit 5f5517977a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -90,7 +90,7 @@ float4 SampleSdfFont(float4 color, Texture2D<float4> texture, float2 uv, float2
float screenPxRange = max(0.5 * dot(unitRange, screenTexSize), 1.0); float screenPxRange = max(0.5 * dot(unitRange, screenTexSize), 1.0);
float sd = median(textureColor.r, textureColor.g, textureColor.b) - 0.5; float sd = median(textureColor.r, textureColor.g, textureColor.b) - 0.5;
float screenPxDistance = screenPxRange * (sd + g_PushConstants.Outline / (pxRange * 2.0)); float screenPxDistance = screenPxRange * (sd + g_PushConstants.Outline / (pxRange * 1.5));
if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_TITLE_BEVEL) if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_TITLE_BEVEL)
{ {
@ -100,7 +100,7 @@ float4 SampleSdfFont(float4 color, Texture2D<float4> texture, float2 uv, float2
float cosTheta = dot(normal, normalize(float2(1, 1))); float cosTheta = dot(normal, normalize(float2(1, 1)));
float3 gradient = lerp(color.rgb, cosTheta >= 0.0 ? rimColor : shadowColor, abs(cosTheta)); float3 gradient = lerp(color.rgb, cosTheta >= 0.0 ? rimColor : shadowColor, abs(cosTheta));
color.rgb = lerp(gradient, color.rgb, pow(saturate(sd + 0.8), 32.0)); color.rgb = lerp(gradient, color.rgb, pow(saturate(sd + 0.77), 32.0));
} }
else if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL) else if (g_PushConstants.ShaderModifier == IMGUI_SHADER_MODIFIER_CATEGORY_BEVEL)
{ {