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

Incorporation of Microsoft Fluent Design Acrylic effect #66

Open
Samuel12321 opened this issue Sep 29, 2020 · 38 comments
Open

Incorporation of Microsoft Fluent Design Acrylic effect #66

Samuel12321 opened this issue Sep 29, 2020 · 38 comments
Labels
Help Wanted Extra attention is needed UI/UX Related to appearance of the app and flyout.
Milestone

Comments

@Samuel12321
Copy link
Member

Samuel12321 commented Sep 29, 2020

Review from store:

"Hello! Another fine addition in my Microsoft Store apps collection! I wish the music flyout would have been more "fluent-ish", featuring Microsoft Fluent Design. For now, it feels like more similar to Google Material Design for Chrome/Android."

has also been 2 similar reviews

"This app so good. But I hope you update with fluent reveal effect and blurry transparency flyout"

@Samuel12321 Samuel12321 added MS Store Feedback Enhancement New feature or request labels Sep 29, 2020
@ShankarBUS
Copy link
Member

"Reveal effect" - not a big deal (could be easily done using RadialGradientBrush)
"Acrylic effect" - exploring the possibilities

I don't really get what the mean by "Fluent Design" or "Material Design". Our app not even a bit looks like "Material Design"

Material Design In XAML
Material Design In XAML

Fluent Design - ModernWpf
Fluent Design - ModernWpf

Ours look somewhat similar to MS Edge. Those two effects are just a small part of "Fluent Design"

The new Xbox store app has acrylic but it looks completely diverged from "Fluent Design"

The new Xbox Store
The new Xbox Store

Even MS doesn't know what "Fluent Design" means

I tried to align to this as much I can

Windows 10X SMTC panel
Windows 10X SMTC panel

ModernFlyouts

So all that matters is the fancy "Acrylic" effect 😂😟

@ShankarBUS
Copy link
Member

Hey Guys!

I want some design ideas/suggestions for future releases. I have uploaded the design to Figma - https://www.figma.com/file/Gq5AKs5k8lOl0rmDjQeXT2/ModernFlyouts

This is the Current Design :

ModernFlyouts_Mockup_Current

Some one in the MS Store review suggested an option to hide the thumbnail on the background. This is how it would look like:

ModernFlyouts_Mockup_NoThumnail

Hey @Samuel12321, @Poopooracoocoo, @Cyberdroid1

Can you guys make mockups/give some suggestions of the design you'd like

What should we do regarding #6, #49, #54, #60?

@ShankarBUS
Copy link
Member

This is how our flyout will look like if it had the fancy "Acrylic" effect

image

@ShankarBUS ShankarBUS self-assigned this Oct 1, 2020
@YanovskyOr
Copy link

This is how our flyout will look like if it had the fancy "Acrylic" effect

image

PLEASE MAKE THIS HAPPEN 🙏

@Samuel12321
Copy link
Member Author

This is how our flyout will look like if it had the fancy "Acrylic" effect

image

Looks Amazing😊
I still think it would look better and follow Win10X design better if it had the small space between the media and volume flyouts.

@ShankarBUS
Copy link
Member

ShankarBUS commented Oct 2, 2020

@Samuel12321,

Looks Amazing😊

It's just a mock-up though 😁

I still think it would look better and follow Win10X design better if it had the small space between the media and volume flyouts.

Like how it previously was?

I was having some troubles with showing shadows. They were casting on the one above. So, I had to change the design to host all the contents on a single shadow chrome.

We can reconsider this gap proposal after we implement acrylic successfully.

I kind of found a way to have acrylic in WPF (with custom blur radius, custom effects, custom shape not rectangle only and finally it doesn't lag while dragging)

But I don't know how we're are going to compose the WPF content over the acrylic. It would take some though. Maybe post v0.9?

@Poopooracoocoo
Copy link
Contributor

Poopooracoocoo commented Oct 2, 2020

and finally it doesn't lag while dragging

isn't that a bug that Windows introduced though?

@ShankarBUS
Copy link
Member

Yes, it will happen if we used SetWindowCompositionAttribute and ACCENT_ENABLE_ACRYLICBLURBEHIND.

I used the "Visual Layer" (aka Windows.UI.Composition APIs) and make a impl of acrylic brush myself.

Only hard thing is that, we have to build the acrylic brush from the base like how WinUI does (Backdrop Brush -> Gaussian Blur -> Noise -> Tint -> Luminosity)

And the window should be border less and transparent with no content in it. The Composition APIs will render atop of the window (over the WPF content) but they don't block input. I'm confused about the implementation process.

Acrylic

I don't know if hosting a child window will tackle this. Will report to you once done

@Poopooracoocoo
Copy link
Contributor

I think TranslucentTB has some work in that area. Might be worth checking that out.

@ShankarBUS
Copy link
Member

ShankarBUS commented Oct 2, 2020

Seems like they use SetWindowCompositionAttribute. As the TaskBar is static and won't be moved, there won't be any problems. But in our case we have to animate the flyout (no fading or sliding can be done while using this API :( ). So unfortunately that method won't work for us.

We have to use the method I suggested.

@ShankarBUS
Copy link
Member

Wew!

Made some progress on the acrylic effect. Now I can render WPF content on the blurred window.

image

@ShankarBUS
Copy link
Member

ShankarBUS commented Oct 11, 2020

Update: Got the WPF content to refresh itself. But the CPU & GPU usage skyrockets.

image

If there are some experts out there, please help me to reduce the CPU usage and improve the performance.

If we make this effect efficient, then we can easily add this to ModernFlyouts with less amount of work.

@prakharb5
Copy link
Member

Do the values increase when it the window is created, or for the time the window is present?

@ShankarBUS
Copy link
Member

The usage will be high until the window is closed.

We are re-rendering the WPF content (which is not visible due to transparency) into a byte array and rendering that onto the composition layer (aka the layer which hosts the acrylic).

So, CPU usage in this process is unavoidable.

It would be nice if we can directly pass the WPF buffer into the Composition layer instead of 2 intermediate steps which includes CPU.

@prakharb5
Copy link
Member

prakharb5 commented Oct 12, 2020

@ShankarBUS The tray icon popup of Dopamine music player produces an acrylic window blur for its window. Have a look at that too.

image

@WindowsFanBoi
Copy link

WindowsFanBoi commented Oct 12, 2020

Hey @ShankarBUS,

How about using two windows, one (say AcrylicWindow) would be using the Composition APIs to create the acrylic effect and the second is what we already have (i.e. FlyoutWindow a transparent alpha blended WPF window)

You can then make the AcrylicWindow as the owner of the FlyoutWindow so that they have the same Z-Order and will look a single window if their bounds are synced.

The FlyoutWindow won't consume that much CPU/GPU in idle state and since the AcrylicWindow is using the Composition APIs, it will result in a performance improvement.

But you'd have some problems using Win2D.uwp with .NET 5 (as Win2D will provide *.winmd metadata files not managed .NET *.dll assemblies and the WinRT interop being removed in .NET 5, you won't be able to use them without making your own projection lib using CsWinRT)

So 🤷‍♂️

@ShankarBUS
Copy link
Member

@WindowsFanBoi

Same pinch!

You're about two hours late 😁, I got it working without any performance degradation. Thanks for the suggestion though.

I didn't there were such problems with .NET 5, I was working on a experimental project which uses .NET Framework 4.8. So, I didn't experience this issue. I will see what we could do about this.

@Samuel12321
Copy link
Member Author

don't know if this could be of any help: https://github.com/sourcechord/FluentWPF/tree/master

@ShankarBUS
Copy link
Member

Bruh! #44 (comment)

@Samuel12321
Copy link
Member Author

whops, i forgot all about that one

@ShankarBUS
Copy link
Member

@Samuel12321,

You said you know C++, right?

Win2D is not supported in .NET 5 (due to various reasons). So we have to make our own implementation with just the GaussianBlurEffect in C# and use it instead of Win2D.

Do you know anything about Direct2D? And how it use in from C#?

Anyone in this thread?

Currently I can use the Composition APIs to render stuff but can't do apply any effects due to the lack of Win2D.

So, just the screen pixels are rendered without the blur.

One way to tackle this would be to fallback to .NET Core 3.1 which I don't prefer.

Any help would be appreciated 🙏.

@Samuel12321
Copy link
Member Author

no sorry, as i said, i know python and a specific variant of c (used for controlling mechanical devices), this is my first time with C++, C#, .NET and app development in general.

I will see what i can learn about this though.
Community help would be very useful.

@Samuel12321 Samuel12321 changed the title Incorporation of Microsoft Fluent Design Incorporation of Microsoft Fluent Design Acrylic effect Nov 2, 2020
@Samuel12321
Copy link
Member Author

Just renamed thread so it's specific to the acrylic (which is all that seems to be discussed here anyway), will create a separate thread for the Reveal effect.

@Samuel12321 Samuel12321 added Help Wanted Extra attention is needed and removed MS Store Feedback labels Nov 2, 2020
@ShankarBUS
Copy link
Member

Win2D is not supported in .NET 5 (due to various reasons). So we have to make our own implementation with just the GaussianBlurEffect in C# and use it instead of Win2D.

Do you know anything about Direct2D? And how it use in from C#?

Anyone in this thread?

Currently I can use the Composition APIs to render stuff but can't do apply any effects due to the lack of Win2D.

So, just the screen pixels are rendered without the blur.

One way to tackle this would be to fallback to .NET Core 3.1 which I don't prefer.

Any help would be appreciated 🙏.

Nah, no need for any of that. I forked Win2D and modified to be compatible with .NET 5.

@WindowsFanBoi,

But you'd have some problems using Win2D.uwp with .NET 5 (as Win2D will provide *.winmd metadata files not managed .NET *.dll assemblies and the WinRT interop being removed in .NET 5, you won't be able to use them without making your own projection lib using CsWinRT)

