Skip to content

Commit 004ba58

Browse files
authored
reduce the antialias strength (#13814)
# Objective - Fixes #13807 ## Solution - Before this pr we antialiased between 0.5 and -0.5. This pr changes things to antialias between 0.25 and -0.25. I tried slightly larger ranges, but the edge between the boxes still showed. I'm not 100% sure this is the correct solution, but from what I could find the range you use is more art than science. ## Testing - Ran rounded_borders example, the code in the linked issue, and the testing example from #12702. --- ## Changelog - reduce antialiasing in ui shader.
1 parent 061baa4 commit 004ba58

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/bevy_ui/src/render/ui.wgsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ fn sd_inset_rounded_box(point: vec2<f32>, size: vec2<f32>, radius: vec4<f32>, in
123123
// get alpha for antialiasing for sdf
124124
fn antialias(distance: f32) -> f32 {
125125
// Using the fwidth(distance) was causing artifacts, so just use the distance.
126-
return clamp(0.0, 1.0, 0.5 - distance);
126+
// This antialiases between the distance values of 0.25 and -0.25
127+
return clamp(0.0, 1.0, 0.5 - 2.0 * distance);
127128
}
128129

129130
fn draw(in: VertexOutput, texture_color: vec4<f32>) -> vec4<f32> {

0 commit comments

Comments
 (0)