y4my4my4m / kde-shader-wallpaper

KDE / Plasma - Shader Wallpaper plugin
GNU General Public License v3.0
224 stars 12 forks source link

Suggestion: Optimisations for laptops and iGPUs #34

Closed Shoshele closed 7 months ago

Shoshele commented 1 year ago

I love this! Thank you so much for making it! One of the few things I miss from Windows is the ability to use Wallpaper Engine, specifically one of its built-in shaders which blows colourful circles across the screen. I've spent the weekend learning basic shader programming and recreating this wallpaper in a format compatible with kde-shader-wallpaper, and it's excellent, much better than the original since I can tune everything to perfection now.

However, I'm running a 4k120Hz monitor on a weak iGPU, and despite all the optimisations I can come up with, this wallpaper remains graphically intensive, pinning me at 100% load and significantly less than 120 frames per second. I also can't use it on my laptop because it would consume the battery very quickly.

I suggest adding a few optimisation features for laptops and lower-end hardware. First, a resolution cap. If I could render at 1080p instead of the native 4k, my iGPU wouldn't struggle, and my laptop would use significantly less battery. Shaders take an iResolution variable, so it should be relatively easy to add a slider to smoothly adjust down (or up) the resolution. Second, a frame cap. Many shaders could implement a motion blur and remain aesthetically pleasing with as little as 30 or even 15 frames per second. This would save a lot of resources. Third, the ability to trigger lower quality settings depending on whether a computer is currently connected to AC power or not, and even to pause rendering altogether if this is the case, like how the current "pause when a window is maximised" setting works.

I'm afraid I can't contribute this code myself, I don't have the skill, but I'll happily submit a pull request with my custom shader once I finish tuning it, if anyone is interested.

y4my4my4m commented 7 months ago

@Shoshele sorry for the delay, somehow i missed this. This should be possible yes.

You need to modify those two places and divide it by the factor of the downscale you want.

https://github.com/y4my4my4m/kde-shader-wallpaper/blob/e4d57e98e2ccd4639fe05d8f0468ac884eae686a/contents/ui/Components/ShaderEngine.qml#L25-L32

https://github.com/y4my4my4m/kde-shader-wallpaper/blob/e4d57e98e2ccd4639fe05d8f0468ac884eae686a/contents/ui/Components/ShaderEngine.qml#L246-L251

Those files can be found on your computer here: ~/.local/share/plasma/wallpaper/online.knowmad.shaderwallpaper

y4my4my4m commented 7 months ago

Duplicate of: https://github.com/y4my4my4m/kde-shader-wallpaper/issues/23