That's what I did.

And the result turned out to be great!

Acrylic

For those who are willing to test this out by themselves,

WPF Acrylic effect demo.zip

  1. System Requirements:
    • Windows 10 1903 or later
    • x64 OS
    • .NET 5 runtime preinstalled
  2. Download and extract this zip file (safe to download and extract, I assure you)
  3. Run the Temp.exe and voila!

This is just a prototype. I will make some improvement later this week.
You can drag the window by holding mouse left and moving the cursor (just like our flyouts).

For some weird reasons the SetWindowCompositionAttribute API (used for having acrylic effect in Win32 apps for ex: used in FluentWPF, AvaloniaUI, EarTrumpet, TranslucentTB, TaskbarX and so on) works fine in Windows 10 20H2 without the so called "1903 drag issue".

The only benefits my approach have are custom blur radius, custom effects (not just blur), custom acrylic visual shape (we could even create a round acrylic window with my approach).
Otherwise, the SetWindowCompositionAttribute API is enough.

Feedbacks are welcome!

@Samuel12321
Copy link
Member Author

WELLDONE @ShankarBUS
looks great.

@Samuel12321 Samuel12321 added this to In progress in 0.8.5 Nov 27, 2020
@prakharb5
Copy link
Member

For some weird reasons the SetWindowCompositionAttribute API (used for having acrylic effect in Win32 apps for ex: used in FluentWPF, AvaloniaUI, EarTrumpet, TranslucentTB, TaskbarX and so on) works fine in Windows 10 20H2 without the so called "1903 drag issue".

Maybe MS finally fixed it...?

Congrats though.

@thexamlguy
Copy link

thexamlguy commented Dec 21, 2020

