Remove artifact when a border side was not rendered
This introduces an extra conditional in the shader, there's probably a way of writing it without ifs but I like how the logic reads with it and it shouldn't be that big of a deal performance-wise.
This commit is contained in:
parent
32c070250c
commit
3de0ce6079
1 changed files with 12 additions and 6 deletions
|
@ -73,12 +73,18 @@ fragment float4 quad_fragment(
|
||||||
border_width = center_to_point.y <= 0.0 ? input.quad.border_top : input.quad.border_bottom;
|
border_width = center_to_point.y <= 0.0 ? input.quad.border_top : input.quad.border_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
float inset_distance = distance + border_width;
|
float4 color;
|
||||||
float4 color = mix(
|
if (border_width == 0.) {
|
||||||
coloru_to_colorf(input.quad.border_color),
|
color = coloru_to_colorf(input.quad.background_color);
|
||||||
coloru_to_colorf(input.quad.background_color),
|
} else {
|
||||||
saturate(0.5 - inset_distance)
|
float inset_distance = distance + border_width;
|
||||||
);
|
color = mix(
|
||||||
|
coloru_to_colorf(input.quad.border_color),
|
||||||
|
coloru_to_colorf(input.quad.background_color),
|
||||||
|
saturate(0.5 - inset_distance)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
float4 coverage = float4(1.0, 1.0, 1.0, saturate(0.5 - distance));
|
float4 coverage = float4(1.0, 1.0, 1.0, saturate(0.5 - distance));
|
||||||
return coverage * color;
|
return coverage * color;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue