Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Low FPS after adding 2 sprites

Discussion in 'General Graphics' started by Skullek, Jan 30, 2020.

  1. Skullek

    Skullek

    Joined:
    Mar 16, 2018
    Posts:
    22
    Hello I'm using Unity 2019.3 with URP when I'm playing my game on my phone (Xiaomi Redmi 4x) I've got constant 60 FPS but when I add 2 big sprites to use as a background I've got only 39fps.

    First:
    I've got Sprite Renderer with shape image - which is white thing with curve on the top-left side - 2K resolution


    And that sprite renderer has a material which is Unlit URP with base map. I'm using offset to move the object - it looks like earth is spinning. The continents are moving.


    Earth image - 4K Full rect sprite

    Final effect


    Second image is in same setting and it's sprite with clouds which i'm moving in the same way.
    And It doesn't matter if i set resolution of this image to 2k/1k or less. It's still 40fps, but when i disable GO with background it's 60.

    Is it just because 2 big sprites? I don't have many heavy graphical things in my project. How can I resolve this?
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    Hi!
    The device you're trying this on has a relatively slow GPU. Most likely, lowering rendering resolution from 1080p to 720p would help.
     
  3. Skullek

    Skullek

    Joined:
    Mar 16, 2018
    Posts:
    22
    My app is saying that it is 720p when i'm playing on my phone so it's not it
    I know that GPU is weak but still - 2 textures and nothing more on stage - and 40 fps.
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    It's not about just having two sprites with a single texture each, it's about how many times a fragment shader needs to run. In your case, both textures have alpha, so when you're rendering two full-screen sprites you're guaranteed to have the shader run at least 2x for each pixel in your target.
    If you have some additional things, like post-processing, or rendering a skybox, this will only add to that.
    What happens if you just render a single sprite? Does the framerate go up?
     
    Skullek and Lars-Steenhoff like this.
  5. Skullek

    Skullek

    Joined:
    Mar 16, 2018
    Posts:
    22
    I've done an experiment and replace texture 2560x1440 alpha+tight with 2048x1024 without alpha and full rect - still 40 fps - maybe 42.
    With earth texture and without clouds i've got 47-48 fps.

    We set this phone as a base for 60fps and It is very important for us that the final product works fine on this Xiaomi Redmi and i'm really grateful for your time and explanations.
     
    Last edited: Jan 31, 2020
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Did you try using the built-in render pipeline? AFAIK, URP renders to an off-screen texture and then draws that texture to the screen, which is too much for lower end devices. Also, make sure HDR rendering is off and your frame buffer format is RGBA 8888.

    I have this same phone and it is more than capable of doing 720p at 60fps with simple shaders. Mario Kart runs super smooth, for example.
     
    Skullek likes this.
  7. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    It's not always the case, only when this is required.
    Built-in does the same when Android blit mode is set to Auto, and always does the blit when it's set to Always.
     
    Skullek likes this.
  8. Skullek

    Skullek

    Joined:
    Mar 16, 2018
    Posts:
    22
    I switched from URP to Built-In made some changes and now I've got 60 fps and I've got everything I wanted.
    So i think that case is over.
    Thank you so much for your help and for your time.
    There will definitely be a time when URP will be more efficient in every case. I support it.