-
Notifications
You must be signed in to change notification settings - Fork 152
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
Complete SukiBackground
rewrite.
#223
Conversation
Backgrounds are now localised entirely to their window and run entirely on the GPU via SkSL shaders.
Hi doombox ! These are great news. I tried it and it indeed seems to make some things smoother. Weirdly, popups like MenuItem seem to be much smoother. Isn't it possible to keep the old SukiBackground available as a possibility ? We can't overwrite the old background if we haven't something +/- exactly similar. Either we keep the old background as a possibility, and we add these new background options having time to polish it, or we need to ensure we have the same result as the old one before deleting it. Except that, the performance gain is super promising and as you said, it opens load of opportunity to use it elsewhere. |
I can spend some time trying to recreate the old version in shaders, but honestly the old version has only been available since the start of the preview of 6 so it's quite weird to call it the old version and it was never particularly good anyway in terms of appearance, the colours were always weird. It does sort of exist (the same sort of style) in the I think it's a bad idea to hold onto very bad legacy code that has never been out of preview, it's just more time and effort to maintain and the stack is completely different now which would increase complexity a lot trying to support both. The time would definitely be better spent improving on this new correct approach that is actually usable. The real main issue is that the stack is so completely different with the new rendering that trying to make it interchangeable with the old one would be quite difficult. I've tried a little to recreate the previous background in the gradient shader, but I'm actually struggling to make the colours "wrong" enough which is quite funny. |
I've adjusted the gradient shader so it's a bit closer to the old style gradient shader, but the colours are still not "wrong" enough so I'll need to have a think about that one. I also fixed a bug that slipped through where new windows weren't detecting the base theme correctly. |
I guess it's subjective, I think the legacy one is wonderful. But that's why it's a good idea to offer multiple possibilities then ! I tried to tweak the gradient and indeed I'm optimistic that I can recreate the legacy one. I think at the end we should have 3 possibilities. "Bubble", the current legacy one, "Flat" and "Gradient", which would be a softer gradient, maybe without bubble, just with primary color. Something like this maybe : I will try to tweak Gradient a little more for now, confirming I can recreate the Bubble one I like. So don't worry you don't have to do it for me 😵 |
One of the big issues I had with recreating the older version was finding a workable simplex noise function, which is what the old one relies on. Beyond that the code can (mostly) be recreated 1:1, but achieving the precise effect might be a little tricky. The good thing about this approach however is you can freely add new effects and all they cost is a few kb of a text file and another line in the enum for the "default" effects. Devs can also implement their own and use them very, very easily. Just thought I'd add a quick note here if you're trying to figure it out with trial and error, because the shaders are compiled at runtime, you can just set the shader via the |
Major Changes
SukiWindow
BackgroundStyle
for the default included ones,BackgroundShaderCode
which allows devs to directly supply an SkSL shader string andBackgroundShaderFile
which allows devs to give the filename of an embedded resource SkSL file to load and use. The properties take priority in the form File > Code > Style.SukiBackground
without theBackground
prefix.SukiBackground
control is now fast enough and generic enough to be used for other purposes, if you want to use it forGlassCard
it should be absolutely fine, I haven't stress tested it myself but I see no reason why it would be an issue.SukiBackground
fully supports transparency too, this can even be used in shaders for the window and will work as-expected.Minor changes
Important note
Outstanding issues
SukiBackground
/SukiWindow
now has an (essentially) entirely duplicated set of properties, but I think this is a worthwhile tradeoff to massively simplify the API for devs.ManagedFilePicker
currently just uses theFlat
style for it's background to simplify things.flat
shader doesn't look very good, it just uses the base color passed in instead of making any attempt to look nice - but as an option for people who want a simple non-busy background I think it's very valuable.iTime
,iResolution
,iBase
,iPrimary
, andiAccent
are all that are made available to devs, though this should be enough to produce any necessary effect there is some scope for additional data.