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

blur/rounded-corners: rewrite #68

Merged
merged 27 commits into from
Jun 17, 2024
Merged

blur/rounded-corners: rewrite #68

merged 27 commits into from
Jun 17, 2024

Conversation

taj-ny
Copy link
Owner

@taj-ny taj-ny commented May 9, 2024

This is a rewrite of the rounded corners implementation, which has much better-looking corners. There's probably a better way to do it, but for now that's the simplest and most efficient way of doing it that I can implement myself.

The corner radiuses are also now decimal values.

Comparison

The pictures were made in the worst possible situation: maximum blur strength with the corner being on a darker surface right next to a bright one.

Blur only (15px radius)

Before

1

After

No antialiasing:
2
0,5 antialiasing:
3

With window-rounding effects (15px radius)

KDE-Rounded-Corners

17px blur radius with 1 antialiasing
image
Couldn't get it to match perfectly, but it's definitely better than before.

LightlyShaders

14,75px blur radius with 0,5 antialiasing
image
Looks perfect.

To do

  • Blur is very often painted in the wrong position
  • Corners may not be rounded if Blur window decorations as well is disabled
  • Don't use the rounded corners shader to paint areas that don't intersect with any of the corners
  • Fake blur doesn't work properly
  • Very strong artifacts when using the Colorblindness Correction or Invert effects
  • Texture behind panels behaves in a weird way when using the Background Contrast effect
  • The shader may not work properly with small regions
  • Regions behind rounded corners aren't marked as translucent
  • Round corners using the blur region mask method when antialiasing is set to 0
  • Korners when using scaling on Wayland, caused by the texture size not being multiplied by the screen scale
  • Corners aren't rounded when the window is scaled (for example during the closing animation)
  • Noise texture doesn't move along the X axis anymore

@taj-ny taj-ny linked an issue May 9, 2024 that may be closed by this pull request
@taj-ny taj-ny linked an issue May 10, 2024 that may be closed by this pull request
@taj-ny taj-ny changed the title blur: improve rounded corners implementation blur/rounded-corners: rewrite May 10, 2024
@talentlessguy
Copy link

Sorry for off-topic, but what Window Decoration theme are you using here? I'm using SierraBreezeEnhanced window decoration and Lightly application style and I get artifacts coming from blur:

image

@taj-ny
Copy link
Owner Author

taj-ny commented May 13, 2024

I'm using Breeze with disabled titlebar. In your picture it looks like SierraBreezeEnhanced specifies its own blur region, which needs to be overridden by enabling Blur window decorations as well. The bottom corner appears to be rounded properly, but you'll need an effect that rounds the window as well, such as KDE-Rounded-Corners or LightlyShaders.

@talentlessguy
Copy link

talentlessguy commented May 13, 2024

@taj-ny what should be border radii in each of the components (LightlyShaders/SierraBreezeEnhanced/Lightly/Force Blur)? Should be all the same (ex. 8px)?

I enabled all of them and I still experience artifacts, but only for window titlebar

image
image
image

also Force blur together with LightlyShaders makes most apps blurry (see a-parhom/LightlyShaders#130)

@taj-ny
Copy link
Owner Author

taj-ny commented May 14, 2024

Go to force blur settings, enable Blur window decorations as well and keep adjusting the top corner radius until it looks fine.

Applications becoming blurry when using LightlyShaders/KDE-Rounded-Corners with scaling is a KWin bug.

@talentlessguy
Copy link

talentlessguy commented May 14, 2024

@taj-ny should I file a bug to KDE? How do I reproduce it properly? I mean without involving desktop effects directly (like via c++ or smth idk)

@taj-ny
Copy link
Owner Author

taj-ny commented May 18, 2024

@taj-ny should I file a bug to KDE? How do I reproduce it properly? I mean without involving desktop effects directly (like via c++ or smth idk)

It has already been reported. The bug report is about the Colorblindness Correction effect, but it's the same bug that affects LightlyShaders/KDE-Rounded-Corners.
https://bugs.kde.org/show_bug.cgi?id=482978

@taj-ny
Copy link
Owner Author

taj-ny commented May 18, 2024

I've fixed the low texture resolution issue when using scaling on Wayland, but sometimes its position is off by 1 pixel. A similar issue affects many effects, including Blur, Invert, Colorblindness Correction, LightlyShaders and KDE-Rounded-Corners. I guess I'm not going to bother fixing that for now and I'll just let users choose whether they want to use the old or the new rounded corners implementation.

EDIT: The issue described above will not occur when antialiasing is set to 0.

It's also interesting how even on 200% scaling the blur looks fine, even though the texture that's being blurred has a resolution that's two times smaller.

@taj-ny
Copy link
Owner Author

taj-ny commented Jun 15, 2024

There are some minor issues with antialiasing when using scaling on Wayland but other than that everything seems to be working perfectly. I'll probably make a release tomorrow.

Floating panels are now rounded correctly and non-floating panels aren't at all anymore.

@taj-ny taj-ny marked this pull request as ready for review June 17, 2024 17:00
@taj-ny taj-ny merged commit ea93497 into develop Jun 17, 2024
1 check passed
@taj-ny taj-ny deleted the better-rounded-corners branch June 17, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rounded corner effect doesn't work well on KDE-Rounded-Corners Fake blur image is upside down on X11
2 participants