Following this Twitter conversation (https://twitter.com/TheXamlGuy/status/1341098062245183488) I found another way to do this by using WindowXamlHost to host a UWP usercontrol inside a WPF app and then using a Flyout with ShouldConstrainToRootBounds property set to false, this will literally allow the Flyout to go outside the root boundary of the window hosting the control. A bonus is is that you are given the animations and acrylic by default.

I have a quick dirty sample of the above working, I'll get it posted once I have tidied it up some more.

EpyJhJSW8AcYZiO.mp4

@thexamlguy
Copy link

thexamlguy commented Dec 21, 2020

Obviously I should point out the only downside about the above is that you'd lose the ability to drag the Flyout around, but I am sure with some more work it could be made possible to drag the Flyout around too?

@ShankarBUS
Copy link
Member

@thexamlguy,

Thank you so much mate!!!!!

I will investigate this further.

But "Window Activation" is another thing to worry about.

The current flyout is designed to be non activatable and won't activate on mouse activation or even while showing.

I'll sure explore the possibilities.

And how did you find that he was using a "Flyout" inside the xaml island?

@thexamlguy
Copy link

The animation, it was far too smooth to have been achieved with a WPF window alone especially with it being a larger window. The guys who work on EarTrumpet have been trying to replicate the look and the smooth animation found the Windows 10 notification flyout for a very long time without any luck.
I thought at first he was using the TeachingTip control from WinUI as Microsoft themselves uses the TeachingTip control on the Desktop in areas where they are trying to promote their new Edge browser when someone had Chrome installed. That's when I discovered ShouldConstrainToRootBounds in the FlyoutBase.

@Tropix126
Copy link

Any updates on this?

@Samuel12321
Copy link
Member Author

Hi @Tropix126, not that I'm aware of. This is a bit out side of my area of expertise and i don't think @ShankarBUS was planning on doing anything more on this one.
As always if anyone else wanted to help add this it would be greatly appreciated.

@Samuel12321 Samuel12321 added this to To do in 0.11 Release via automation Mar 3, 2021
@Samuel12321 Samuel12321 removed this from To do in 0.11 Release Mar 3, 2021
@Samuel12321 Samuel12321 added this to the 0.10 milestone May 28, 2021
@selastingeorge
Copy link

Win2D is not supported in .NET 5 (due to various reasons). So we have to make our own implementation with just the GaussianBlurEffect in C# and use it instead of Win2D.
Do you know anything about Direct2D? And how it use in from C#?
Anyone in this thread?
Currently I can use the Composition APIs to render stuff but can't do apply any effects due to the lack of Win2D.
So, just the screen pixels are rendered without the blur.
One way to tackle this would be to fallback to .NET Core 3.1 which I don't prefer.
Any help would be appreciated 🙏.

Nah, no need for any of that. I forked Win2D and modified to be compatible with .NET 5.

@WindowsFanBoi,

But you'd have some problems using Win2D.uwp with .NET 5 (as Win2D will provide *.winmd metadata files not managed .NET *.dll assemblies and the WinRT interop being removed in .NET 5, you won't be able to use them without making your own projection lib using CsWinRT)

That's what I did.

And the result turned out to be great!

Acrylic

For those who are willing to test this out by themselves,

WPF Acrylic effect demo.zip

  1. System Requirements:

    • Windows 10 1903 or later
    • x64 OS
    • .NET 5 runtime preinstalled
  2. Download and extract this zip file (safe to download and extract, I assure you)

  3. Run the Temp.exe and voila!

This is just a prototype. I will make some improvement later this week.
You can drag the window by holding mouse left and moving the cursor (just like our flyouts).

For some weird reasons the SetWindowCompositionAttribute API (used for having acrylic effect in Win32 apps for ex: used in FluentWPF, AvaloniaUI, EarTrumpet, TranslucentTB, TaskbarX and so on) works fine in Windows 10 20H2 without the so called "1903 drag issue".

The only benefits my approach have are custom blur radius, custom effects (not just blur), custom acrylic visual shape (we could even create a round acrylic window with my approach).
Otherwise, the SetWindowCompositionAttribute API is enough.

Feedbacks are welcome!

@ShankarBUS Can you please share the source code of demo you mentioned here #66 (comment)

@Samuel12321 Samuel12321 removed this from the 0.10 milestone Jun 6, 2021
@SyedAounHaiderNaqvi
Copy link

Any progress guys?

@ShankarBUS
Copy link
Member

Any progress guys?

No floppa, no

@SyedAounHaiderNaqvi
Copy link

Any progress guys?

No floppa, no

Aw well, best of luck anyways :D

@devilAPI
Copy link

We still need this, any updates?

@Samuel12321
Copy link
Member Author

The team has been very busy, unfortunately we haven't had time to do this yet.
Always open to community contributions.

@Samuel12321 Samuel12321 added this to To do in 0.11 Release via automation Dec 26, 2021
@Samuel12321 Samuel12321 added this to the 0.11.0 milestone Dec 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Extra attention is needed UI/UX Related to appearance of the app and flyout.
Projects
0.11 Release
  
To do
Development

No branches or pull requests