Skip to content
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

UI: don't multiply color channels by alpha #12599

Merged

Conversation

mockersf
Copy link
Member

Objective

Solution

@mockersf mockersf added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Mar 20, 2024
@mockersf mockersf requested a review from rparrett March 20, 2024 20:41
@mockersf mockersf changed the title don't use alpha in color UI: don't multiply color channels by alpha Mar 20, 2024
@JMS55
Copy link
Contributor

JMS55 commented Mar 20, 2024

This might've been related to the aliasing we saw in the original PR on rounded corners? I'm not sure, could be shadows like you said. Probably needs testing. If it turns out we need to keep this, we can do it in the shader only for non-text or something.

@mockersf
Copy link
Member Author

I'm not seeing aliasing issues, at least it looks the same to me from main

this PR:
12599

main:
main

@rparrett
Copy link
Contributor

rparrett commented Mar 20, 2024

I believe this comment: #12500 (comment) is what lead to the alpha multiplication, but I don't fully understand it and can't find the discussion or review it is referencing.

But it seems like we should probably test with either border or background colors, or parent UI nodes with partial transparency?

edit: Maybe the referenced "halo" is visible in this comment: #8973 (comment). But as far as I can tell, ickshonpe seemed to think the issue was fixed by the time the PR was adopted.

@alice-i-cecile alice-i-cecile requested a review from viridia March 20, 2024 21:05
@alice-i-cecile alice-i-cecile added this to the 0.14 milestone Mar 20, 2024
@mockersf
Copy link
Member Author

mockersf commented Mar 20, 2024

with a background color at rgba(0.0, 0.0, 1.0, 0.5):

this PR:
12599

main:
main

Looking through changes from #12500, this PR also fix the change on the ui example where one of the square wasn't the same color

@rparrett
Copy link
Contributor

rparrett commented Mar 20, 2024

edit: more comprehensive tests below

@rparrett
Copy link
Contributor

rparrett commented Mar 20, 2024

Did some experiments with the same transparent border/bg color over the default clear color.

image

image

This PR restores behavior to pre-round-corners state. I think at the very least, it's pretty clear that this alpha multiplication shouldn't happen for text. (see the transparency_ui example before/after this PR).

The chrome comparison is quite interesting, but maybe not relevant.

Copy link
Contributor

@viridia viridia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought that earlier code looked suspicious, but I wasn't sure.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 20, 2024
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 20, 2024
Merged via the queue into bevyengine:main with commit bd90a64 Mar 20, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants