-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Fixed StyleBoxFlat antialiasing to be applied only on corners #35520
Fixed StyleBoxFlat antialiasing to be applied only on corners #35520
Conversation
After multiple changes to the transparent drawing used for AA, it ended up being consistently applied all around the borders inside and outside, which is not the intended behavior. This change makes sure border flat sides are solid instead of blurry. Fixes godotengine#35279
CC @Zylann |
The outlined borders look good, but the non-outlined ones still look blurry and cause an overlap. In beta5, everything seems to look right, but the only thing that actually looked wrong were corners of the non-outlined boxes, as they seemed to miss AA completely: which is also what was reported originally in #34830 |
Does it work with rotated controls? |
Between Beta5 and PR, same results as I described before, although you'll need to squint to see all the details on these screenshots. While RC2 does have better results on straight rotated lines, it's quite a matter of "luck" for the rotated control (since between "blurry" line and an AAed line you wouldn't tell much difference), while real AA would have looked correct in all screenshots... (note it still has the artifact below the tab, and spacings look slightly off) at this point I'm starting to believe the way AA is currently implemented will always have drawbacks like this. |
Based on these screenshots, it looks like this PR is actually a regression for some cases. In the RC2 screenshot: I'm going to check again if I can adjust the position and thickness of the border in the case of AA to fix the artifacts visible in the screenshot from RC2 without a need for adjusting positions with decimal values. |
Maybe not the right word, I understand what you describe^^ what I was saying is that it looks right, because it would be hard to distinguish between a blurry line and a properly anti-aliased line when it's rotated anyways, because they happen to produce similar results ("similar", because it's still blurrier than AA). The problem becomes more obvious when it's horizontal or near-horizontal, and way less visible when diagonal. I recall AA was never really supported with 2D polygons in Godot... any chance for that to happen one day? Hopefully if #12840 is fixed then all these workarounds would no longer be needed. |
@Zylann There are plans to support MSAA in 2D in 4.0. That said, I think fake antialiasing still has the potential to be faster, especially on low-end hardware. |
At this point I was starting to investigate texture styleboxes generated by GDScript (since my app has customizable theme). It's just significantly more work to achieve almost the same thing^^ |
@Zylann I agree, there will be always problems in some edge cases with the current fake AA implementation. I'll spend a bit more time this week to see what kind of compromise I can find in order to avoid obvious glitches like the extra thin line you have in #35279, but at this point I think having blurry lines all around the borders are needed to handle more cases, including rotations. About AA in 2D: |
PR #35579 is a better take on this issue, it has no regression on rotations. Closing this one. |
After multiple changes to the transparent drawing used for AA, it ended up being consistently applied all around the borders inside and outside, which is not the intended behavior. This change makes sure border flat sides are solid instead of blurry.
Fixes #35279