Skip to content

Commit f766e40

Browse files
committed
[MSDF] Fix outline bleed out at small sizes.
1 parent 825ef23 commit f766e40

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/gles3/shaders/canvas.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ void main() {
611611
if (outline_thickness > 0.0) {
612612
float cr = clamp(outline_thickness, 0.0, (px_range / 2.0) - 1.0) / px_range;
613613
d = min(d, msdf_sample.a);
614-
float a = clamp((d - 0.5 + cr) * px_size + 0.5, 0.0, 1.0);
614+
float a = clamp((d - 0.5 + cr) * px_size, 0.0, 1.0);
615615
color.a = a * color.a;
616616
} else {
617617
float a = clamp((d - 0.5) * px_size + 0.5, 0.0, 1.0);

scene/resources/material.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ void fragment() {)";
16411641
if (msdf_outline_size > 0.0) {
16421642
float cr = clamp(msdf_outline_size, 0.0, (msdf_pixel_range / 2.0) - 1.0) / msdf_pixel_range;
16431643
d = min(d, albedo_tex.a);
1644-
albedo_tex.a = clamp((d - 0.5 + cr) * px_size + 0.5, 0.0, 1.0);
1644+
albedo_tex.a = clamp((d - 0.5 + cr) * px_size, 0.0, 1.0);
16451645
} else {
16461646
albedo_tex.a = clamp((d - 0.5) * px_size + 0.5, 0.0, 1.0);
16471647
}

servers/rendering/renderer_rd/shaders/canvas.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ void main() {
518518
if (outline_thickness > 0) {
519519
float cr = clamp(outline_thickness, 0.0, (px_range / 2.0) - 1.0) / px_range;
520520
d = min(d, msdf_sample.a);
521-
float a = clamp((d - 0.5 + cr) * px_size + 0.5, 0.0, 1.0);
521+
float a = clamp((d - 0.5 + cr) * px_size, 0.0, 1.0);
522522
color.a = a * color.a;
523523
} else {
524524
float a = clamp((d - 0.5) * px_size + 0.5, 0.0, 1.0);

0 commit comments

Comments
 (0)