-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Static blur and rounding effect for dash-to-dock #533
Conversation
I think the same kind of static blur could be used for applications with rounded corners. |
Wow! Thank you very much! That is the single biggest external contribution I've ever gotten on this extension :) and the code seems very clean! I will test it thoroughly before merging this, and I think after merging I may try to allow the user to switch between "native blur effect" (which may be more efficient? but that's only a guess), "non-native blur effect" (this one, and then make the user choose the radius) and "dynamic blur effect" (native) when available; for each element! So this could be used for dash-to-dock, the panel (useful when users use a theme that has rounded panel), applications, and even (with some more work...) for popups and notifications! I have two little questions:
Again, thank you VERY much for your contribution, it is really a huge milestone for this extension!!! |
Some problems I found:
Some other points I will probably change:
Quite interestingly though, there does not seem to be any memory leak when destroying and re-creating the effects, so the second point in my previous comment should be OK! That's already a very big pain that is removed to be honest :) And the first point in my previous comment is not very important finally, because... that's already perfect if it works like that, there is no need to over-engineer it (as I usually do) :D |
I think I fixed the point 2.; but that's really a not very clean fix (and I don't know if it is reproducible): I simply shift the position of the center by 2 positive pixels (if it is an addition) or by 1 negative pixel (if it is a subtraction). I have no idea why this works, but this works so at least there is no more visual glitch. |
I fixed the point 5. too |
I also fixed various crashes, so with some testing I will see because this may fix 6. too (update: not fixed, this seems to happen sometimes when new windows are created) |
I've implemented the effects separately, because the blur effect needs two passes: vertical and horizontal. I've tried to merge them in one glsl shader, but failed. It seems, that the effect itself needs to be rewritten to work in one pass. Merging corner effect is not hard at all, though. It could be merged and applied after second pass, for example. I also don't know if there is significant difference in calling one effect with merged features instead of three calls. In KDE there is a special effect, that shows the GPU and CPU load when rendering frames. I'm not sure if something similar exists for GNOME, so the performance could be measured in some way. |
It looks like the point 4, that you have mentioned, occurs because the dimensions for the effects are not set correctly for some reason. Seems like we need to connect to some event and call update_size() method. |
Point 1: I've tried to do what you suggested, but it seems the problem is that Blyr shader works with maximum sigma value 30 (that is why I convert the value in blur_effect.js in sigma setter). And since it uses hardcoded weights, it seems to be hard to reimplement it (though I'm not an expert here). But I can try to implement the blur effect from Clutter. I'm not sure if it is possible in GJS, though, since it uses Clutter C API for some things. But I'll try to tinker with it. |
The shader itself from Clutter's blur effect works. It also needs two passes, but seems to work correctly with any sigmas. Also, Clutter downscales textures and sigmas to increase efficiency of the effect. I'll see if I can implement the downscaling as well, and also will try to make it act and look same as the native effect (point 1 from your second comment). |
Well, thank you very very much for your work! About what you said in your last point: downscaling would be pretty great, but I have no idea how to do it -- I tried multiple times to convert the An I will push the changes I did to your code today (mainly crash fixes and my formatter doing its job too), I hope this does not introduce conflicts with your repo! |
|
I haven't found a way to resize the texture like it is done in Clutter's blur effect: it creates another pipeline with smaller offscreen framebuffer and renders the texture there. I don't see any way to do this in GJS, at least for now. I've managed to get the image from actor's texture, but I don't think it can be useful in any way, because getting the image from GPU, resizing it by CPU and pushing it back is very inefficient process itself. In fact, it can introduce more lag, then the profit we will gain from the texture scaling approach. But I'll try to do what you mentioned in your point 1 with the shader from Clutter's blur effect and see if it can improve the looks and consistency of the blur. |
@@ -269,6 +269,11 @@ | |||
<default>false</default> | |||
<summary>Boolean, whether to disable blur from this component when opening the overview or not</summary> | |||
</key> | |||
<!-- CORNER RADIUS --> | |||
<key type="i" name="radius"> |
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.
FWIW, Gnome 46 will replace sigma
with radius
in blur APIs. I'm not sure if we are going to reserve the radius
key for Gnome 46+, or just keep the sigma key untouched, and assume radius = sigma * 2
. See #532 (comment)
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.
I think, we could use radius
for blur settings and corner_radius
for the rounding effect in GNOME 46.
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.
Yes! I think we should use corner_radius
and replace sigma
by radius
starting from GNOME 45, so that no change is required for it afterwards. Once this PR is merged, I will add the changes for GNOME 46 for the other blur effect!
I've replaced the shader, but failed to implement your recommendations from point 1. Maybe I'm doing it wrong. The code is all there, it's just disabled (the returned offsets are all 0), so you could try make it work properly. Also, blur_effect.js contains commented out part related to my experiments with getting texture from actor, in case it can be useful. Otherwise, fell free to remove it. The blur itself, even without implementing point 1, looks very similar to native blur, though. So I consider this as an improvement anyway. |
Sorry, I didn't run it through any code formatter, so the last commit may introduce new formatting issues. |
I've tried to fix issues with the Hide Top Bar extension and issues with blur position from RyzenDew's comment. Seems to work fine now, at least for me. |
I've merged the effects to one, kind of. The effect still needs two passes, so it adds the second instance of itself to the actor through overridden I've also managed to fix the enable/disable bug from point 4, as well as some more positioning bugs with custom shell themes. |
Looks like the only remaining big annoying issue is the styling one. I'll try to look into it this week. |
Thank you very much for your work! I will test it right now, and will push soon after prettifying this! For the styling bug, do you talk about the point 6.? I tried quite a lot to find the cause, to no avail for the moment... It seems like when it happens, the |
I'm talking about the point number 3. I'm getting darker background until I switch blur type back and forth. And it does not look like the dark style from the Override background switch in settings. Maybe, it is connected with the point 6 somehow. |
It works really well, thank you very much! I'm not getting bug 3 right now although I had it consistently before, so maybe something changed? I am not getting bug 6 either by the way, so nearly everything is fixed! I think it may be good to do some renaming:
I will do this, along with adding a scaling factor for the blur radius (so it becomes monitor-independent)! |
I think this is nearly finished! The bug 3. is kinda annoying, but it does not happen on my machine at all any more, and I don't think it is a huge blocker if it ever happens as there is an option (activated by default) which prevents the bug from happening at all anyway. What is your take on this? |
It looks like sigma is not updated in the static blur mode now. Edit: Also, looks like sigma value behaves differently for native blur and the static one now. |
Regarding point 3: I'm still having it, but maybe it is because I test in a virtual machine, or because my Ubuntu is on a development branch and is halfway updated to GNOME 46. If you can't reproduce it, then maybe it's just some weird corner case because of my configuration. |
Yes I'm sorry, I badly changed the behaviour. This should be corrected now! I get it for the issue 3, then I guess the best would be to merge this, and see if there is any issue that is opened on this topic. |
Looks good to me now. |
Me too! I merge this :) thank you so much for your contribution!! I will later try to offer the option to use this new blur effect for the panel, which would permit the use to use rounded corners for the panel too (so that floating panels would not be ugly!!) The main problem is that there is now possibility to have blur everywhere, so I have no valid excuse not to implement blur for notifications, popups, ... :D |
@a-parhom I have a little question: I've been trying to use this blur effect for the panel, but there seems to be a problem when I set the clipping of the image to be very close to its border. It looks like the pixels are counted as white (ie not counted) at the border; however this means using it for little blurred objects (eg the panel, which is less than a hundred pixels high) is not very adequate. Is it right? If so, I will try to tweak the effect to simply not count those pixels! |
Could you show me the code, please, or maybe, just a screenshot of the result, because I can not quite understand the problem. |
Of course! I began some dirty work on #539, and you should see that the panel blur is very "white" after using this code. De-commenting what I did in the GLSL shader (and commenting the 3 lines after it instead) should have fixed the bug if I understand the shader correctly, but it is not near good enough (for some reason the effect is somewhat transparent). I will try to fix this, but that's really not very important as it works for the dash which is the most important! It was just to ask you if I did something wrong using the effect :) |
I've tried to do it myself, and here is what I've found out: When I output with But when I output with So, it adds some empty pixels to the texture. Maybe it's a bug in Clutter, I don't know. |
Okay, thanks for the investigation! I will see what I can do about it, I have an idea to solve this problem (no time to implement it right now but this will come)!! |
I've implemented a workaround to the problem with additional empty pixels around the effect's texture in #540. In general it behaves good, but seems to suffer from the similar bug with transparency when the session starts or the blur type is switched. But as soon as any blur parameters are changed, the transparency gets to normal. This is weird, because the dash-to-dock blur does not suffer from that bug, despite using the same static effect with the fix for additional empty pixels in texture. |
I've added static blur from Blyr and a rounding efffect, based on Rounded WIndow Corners and LightlyShaders.
![Знімок екрана 2024-02-24 о 01 50 43](https://private-user-images.githubusercontent.com/13824167/307477654-be8216d7-621c-4c92-9f1a-c362a0e97128.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA4ODg0MzMsIm5iZiI6MTcyMDg4ODEzMywicGF0aCI6Ii8xMzgyNDE2Ny8zMDc0Nzc2NTQtYmU4MjE2ZDctNjIxYy00YzkyLTlmMWEtYzM2MmEwZTk3MTI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzEzVDE2Mjg1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJmYzdkN2VjYmU3MWM3MmFmYTVkMzYxYWI3NDA0MWE1YzUyOGQ0NWQ3NWE5NDhjOTRhYmI2ZWQxOTY0OWE0OGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.t49v5-2Cy-JjN-ngPop2CxefuhrslOFlpyQMpx-XDMM)
I've also added to dash-to-dock settings a switch to enable/disable static blur and a scale widget to set corner radius.
The result of using static blur with rounding effect is on the screenshot: