mob-sakai / SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
https://github.com/mob-sakai/SoftMaskForUGUI
MIT License
1.97k stars 261 forks source link

Performance Problems on Android #91

Closed NikittyS closed 4 years ago

NikittyS commented 4 years ago

Hello. I have performance problems on Android - FPS drop from 59 to 47 when enable UI object with SoftMask.

Problem

Environment

To Reproduce

  1. Create Canvas
  2. Create parent Image with SoftMask
  3. Create child Image inside parent

This problem doesn't only on Nexus 5. I tried on other devices with Android 9.0 and the problem was the same. But fps depends on the performance of the device.

P.S. On iOS works perfectly.

Screenshots

Unity:

Hierarchy

(Zoom_Under just copy of Zoom_Inside)

CanvasMain Parent Child

Nexus 5:

Object with SoftMask - disabled

maskOff

Object with SoftMask - enabled

maskOn

Can you help with that problem? Thank you!

mob-sakai commented 4 years ago

@NikittyS

If the soft mask buffer is being updated every frame, it's probably a bug. Could you please attach a minimal project that reproduces the issue?

NikittyS commented 4 years ago

@mob-sakai

Hello. I'm tried set Desampling Rate to x2, it give 49-50 fps (from 59).

I made one mistake when I said about fps falling with only one object with SoftMask. One object doesn't reduces fps, but two objects reduces.

Minimal project SoftMaskTest.zip

mob-sakai commented 4 years ago

It's interesting.

On my Android device (Sony Xperia XZ), FPS didn't drop. So I added 20 SoftMask, FPS dropped to 30.

NikittyS commented 4 years ago

In main project, I have around 150 movable objects with SoftMaskable. On my iPhone 6s stable 60 fps, but Nexus 5 show ~20-25 fps.

mob-sakai commented 4 years ago

I improved performance.

it gives 45-47 fps (from 30, with 20 SoftMasks).

mob-sakai commented 4 years ago

Try to use v1.0.0-preview.4

NikittyS commented 4 years ago

@mob-sakai Hello. Good work! Thank you! Nexus 5 with ~150 object now give 50 fps, that's good.

But I have one more little issue - when I updated SoftMask to 1.0.0-preview.4 SoftMask doesn't work when Canvas Render Mode set to Screen Space - Overlay, but if it set to Screen Space - Camera SoftMask work well.

mob-sakai commented 4 years ago

Thank you for testing, @NikittyS .

I tested it on a project you previously uploaded. (SoftMaskTest.zip)

It uses Screen Space - Overlay as Canvas Render Mode. However, the problem did not reproduce in my environment...

Could you please attach a minimal project that reproduces the issue?

NikittyS commented 4 years ago

@mob-sakai

Hmm, I restarted Unity and everything was fine, sorry for this mistake.

Thank you for this best soft mask!