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

Advanced Detailed Blur on Android : low framerate #196

Open
FXI-UCL opened this issue Nov 20, 2019 · 5 comments
Open

Advanced Detailed Blur on Android : low framerate #196

FXI-UCL opened this issue Nov 20, 2019 · 5 comments
Assignees
Labels

Comments

@FXI-UCL
Copy link

FXI-UCL commented Nov 20, 2019

Describe the bug
Using Advanced Blur and Detail Blur mode on an Android device makes the game really slow.
Updates takes several seconds.

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic 2D UI project
  2. Add a Button, configure it so it changes color when clicked and released
  3. Add UI Effect and UI Shadow to configure a "Soft shadow" usage. Use "Detail blur" mode and tick "Advanced Blur".
  4. Build and Run on an Android Device. See refresh rate when clicking on the button.

Environment

  • Platform: Android 5.0
  • Unity: 2019.1.8f1
  • UIEffect: v3.2.0

Additional context
I was told it was working fine some months ago, then an Android update occurred, and suddenly the app was awfully slow when run. It seems the app was not rebuilt in the meantime.
Only an Android update was done between the time it was working fine and smooth and now that it is too slow.

I've tried building a single project, like indicated in the "Reproduce" section, and indeed it is desperately slow with these settings.
Cannot personally confirm it was working "before", only was told by a colleague.

Edit : it seems the issue comes from the "Advanced Blur" option, as it is also very slow in Advanced, Medium Blur, but runs fine in Detail no-Advanced Blur.

@FXI-UCL
Copy link
Author

FXI-UCL commented Nov 22, 2019

I dug into the Shaders.
Bottleneck comes from the function fixed4 Tex2DBlurring (sampler2D tex, half2 texcood, half2 blur, half4 mask) line 75 in file UI-Effect.cginc (when not using TextMeshPro).

Computation differs whether the Advanced Blur option is used or not, but it makes no real difference in term of performance.
Instead, the size of the array used to compute the blur increases when the Advanced Blur is used.
When the size of the array is too big (9 on my Samsung Galaxy Note 3), the app gets unresponsive, even when using the non-Advanced computation (tests done by c/p Advanced option arrays to non-Advanced Define).

So I suppose the only way of improving that is to use a computation with a complexity less than n².
And declare KERNEL_SIZE/2 as a variable outside the loops to avoid computing it each time, but that's not a big gain.

@mob-sakai mob-sakai self-assigned this Nov 22, 2019
@mob-sakai mob-sakai added the bug label Nov 22, 2019
@mob-sakai
Copy link
Owner

Hi @FXI-UCL

Thank you for your reporting!
This issue is very difficult... X(

@mob-sakai
Copy link
Owner

Hmm, This issue may be solved by using the pre-write buffer used in SoftMaskForUGUI.
Not yet tested.

@flarive
Copy link

flarive commented Jan 22, 2020

Hi...
I have the same issue, on quite big UI Image (such as 256x256 or more), the framerate (FPS) is divided by two when UI-Effect (Fill, Detail Blur, Advanced shadow) + UIShadow is drawn... On little images (less than 128x128) the framerate is not impacted when the glow is displayed...

Can you try if the usage of pre-write buffer you told above can fix this performance issue ?

Your glow effect is one of the best i was able to find in Unity, really great work :)

@fuatcoskun
Copy link

Any update on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants