Search Unity

Question Performance issues on Android, with almost empty scene

Discussion in 'Universal Render Pipeline' started by unity_g6pUasEkRJ-2jg, Feb 24, 2021.

  1. unity_g6pUasEkRJ-2jg

    unity_g6pUasEkRJ-2jg

    Joined:
    Jul 24, 2020
    Posts:
    16
    Hello, I am making an android game using Universal Render Pipeline. In my scene, I have around 10 sprites visible, but for some reason it takes the gpu 80ms to finish rendering.


    98% of the time is used in Render Transparents, 54% in SpriteRender.RenderMultiple. This same scene runs at 1000fps when I build for windows. I know nothing about profiling so I am not sure what is causing the issue. The phone I am using is a samsung e7 plus, gpu adreno 610. unity v2020.1.2f1. Thanks in advance.

    edit: apparently, if I disable all my post-processing effects (Shadergraphs), the fps increase well beyond the 60fps mark. I assume this is because my shadergraphs are not well optimized. Although I find weird the difference in performance between windows and android. I may re-post the thread in the shader graph forum later
     
    Last edited: Feb 24, 2021
  2. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    324
    I'm also optimizing for a fairly high end android (using built in render pipeline). Like you, I have found specific shaders make a HUGE difference. If you can assign as much as possible to the unity mobile shaders you will see a large increase in FPS.

    A few other things I have come across recently to increate FPS on my test devices, some obvious, some not.

    -use mobile shaders
    -baked lighting, no real time

    -set quality levels low or medium (I swap in game on the app to medium/low profiles)
    disable shadows
    disable vsync

    Code (CSharp):
    1. application.framerate=300;
    this will force it to attempt to go as high as possible for testing (90fps on my device). I think this requires vSync to be off?


    -optimize frame pacing = uncheck (project settings>player>resolution and presentation)
    -use graphics API openGLES3 (default is vulkan now)
    (you may want to test those last 2 things yourself, but for me it made it faster)

    -procedural skyboxes will take a large chunk of performance. avoid if possible
    ...and of course optimizing assets/draw calls/atlases.

    I'm running a fairly complex scene at 90FPS on the phone with medium quality with shadows.

    My biggest thing right now is any time I bring in a new asset, I see a drop in FPS, swap to mobile shaders and right back up to 90FPS. very happy with that since im targeting 60fps, but some visual quality is sacrificed. Currently im going for fancy shaders on the main player and mesh terrain, with mobile shaders on everything else.

    on low end device I will likely switch on mobile shaders for all assets at runtime. It really is a night and day difference in FPS.
     
    timesplit117 and jppstudios like this.
  3. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    As you already found out, post processing is a very expensive operation, since it is applied to the whole image. This is especially true for mobile devices, since they oftentimes have a very high resolution with weaker specs compared to your windows PC. If you want to dig deeper, the term you are looking for is fillrate. Also UI can affect fillrate a lot, since there everything is transparent. If you for example have a rect transform filling the whole screen with an emtpy image to darken the screen, this is an expensive operation (you can still do it, you should just be aware that it comes with a high fillrate cost).
    The profiler screensot shows a lot of overhead for rendering transparent sprites, maybe you have large transparent sprites in your scene (large in the sense of taking a lot of space on the screen)? You could for example use the unlit shader for the opaque back elements.
    upload_2021-2-25_8-46-58.png
     
  4. unity_g6pUasEkRJ-2jg

    unity_g6pUasEkRJ-2jg

    Joined:
    Jul 24, 2020
    Posts:
    16
    The only transparent sprites I have are from the UI and they use the default shader. But I am using a material (made out of 1 of my pp shaders) that takes a render texture as input. Then, I have a quad in front of the main camera that uses that material. Is it posible this is cause of the lag?
     
  5. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Yes, exactly. A full screen quad results in needing to render every pixel again. So in an optimal world you would need to render each pixel just once, but in your case the quad needs to be rendered after all other stuff has been rendered (so every pixel was already touched once) and needs to render it again.
     
  6. timesplit117

    timesplit117

    Joined:
    Nov 16, 2022
    Posts:
    9
    You are the best man, I was searching this a lot of time. The problem was "optimize frame pacing", I disable that **** and now I don't have fps drops
     
    tree_arb likes this.