-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Border & CornerRadius #8381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Border & CornerRadius #8381
Conversation
…sual-features # Conflicts: # crates/bevy_ui/src/render/pipeline.rs
Move some work from fragment shader to vertex shader Add branching to skip complexity when there's no rounding or border Remove softness since we're not using it
# Conflicts: # examples/ui/button.rs # examples/ui/ui.rs
…antume/bevy Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
This reverts commit ba125bf.
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Breaking change here is totally fine, but we should note it just in case :) |
Okay! It's just the new fields in ButtonBundle! |
Can you update the Migration guide section to not say the As mentioned earlier part? We auto generate the full migration guide based on that section and it wouldn't be useful for a user to read this. |
there is also #7795 for borders in UI |
Yes, I'm aware of that. I wonder how to merge that with this honestly. |
Done!! ^_^ |
#3991 had a couple of problems iirc:
#7995 is pretty simple, it should be easy to combine them but needs non-uniform border support. |
crates/bevy_ui/src/render/ui.wgsl
Outdated
if (in.radius > 0.0 || in.border_width > 0.0) { | ||
var distance = distance_round_border(in.point, in.size * 0.5, in.radius); | ||
|
||
var inner_alpha = 1.0 - smoothstep(0.0, 0.0, distance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var inner_alpha = 1.0 - smoothstep(0.0, 0.0, distance); | |
var inner_alpha = 1.0 - smoothstep(0.0, 1.0, distance); |
I believe this should be 1.0, otherwise you're not getting any anti-aliasing. Something still looks off though, the transition between straight edges/corners is too sharp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JMS55 this is fixed now, but it's great if I could get assistance with the sharp transition issue.
I don't have many experiences with rendering, unfortunately.
I'm really sorry. I haven't been able to look into this PR for the last few weeks.
Ah, what systems are they? |
What was the problem? |
It was a while ago and only a small sample size but the problems were with the wasm build for some linux users. |
I think what I struggled with was getting the radii of the corners of the inner and outer rectangles to match perfectly when the border edges had non-uniform thicknesses. |
Would be amazing to start making pretty ui with corner radius in bevy 0.11, how far is it from completion? :) |
It should be okay to be used in a private fork, but I believe this needs some reviews first before being merged. |
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Signed-off-by: Natalia Asteria <[email protected]>
Completed in #7795 :) Thanks a ton for this regardless: it was helpful to see another take on the problem. |
Objective
0.6.0
and the author hasn't updated the PR ever since it was blocked.Solution
Changelog
corner
andcorner_radius
properties to ButtonBundleMigration Guide
As we added the
corner
andcorner_radius
properties to ButtonBundle, this might break the API for people who don't use..default()
, but that seems rare. You can set it to a value you like or useDefault::default()
as usual.