diff --git a/crates/bevy_ui/src/render/ui.wgsl b/crates/bevy_ui/src/render/ui.wgsl index b22c8615ff..5fc77b1d30 100644 --- a/crates/bevy_ui/src/render/ui.wgsl +++ b/crates/bevy_ui/src/render/ui.wgsl @@ -158,7 +158,7 @@ fn draw(in: VertexOutput) -> vec4 { let t = select(1.0 - step(0.0, border_distance), antialias(border_distance), external_distance < internal_distance); // Blend mode ALPHA_BLENDING is used for UI elements, so we don't premultiply alpha here. - return vec4(color.rgb, color.a * t); + return vec4(color.rgb, saturate(color.a * t)); } fn draw_background(in: VertexOutput) -> vec4 { @@ -168,7 +168,7 @@ fn draw_background(in: VertexOutput) -> vec4 { // When drawing the background only draw the internal area and not the border. let internal_distance = sd_inset_rounded_box(in.point, in.size, in.radius, in.border); let t = antialias(internal_distance); - return vec4(color.rgb, color.a * t); + return vec4(color.rgb, saturate(color.a * t)); } @fragment