Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ivarhill · Apr 21, 2019 at 10:33 PM · androidperformanceoptimizationrendertextureframerate

Extremely poor Android performance, even in simple scenes

I'm seeing extremely low framerates when testing my game on Android and I haven't been able to figure out the cause. When testing on a low-end PC (integrated graphics, low-end CPU) I get fairly decent performance but testing on a Nexus 7 tablet my FPS is in the single digits.

The main thing that I notice is that performance is poor even on the main menu of the game, which has no 3D graphics whatsoever - this makes me think that there could be something causing really poor performance aside from unoptimized textures, draw calls, shaders and so on.

Since a question like this is pretty much worthless without more details, here's what I've established so far:


Using Unity 2018.3.6f1 and building to a Nexus 7, I get about 14 FPS in the main menu. This is using the following setup:

  • Deferred rendering

  • Vsync turned off

  • OpenGLES3 used

  • Textures compressed using ETC2 32-bit


Switching to forward rendering, the framerate increases somewhat (to around 24). Forcing OpenGLES2 also increases the framerate by this amount, presumably because it forces forward rendering as well.

In the profiler I see the following:

Profiler

It doesn't seem as specific or verbose as I'd like and I'm having a hard time parsing what's actually going on there.


Once loaded in the actual game, my framerate drops to about 5 (deferred) or less than 1 (forward). Worth noting is that I only have a single realtime directional light in the scene - all other lights are set to baked only. The profiler now looks like this:

alt text

Note that what appears to be an image effect is actually a camera render to a render texture - to save performance and to give the game a pixelated look, I have a camera that renders the scene in a low resolution to a render texture which then gets upscaled to fit the screen. While I initially thought this may be the cause of the performance issues, switching to a single conventional camera with no render textures or image effects does not seem to improve performance at all.


In addition - not sure if related or not - I'm seeing an odd visual glitch where the screen keeps slightly flickering to black. At first I thought this too was related to the render texture but it does the same in the main menu which doesn't use that at all, so not sure what that could be. Every second or so the screen gets slightly darker (not completely black) and then every other second it's back to normal.


Does anyone have some starting points to offer for how I would look further into what may cause these extreme framerate drops? While I definitely do have some work to do in terms of optimizing materials and textures, the fact that it's so bad even in a UI-only scene makes it seem like there's more going on.

Not sure if I left out something critical so feel free to ask for any further details. Thanks!

profiler1.jpg (97.0 kB)
profiler2.jpg (233.5 kB)
Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ivarhill · Apr 21, 2019 at 10:40 PM 0
Share

In case it's relevant, here's the 'Downsample' class I have that renders the (inactive) player camera to a rendertexture that a second camera with an active Camera component:

 void OnRenderImage(RenderTexture source, RenderTexture destination)
     {
         if (gameObject.activeSelf)
         {
             for (int i = 0; i < renderSourceCameras.Length; i++)
             {
                 renderSourceCameras[i].targetTexture = downsampleRenderTexture;
                 renderSourceCameras[i].Render();
                 renderSourceCameras[i].targetTexture.DiscardContents();
                 renderSourceCameras[i].targetTexture = null;
             }
 
             Graphics.Blit(downsampleRenderTexture, destination);
         }
 
     }
 
    void OnPostRender()
     {
         if(downsampleRenderTexture != null)
         {
             downsampleRenderTexture.DiscardContents();
         } 
     }
avatar image ivarhill ivarhill · Apr 22, 2019 at 03:01 PM 0
Share

Some further notes - through more aggressive optimization in many different areas the situation improves somewhat and I'm getting between 20 and 6 FPS depending on the direction I look (I do make use of occlusion culling but it's probably not as efficient as it could be).

I'm currently averaging around 200-400 draw calls, which may be quite a bit on the high end so perhaps taking some time to ensure more efficient batching would help.

There's also the matter of canvases - it seems like UI canvases are very poor on performance and I make quite heavy use of these for my UIs. However, disabling all UI altogether doesn't provide that much of a performance boost so I doubt it would be the only culprit.

avatar image DiegoSLTS · Apr 22, 2019 at 03:10 PM 0
Share

As for the Device.Present line, maybe you've found this already, but check here: https://forum.unity.com/threads/device-present-in-profiler-what-the-deal.86312/

There's a "VBL" option that could force VSync even if you disable it, and someone said disabling it fixed a performance issue.

As for the render to texture and downsampling stuff... Why are you doing all that setting, removing and discarding rendertextures all frames? Can't you create a render texture once with the expected resolution, set it once as the target of the camera, and just blit the texture each frame?

avatar image ivarhill DiegoSLTS · Apr 22, 2019 at 03:21 PM 0
Share

I hadn't actually considered that for the downsample function but indeed this works just as well - https://pastebin.com/fXwxw4qr - thanks for the suggestion.

I did see the thread you linked but so far I've been unable to actually find that setting within Unity - maybe newer versions removed it? Or maybe I just have a hard time finding it...

avatar image DiegoSLTS ivarhill · Apr 22, 2019 at 08:02 PM 0
Share

Yes, didn't saw the date of those posts, it looks like "Sync to VBL" was replaced later with "VSync count".

$$anonymous$$aybe you can try disabling some stuff to see if some object in you game makes a big difference. Also, have you tried in other phones and models? Just to discard hardware issues.

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

252 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is UI ruining my fps on some of android devices? 2 Answers

On Android. How many lights can you have in a Scene or the total game? 1 Answer

Android lag 1 Answer

Motorola issues 0 Answers

Huge fps drop after using the Status Bar or Volume Controls on Android 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges