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

Aero Backdrop Update v2 #269

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Aero Backdrop Update v2 #269

merged 1 commit into from
Apr 24, 2024

Conversation

kfh83
Copy link
Contributor

@kfh83 kfh83 commented Apr 18, 2024

This PR should replicate Windows 7 aero shader a lot more closely than what we currently have, which is normal layer blended with a multiply layer with an exposure effect. This image should kinda explain how the chain works in Windows 7:

image

behaviors

sky-values
(win7 pics)

In practice, you won't notice much difference from what is currently in version 2.1.1, but given the changes, you should now be able to use values from Windows 7 as the behavior is pretty much completely accurate:

[config.aero]
ColorizationColorBalance=8.0
ColorizationAfterglowBalance=43.0
ColorizationBlurBalance=49.0

(settings relevant for the Sky color)

Thus eliminating the need of any guesswork of sorts to get accurate settings. Since this also removes the need of the exposure effect, it should also fix inactive brightening up anthing behind the window as opposted to relying on additive blending to do that:

image
image
image

Here's some comparison images between Windows 7 and the new shader (7 are the 2 top windows, 10 on bottom):

Sky
image

Pumpkin
image

Ruby
image

Fuchsia
image

Violet
image

EXTRA: For those nitpicky enough, you probably noticed how the current shader looks too bright with the Sky color on the Harmony wallpaper. Here's what the new one looks like:

Windows 10, new shader
image

Windows 10, current shader
image

Windows 7
image

Windows 10, new shader
image

Windows 10, old shader
image

You should notice it looks darker now.

The only issues i know of is it sometimes fails to apply properly to the taskbar, resulting in a monochromatic backdrop due to only the ColorizationAfterglow layer being present. This was already in 2.1.1, but it's more apparent here. When windows open/close you can see the backdrop becoming completely opaque/black:

Said issue in the new shader. I think it's opaque like this because of the way im doing the balances (blending with a completely solid black backdrop).
image

If anyone wants to test, here's a binary and relevant values for the default W7 colors:
DWMBlurGlassExt.zip

Windows 7 Default color codes for DWMBlurGlass
Color name (#OriginalvalueinAARRGGBB) - ValueConvertedToAABBGGRRInBase10

Sky (#74B8FC) - 4294752372
Twilight (#0046AD) - 4289545728
Sea (#32CDCD)- 4291677490
Leaf (#14A600) - 4278232596
Lime (#97D937) - 4281850263
Sun (#FADC0E) - 4279164154
Pumpkin (#FF9C00)- 4278230271
Ruby (#CE0F0F) - 4279177166
Fuchsia (#FF0099) - 4288217343
Blush (#FCC7F8) - 4294494204
Violet (#6E3BA1) - 4288756590
Lavender (#8D5A94) - 4287912589
Taupe (#98844C) - 4283204760
Chocolate (#4F1B1B) - 4279966543
Slate (#555555) - 4283782485
Frost (#FCFCFC) - 4294769916

Windows 7 Default color values from Winaero Tweaker
Color name - (ColorizationColorBalance, ColorizationAfterglowBalance, ColorizationBlurBalance)

Sky - (8, 43, 49)
Twilight - (56, 11, 33)
Sea - (24, 32, 44)
Leaf - (5, 45, 50)
Lime - (5, 45, 50)
Sun - (5, 35, 60)
Pumpkin - (24, 32, 44)
Ruby - (56, 11, 33)
Fuchsia - (5, 45, 50)
Blush - (12, 40, 48)
Violet - (29, 29, 42)
Lavender - (5, 34, 61)
Taupe - (5, 45, 50)
Chocolate - (56, 11, 33)
Slate - (24, 32, 44)
Frost - (5, 35, 60)

Keep in mind, you'll have to replace:

[config.aero]
activeColorBalance=0.000000
inactiveColorBalance=0.000000
activeBlurBalance=0.000000
inactiveBlurBalance=0.000000

in your current config.ini with:

[config.aero]
ColorizationColorBalance=0.0
ColorizationAfterglowBalance=0.0
ColorizationBlurBalance=0.0

Finally, thanks 2 @TorutheRedFox for the lead on using Additive layering, @WackyIdeas for helping me figure out how the blur layer behaves on active/inactive and @aubymori for helping me get this thing working.

@7kt4
Copy link
Contributor

7kt4 commented Apr 23, 2024

Nice work, but two major problems:

  1. This version breaks StartIsBack coloring the taskbar
    2:
ezgif-7-f283fa9057.mp4

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

Nice work, but two major problems:

1. This version breaks StartIsBack coloring the taskbar
   2:

ezgif-7-f283fa9057.mp4

It doesn't break StartIsBack colorization, restart explorer and you'll see it'll go back to working normally. This is due to some form of unreliability in overrideaccent, and this issue was already present in 2.1.1 albeit less noticeable (the normal layer would be missing). As for the windows animating, i literally have no way of fixing this, and again, it was also present in 2.1.1 albeit much less noticeable. (not only that i literally mention these issues on the pr but thanks for visualizing them better?)

2024-04-23.05-04-34.mp4

It seems it's as if only one layer is being rendered if you start DWMBlurGlass after explorer (ColorizationAfterglowRender).

Also for anyone who notices the low framerate on the taskbar, this is a DComp limitation which cannot be fixed unless @ALTaleX531 switches to a shader written in some other framework of sorts. You can also notice this if you have a window on top of all.

@TheInsane101
Copy link

TheInsane101 commented Apr 23, 2024

It doesn't break StartIsBack colorization, restart explorer and you'll see it'll go back to working normally. This is due to some form of unreliability in overrideaccent, and this issue was already present in 2.1.1 albeit less noticeable (the normal layer would be missing). As for the windows animating, i literally have no way of fixing this, and again, it was also present in 2.1.1 albeit much less noticeable. (not only that i literally mention these issues on the pr but thanks for visualizing them better?)

It seems it's as if only one layer is being rendered if you start DWMBlurGlass after explorer (ColorizationAfterglowRender).

What's interesting is that in the current 2.1.1 version, the solid colour shows the actual accent colour and not the dark colour during the animation, which allows it to blend better with the colour config chosen in the first place, which is why it's less noticeable than with your version.

2024-04-23.10-33-32.mp4

Also, could you please give the new opacity settings for active and inactive windows for the new config?

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

It doesn't break StartIsBack colorization, restart explorer and you'll see it'll go back to working normally. This is due to some form of unreliability in overrideaccent, and this issue was already present in 2.1.1 albeit less noticeable (the normal layer would be missing). As for the windows animating, i literally have no way of fixing this, and again, it was also present in 2.1.1 albeit much less noticeable. (not only that i literally mention these issues on the pr but thanks for visualizing them better?)

It seems it's as if only one layer is being rendered if you start DWMBlurGlass after explorer (ColorizationAfterglowRender).

What's interesting is that in the current 2.1.1 version, the solid colour shows the actual accent colour and not the dark colour during the animation, which allows it to blend better with the colour config chosen in the first place, which is why it's less noticeable than with your version.
2024-04-23.10-33-32.mp4

Also, could you please give the new opacity settings for active and inactive windows for the new config?

You mean separate config entries for active/inactive?

@TheInsane101
Copy link

TheInsane101 commented Apr 23, 2024

You mean separate config entries for active/inactive?

Yes, in Vruh's version, there were opacity values for active and inactive, which you just added after adding the colour.
Here's the relevant part in the instructions for translating Vruh's 2.0.1 fork's config values to 2.1.1's:
image

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

You mean separate config entries for active/inactive?

Yes, in Vruh's version, there were opacity values for active and inactive, which you just added after adding the colour. Here's the relevant part in the instructions for translating Vruh's 2.0.1 fork's config values to 2.1.1's: image

well im vruh and im confused
but the new shader should correctly account for inactive windows the same way Windows 7 does

@ALTaleX531
Copy link
Collaborator

Also for anyone who notices the low framerate on the taskbar, this is a DComp limitation which cannot be fixed unless @ALTaleX531 switches to a shader written in some other framework of sorts. You can also notice this if you have a window on top of all.

After a simple research on dwmcore I found that this seems to be solved by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\BackdropBlurCachingThrottleMs to zero.
image
However, the strange thing is that dwmcore seems to ignore that registry item and only takes effect when I write the value directly to that variable.

For those of you who like to explore new things, you can give it a try. I've been very busy lately and I may not be able to respond to you guys in time.

@7kt4
Copy link
Contributor

7kt4 commented Apr 23, 2024

So why this version has the opening animations issue 200x worse than the latest release?

@kfh83 kfh83 closed this Apr 23, 2024
@kfh83 kfh83 reopened this Apr 23, 2024
@7kt4
Copy link
Contributor

7kt4 commented Apr 23, 2024

Well, how did it start happening in this revision ? The steps that you took should be retraced until it is found.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

So why this version has the opening animations issue 200x worse than the latest release?

I think it can't render more than one effect while animating as of right now, @ALTaleX531 told me AcrylicEverywhere has fixes for this but i couldn't get my shader to work properly on it as AcrylicEverywhere just crashes DWM everytime i try to interact with Windows

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

Well, how did it start happening in this revision ? The steps that you took should be retraced until it is found.

This started literally with the first fork i did (and 2.1.1 is pretty much akin to that), and that was based on @ALTaleX531's code, like i said it probably can't render more than one effect and this update (and 2.1.1) involves a LOT of layers to achieve the effect

The dark taskbar bug is also another example of only one of the layers being present, namely the ColorizationAfterglow one. I'm not experienced with C++ or DWMBlurGlass' source tree/code at all and ESPECIALLY the code that handles overriding accents, so i couldn't tell you where to start fixing this, i'll leave it to @ALTaleX531 to build upon this PR and hopefully fix these issues for the next release.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

So why this version has the opening animations issue 200x worse than the latest release?

I think it can't render more than one effect while animating as of right now, @ALTaleX531 told me AcrylicEverywhere has fixes for this but i couldn't get my shader to work properly on it as AcrylicEverywhere just crashes DWM everytime i try to interact with Windows

Apparently it was a bad Windhawk mod causing AcrylicEverywhere to crash. As you can see on the video below, the issue is partially fixed except for windows closing/minimizing:

2024-04-23.17-02-21.mp4

also less notably, the dark taskbar bug does not happen here if you inject AcrylicEverywhere after explorer is started

@TheInsane101
Copy link

TheInsane101 commented Apr 23, 2024

In practice, you won't notice much difference from what is currently in version 2.1.1, but given the changes, you should now be able to use values from Windows 7 as the behavior is pretty much completely accurate:

[config.aero]
ColorizationColorBalance=8.0
ColorizationAfterglowBalance=43.0
ColorizationBlurBalance=49.0

(settings relevant for the Sky color)

Thus eliminating the need of any guesswork of sorts to get accurate settings. Since this also removes the need of the exposure effect, it should also fix inactive brightening up anthing behind the window as opposted to relying on additive blending to do that:

This is AMAZING! I am beyond impressed how hard you worked and what you accomplished with the Aero accuracy! The entire theming community should be proud of you!

I'm wondering, how hard will it be to figure out how Windows Vista's Aero works (since it is different from 7's) and its subsequent colour values?

@TheInsane101
Copy link

well im vruh and im confused

Oh sorry lmao I didn't realise because your username is so different!

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 23, 2024

In practice, you won't notice much difference from what is currently in version 2.1.1, but given the changes, you should now be able to use values from Windows 7 as the behavior is pretty much completely accurate:

[config.aero]
ColorizationColorBalance=8.0
ColorizationAfterglowBalance=43.0
ColorizationBlurBalance=49.0

(settings relevant for the Sky color)

Thus eliminating the need of any guesswork of sorts to get accurate settings. Since this also removes the need of the exposure effect, it should also fix inactive brightening up anthing behind the window as opposted to relying on additive blending to do that:

This is AMAZING! I am beyond impressed how hard you worked and what you accomplished with the Aero accuracy! The entire theming community should be proud of you!

I'm wondering, how hard will it be to figure out how Windows Vista's Aero works (since it is different from 7's) and its subsequent colour values?

Vista's colorization is very simple, it's basically just a semi transparent color over the blur layer, and it's 50% of active for inactive windows. Basically what the shader was like before all of the updates (2.0.1)

@TheInsane101
Copy link

Vista's colorization is very simple, it's basically just a semi transparent color over the blur layer, and it's 50% of active for inactive windows. Basically what the shader was like before all of the updates (2.0.1)

Oh wow! Is the opacity of the active always 100%, or does it depend on the colour preset/config? Could you pls grab the default colour values from Vista (Sky, Graphite, Blue, Teal, Red, Orange, Pink, Frost) or explain how to find them ourselves?

@WackyIdeas
Copy link

Could you pls grab the default colour values from Vista (Sky, Graphite, Blue, Teal, Red, Orange, Pink, Frost) or explain how to find them ourselves?

Here you go, I remember finding these values some time ago through regedit but I forgot where exactly, I think it's the same as in Win7. The values here are represented in the #AARRGGBB format.

Name Value
Default #45409efe
Graphite #a3000000
Blue #a8004ade
Teal #82008ca5
Red #9cce0c0f
Orange #a6ff7700
Pink #49f93ee7
Frost #cceff7f7

@Maplespe
Copy link
Owner

Maplespe commented Apr 24, 2024

Now active and inactive windows share a common parameter?
I noticed that previously inactive and active windows used different Balance parameters.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 24, 2024

Now active and inactive windows share a common parameter? I noticed that previously inactive and active windows used different Balance parameters.

Yes, i made it so you only have to set the 3 parameters in config.aero and made it use Windows 7 value calculations for inactive windows. Of course, you could make this an "Auto" ui toggle and bring back the separate inactive values (auto toggle would switch between custom inactive values or automatic value calculation like we have in this PR), but this is how im doing it

@Maplespe Maplespe merged commit 7f05b85 into Maplespe:master Apr 24, 2024
@TheInsane101
Copy link

Could you pls grab the default colour values from Vista (Sky, Graphite, Blue, Teal, Red, Orange, Pink, Frost) or explain how to find them ourselves?

Here you go, I remember finding these values some time ago through regedit but I forgot where exactly, I think it's the same as in Win7. The values here are represented in the #AARRGGBB format.
Name Value
Default #45409efe
Graphite #a3000000
Blue #a8004ade
Teal #82008ca5
Red #9cce0c0f
Orange #a6ff7700
Pink #49f93ee7
Frost #cceff7f7

Oh thank you! Are the active and inactive opacity values the same for all of them? 100% and 50% or something else?

@TheInsane101
Copy link

TheInsane101 commented Apr 24, 2024

Vista's colorization is very simple, it's basically just a semi transparent color over the blur layer, and it's 50% of active for inactive windows. Basically what the shader was like before all of the updates (2.0.1)

Vista's blur also looks more like box blur. Is it true that it uses box blur instead of Gaussian blur?

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 24, 2024

Could you pls grab the default colour values from Vista (Sky, Graphite, Blue, Teal, Red, Orange, Pink, Frost) or explain how to find them ourselves?

Here you go, I remember finding these values some time ago through regedit but I forgot where exactly, I think it's the same as in Win7. The values here are represented in the #AARRGGBB format.
Name Value
Default #45409efe
Graphite #a3000000
Blue #a8004ade
Teal #82008ca5
Red #9cce0c0f
Orange #a6ff7700
Pink #49f93ee7
Frost #cceff7f7

Oh thank you! Are the active and inactive opacity values the same for all of them? 100% and 50% or something else?

Now, you shouldn't be using this in this PR's shader, so go back to 2.1.1 and set your COLOR OPACITY in the gui to 0% on both active and inactive, set blur balances to 0 and take note of the color you choose's hex values, its in AARRGGBB. Take the AA and convert that into % somehow and stick it in the active color balance, then do 50% of that and put it on inactive.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 24, 2024

Vista's colorization is very simple, it's basically just a semi transparent color over the blur layer, and it's 50% of active for inactive windows. Basically what the shader was like before all of the updates (2.0.1)

Vista's blur also looks more like box blur. Is it true that it uses box blur instead of Gaussian blur?

Not only vista's but 7's blur looks more pixelated. That's all i know about it.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 24, 2024

On another note, now that this is merged expect a lot more issues about the animations being sketchy

@ALTaleX531
Copy link
Collaborator

bandicam.2024-04-25.21-05-17-770.mp4

I just finished optimizing @kfh83's shader and now it will look more animation friendly and the implementation code is much shorter. Anyone who wants to give it a try can try compiling AcrylicEverywhere, which hardcodes Windows 7 Sky colors by default and doesn't include the mentioned animation fixes, so you can see more clearly how the animations are optimized.

@aubymori
Copy link

Because of all this talk about animations, I feel this would fit: we need to find a way to unhide the glyphs during animations, 7 didn't do that and it looks really off-putting.

@TheInsane101
Copy link

@kfh83 At what opacity do I set SIB's taskbar and start menu for this new 2.1.2 shader?

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 25, 2024

@kfh83 At what opacity do I set SIB's taskbar and start menu for this new 2.1.2 shader?

Same as 2.1.1, match up color and opacity with your DWMBlurGlass GUI settings

@aubymori
Copy link

Also for anyone who notices the low framerate on the taskbar, this is a DComp limitation which cannot be fixed unless @ALTaleX531 switches to a shader written in some other framework of sorts. You can also notice this if you have a window on top of all.

After a simple research on dwmcore I found that this seems to be solved by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\BackdropBlurCachingThrottleMs to zero. image However, the strange thing is that dwmcore seems to ignore that registry item and only takes effect when I write the value directly to that variable.

For those of you who like to explore new things, you can give it a try. I've been very busy lately and I may not be able to respond to you guys in time.

Wrote up a quick Windhawk mod that sets this value.

// ==WindhawkMod==
// @id              dcomp-unlocker
// @name            DComp Unlocker
// @description     Removes the backdrop blur cache throttling allowing for high FPS blur on taskbar with DWMBG
// @version         1.0.0
// @author          aubymori
// @github          /~https://github.com/aubymori
// @include         dwm.exe
// @architecture    x86-64
// ==/WindhawkMod==

#include <windhawk_utils.h>

__int64 orig_backdropBlurCachingThrottleQPCTimeDelta = 0;
__int64 *m_backdropBlurCachingThrottleQPCTimeDelta = nullptr;

const WindhawkUtils::SYMBOL_HOOK hooks[] = {
    {
        {
            L"private: static unsigned __int64 CCommonRegistryData::m_backdropBlurCachingThrottleQPCTimeDelta"
        },
        &m_backdropBlurCachingThrottleQPCTimeDelta,
        nullptr,
        false
    }
};

BOOL Wh_ModInit(void)
{
    HMODULE hDwmCore = LoadLibraryW(L"dwmcore.dll");
    if (!hDwmCore)
    {
        Wh_Log(L"Failed to load dwmcore.dll");
        return FALSE;
    }

    if (!WindhawkUtils::HookSymbols(
        hDwmCore,
        hooks,
        ARRAYSIZE(hooks)
    ))
    {
        Wh_Log(L"Failed to find CCommonRegistryData::m_backdropBlurCachingThrottleQPCTimeDelta in dwmcore.dll");
        return FALSE;
    }
    
    if (m_backdropBlurCachingThrottleQPCTimeDelta)
    {
        orig_backdropBlurCachingThrottleQPCTimeDelta = *m_backdropBlurCachingThrottleQPCTimeDelta;
        *m_backdropBlurCachingThrottleQPCTimeDelta = 0;
    }

    return TRUE;
}

void Wh_ModUninit(void)
{
    if (m_backdropBlurCachingThrottleQPCTimeDelta && orig_backdropBlurCachingThrottleQPCTimeDelta)
    {
        *m_backdropBlurCachingThrottleQPCTimeDelta = orig_backdropBlurCachingThrottleQPCTimeDelta;
    }
}

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 25, 2024

And a special shout out to the Windows Legacy Server Discord server! Ol' Pop really brightens my day. To the brig ye shall go! Call me later winclient5270!!!

P.S: I think Spongebob is reeeeeeeally funny! OH! COULDN'T FORGET TO MENTION JORDAN BASKETBALL PETERSON!
image

@ImSwordQueen
Copy link

WLS space cowboys

@docrR
Copy link

docrR commented Apr 26, 2024

And a special shout out to the Windows Legacy Server Discord server! Ol' Pop really brightens my day. To the brig ye shall go! Call me later winclient5270!!!

P.S: I think Spongebob is reeeeeeeally funny! OH! COULDN'T FORGET TO MENTION JORDAN BASKETBALL PETERSON! image

bus

@7kt4
Copy link
Contributor

7kt4 commented Apr 26, 2024

bandicam.2024-04-25.21-05-17-770.mp4
I just finished optimizing @kfh83's shader and now it will look more animation friendly and the implementation code is much shorter. Anyone who wants to give it a try can try compiling AcrylicEverywhere, which hardcodes Windows 7 Sky colors by default and doesn't include the mentioned animation fixes, so you can see more clearly how the animations are optimized.

Wow finally someone fixed the issue of double painting the top half of the window when the blur covers a large area. Great work you and vruh

@7kt4
Copy link
Contributor

7kt4 commented Apr 26, 2024

bandicam.2024-04-25.21-05-17-770.mp4
I just finished optimizing @kfh83's shader and now it will look more animation friendly and the implementation code is much shorter. Anyone who wants to give it a try can try compiling AcrylicEverywhere, which hardcodes Windows 7 Sky colors by default and doesn't include the mentioned animation fixes, so you can see more clearly how the animations are optimized.

Hmm, glass still double painting for me...i wonder why it didnt double paint in your demonstration

image

@TheInsane101
Copy link

@kfh83 At what opacity do I set SIB's taskbar and start menu for this new 2.1.2 shader?

Same as 2.1.1, match up color and opacity with your DWMBlurGlass GUI settings

Except the new shader doesn't indicate what the opacity should be. In 2.1.1, you said the opacity is the value of the SecondaryColorBalance; is it the ColorizationColorBalance value this time?

Also, Idk if I'm applying the new Ext.dll properly. I replaced the file, but when I apply a 2.1.2 config, DWMBG converts it back into 2.1.1 values. Is this normal?

2024-04-26.08-51-50.mp4

@Maplespe
Copy link
Owner

Also for anyone who notices the low framerate on the taskbar, this is a DComp limitation which cannot be fixed unless @ALTaleX531 switches to a shader written in some other framework of sorts. You can also notice this if you have a window on top of all.

After a simple research on dwmcore I found that this seems to be solved by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\BackdropBlurCachingThrottleMs to zero. image However, the strange thing is that dwmcore seems to ignore that registry item and only takes effect when I write the value directly to that variable.

For those of you who like to explore new things, you can give it a try. I've been very busy lately and I may not be able to respond to you guys in time.

Also for anyone who notices the low framerate on the taskbar, this is a DComp limitation which cannot be fixed unless @ALTaleX531 switches to a shader written in some other framework of sorts. You can also notice this if you have a window on top of all.

After a simple research on dwmcore I found that this seems to be solved by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\BackdropBlurCachingThrottleMs to zero. image However, the strange thing is that dwmcore seems to ignore that registry item and only takes effect when I write the value directly to that variable.
For those of you who like to explore new things, you can give it a try. I've been very busy lately and I may not be able to respond to you guys in time.

Wrote up a quick Windhawk mod that sets this value.

// ==WindhawkMod==
// @id              dcomp-unlocker
// @name            DComp Unlocker
// @description     Removes the backdrop blur cache throttling allowing for high FPS blur on taskbar with DWMBG
// @version         1.0.0
// @author          aubymori
// @github          /~https://github.com/aubymori
// @include         dwm.exe
// @architecture    x86-64
// ==/WindhawkMod==

#include <windhawk_utils.h>

__int64 orig_backdropBlurCachingThrottleQPCTimeDelta = 0;
__int64 *m_backdropBlurCachingThrottleQPCTimeDelta = nullptr;

const WindhawkUtils::SYMBOL_HOOK hooks[] = {
    {
        {
            L"private: static unsigned __int64 CCommonRegistryData::m_backdropBlurCachingThrottleQPCTimeDelta"
        },
        &m_backdropBlurCachingThrottleQPCTimeDelta,
        nullptr,
        false
    }
};

BOOL Wh_ModInit(void)
{
    HMODULE hDwmCore = LoadLibraryW(L"dwmcore.dll");
    if (!hDwmCore)
    {
        Wh_Log(L"Failed to load dwmcore.dll");
        return FALSE;
    }

    if (!WindhawkUtils::HookSymbols(
        hDwmCore,
        hooks,
        ARRAYSIZE(hooks)
    ))
    {
        Wh_Log(L"Failed to find CCommonRegistryData::m_backdropBlurCachingThrottleQPCTimeDelta in dwmcore.dll");
        return FALSE;
    }
    
    if (m_backdropBlurCachingThrottleQPCTimeDelta)
    {
        orig_backdropBlurCachingThrottleQPCTimeDelta = *m_backdropBlurCachingThrottleQPCTimeDelta;
        *m_backdropBlurCachingThrottleQPCTimeDelta = 0;
    }

    return TRUE;
}

void Wh_ModUninit(void)
{
    if (m_backdropBlurCachingThrottleQPCTimeDelta && orig_backdropBlurCachingThrottleQPCTimeDelta)
    {
        *m_backdropBlurCachingThrottleQPCTimeDelta = orig_backdropBlurCachingThrottleQPCTimeDelta;
    }
}

No additional mods or modifications are required.
Just modify the registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\DWM\BackdropBlurCachingThrottleMs
Just set it to 0. If not, create a DWORD item.

The difference is in replacing HKEY_CURRENT_USER with HKEY_LOCAL_MACHINE.
Because dwm does not have permission to read user content.

After that restart dwm.exe to take effect.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 26, 2024

bandicam.2024-04-25.21-05-17-770.mp4
I just finished optimizing @kfh83's shader and now it will look more animation friendly and the implementation code is much shorter. Anyone who wants to give it a try can try compiling AcrylicEverywhere, which hardcodes Windows 7 Sky colors by default and doesn't include the mentioned animation fixes, so you can see more clearly how the animations are optimized.

Hmm, glass still double painting for me...i wonder why it didnt double paint in your demonstration

image

This is because of the way we do highlights in the window frame. Since dwm hasn't supported these since some beta version of Win8, we have to "bake" them into the actual window frame. If you're using the regular non-shiny variant of Vaporvance's Aero10 you'll notice how the top half of the window doesn't have such issue.

@kfh83
Copy link
Contributor Author

kfh83 commented Apr 26, 2024

@kfh83 At what opacity do I set SIB's taskbar and start menu for this new 2.1.2 shader?

Same as 2.1.1, match up color and opacity with your DWMBlurGlass GUI settings

Except the new shader doesn't indicate what the opacity should be. In 2.1.1, you said the opacity is the value of the SecondaryColorBalance; is it the ColorizationColorBalance value this time?

Also, Idk if I'm applying the new Ext.dll properly. I replaced the file, but when I apply a 2.1.2 config, DWMBG converts it back into 2.1.1 values. Is this normal?
2024-04-26.08-51-50.mp4

Oh wait i forgot i literally did away with the opacity slider having any real use in the GUI, just set your SIB opacity to match your "ColorizationAfterglowBalance" value. So, if you have ColorizationAfterglowBalance=43.0 , set your SIB opacity to 43%. Also, when you save something in the GUI it does write the old settings, im not sure why that is but it doesn't really affect in anything since it'll still be taking from the 3 new ones, not the old ones.

@TheInsane101
Copy link

Oh wait i forgot i literally did away with the opacity slider having any real use in the GUI, just set your SIB opacity to match your "ColorizationAfterglowBalance" value. So, if you have ColorizationAfterglowBalance=43.0 , set your SIB opacity to 43%. Also, when you save something in the GUI it does write the old settings, im not sure why that is but it doesn't really affect in anything since it'll still be taking from the 3 new ones, not the old ones.

Oh awesome! Thanks!

@TheInsane101
Copy link

TheInsane101 commented May 5, 2024

@kfh83 I'm curious; do you know what property of Aero that the Intensity slider in the Windows Vista and 7 colours CPL page modifies? And does it function differently in Vista compared to 7?

@WackyIdeas
Copy link

@TheInsane101 #195 has more details on this but in short, on Windows Vista it seems to only affect the alpha value of ColorizationColor, as Vista doesn't have a particularly complex blending algorithm, so it only needs the alpha component. The alpha values are within the range [1a, d9] for both Vista and 7. On 7 however the intensity slider also affects the balances for the primary, secondary and blur layer.

I'm unsure if the alpha value has any real meaning or use in Windows 7 itself, they could very well be just a leftover from Vista, but even so you can draw a correlation between the alpha value from ColorizationColor and the other three balance values.

@kfh83
Copy link
Contributor Author

kfh83 commented May 5, 2024

@kfh83 I'm curious; do you know what property of Aero that the Intensity slider in the Windows Vista and 7 colours CPL page modifies? And does it function differently in Vista compared to 7?

There's a good chance it just modifies the 3 balance values directly in DWM (and when you save, the registry), but as @WackyIdeas said, it also affects the alpha value in the ColorizationColor/Afterglow value, which i'm fairly certain is just a vista leftover as it had an effect in that os but not in Windows 7. As @WackyIdeas also said, you can make an algorithm that comes up with the values for the 3 other balances based on the alpha value of ColorizationColor, but i have also found out that the intensity slider in windows 10 is actually completely non-functional and does nothing, so there is no way to determine anything off that. On top of that, ColorizationColor (as far as DWM is concerned) is a 00RRGGBB value now, not AARRGGBB, so if you try to fetch the alpha value from DWM you'll just get a completely transparent color.

Since Vista only had a ColorizationColor value and no balances (Vista had no advanced blending effects of sorts that got introduced with 7), the intensity slider only affects the alpha of the ColorizationColor value in registry.

@TheInsane101
Copy link

Thank you so much for your explanations, @kfh83 and @WackyIdeas ! How did you figure out how all of these elements work, @kfh83 ?

@Maplespe Maplespe mentioned this pull request Nov 27, 2024
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.

9 participants