Skip to content

Commit

Permalink
Fixing ui antialiasing clamp call parameters order (#14970) (#17456)
Browse files Browse the repository at this point in the history
# Objective

Fixes #14970

## Solution

It seems the clamp call in `ui.wgsl` had the parameters order incorrect.

## Testing

Tested using examples/ui in native and my current project in wasm - both
in linux.
Could use some help with testing in other platforms.

---
  • Loading branch information
hexroll authored Jan 20, 2025
1 parent 6fc965e commit 15facbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/ui.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn sd_inset_rounded_box(point: vec2<f32>, size: vec2<f32>, radius: vec4<f32>, in
// get alpha for antialiasing for sdf
fn antialias(distance: f32) -> f32 {
// Using the fwidth(distance) was causing artifacts, so just use the distance.
return clamp(0.0, 1.0, (0.5 - distance));
return saturate(0.5 - distance);
}

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

0 comments on commit 15facbb

Please sign in to comment.