Search Unity

Question URP on Mobile incredibly slow?

Discussion in 'Universal Render Pipeline' started by ShadyMike, Jan 2, 2022.

  1. ShadyMike

    ShadyMike

    Joined:
    Apr 14, 2013
    Posts:
    60
    Hi,

    I've never tried making a mobile game before. However, I noticed that I get really bad FPS even with just simple scenes. I have 3 animated skinned meshes, and 2 point lights (no shadow casting) on screen, and the FPS caps at 26. Profiler says that the CPU is waiting for GPU gfx to finish.

    So I wonder, why is the performance so bad? I can think of a few possibilities, but I don't know:
    1. URP is not ready for mobile, maybe Standard is faster?
    2. Maybe a Development Build is slower than a non-Development Build?
    I'd appreciate any help as this is quite frustrating, I can't imagine mobile devices to be that slow.

    Thanks in advance!
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Check the profiler.
     
  3. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    He already did I think

    The problem with URP if you make it from template is that it turns all effects ON in the first place. This could be problem if you are targeting mobile platform since not all device has the power required to run those post processing

    Try turning PostProcessing off would be a good start to bump the framerate

    And yes, from what I've tested on my mobile device, standard/built in pipeline is faster than URP
     
    AshwinTheGammer likes this.
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    URP does some things by default which you would otherwise need to enable or implement via a package/asset, which can hit mobile GPUs much harder:

    - HDR rendering (built-in defaults to LDR) is really intensive on low end mobile GPUs.
    - Post processing (built-in has none, you need a package/plugin) needs the framebuffer to be copied out from tile memory to device memory, which is the death sentence for low end mobile GPUs which barely have bandwidth to fill every pixel on the screen.
    - Linear space rendering (built-in defaults to gamma space) can cause some mobile GPUs to need to copy the framebuffer to device memory.
    - Single pass forward lighting (built-in uses multiple passes). While this reduces the number of draw calls (good on the CPU), it makes the shaders more complex. On low end mobile GPUs drawing a simpler shader multiple times can be faster than drawing a more complex shader once due to the limited number of shader execution units and the fast tile memory.
     
    alphaorbit, ekakiya, ElliotB and 4 others like this.
  5. RogueStargun

    RogueStargun

    Joined:
    Aug 5, 2018
    Posts:
    296
    Turn off the shadows.
    Unity really needs to make a second example scene for URP with everything turned off for mobile and oculus quest 1.
     
  6. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
    When you create using template, you can find 3 settings for URP inside Settings folder. Use Low preset for mobile

    as @Neto_Kokku said, some settings are for newer devices by default when your using URP:
    Linear color space
    HDR
    Post Processing
    Lit standard shader

    So you can optimize:
    Gamma color space
    LDR
    No post processing (use only ACES and Color Grading)
    Use the simple lit or baked shaders

    Don't forget that the new devices (even 100$ android devices) has no problem with the above settings. You can use Linear+HDR+Lit shaders+Post Processing on the xiami poco x3 at the 60fps on native resolution a real 3d game
     
    Last edited: Jan 3, 2022
  7. RogueStargun

    RogueStargun

    Joined:
    Aug 5, 2018
    Posts:
    296
    I'm trying to make a game for the Oculus Quest 1 and the requirements to reach 72 fps are even more brutal than for a standard mobile game. Here are some of the things I've done:

    - Turn off HDR in URP settings
    - Forget about post processing especially bloom. Turn it all off. Consider switching it back on after all other optimizations have been implemented
    - Turn off shadows. Just forget about realtime shadows
    - Use as few materials as possible for the entire game. I use one material for the entire game!
    - Make sure materials use batching and gpu instancing
    - Turn off vsync in the quality settings
    - Use the BAKED lit URP shader whenever possible for anything that is static and does not need relighting.
    - Use the SIMPLE LIT URP shader whenever possible for anything that needs lighting
    - Set quality setting to as low as possible (reduce texture quality)
    - Use lods for all meshes
    - For terrain rendering, set the draw distance to as small as possible. Hide with ample amounts of fog if necessary.
    - When using terrain, set the pixel error as high as possible and the mesh resolution as low as possible
    - Remember to turn off tree colliders for terrain
    - Only use one light for the entire game


    The built in Terrain Lit shader for URP is still a bit too expensive to use for mobile applications. You may need to find a 3rd party shader here. I use microsplat with all normals turned off for performance
     
  8. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
  9. ShadyMike

    ShadyMike

    Joined:
    Apr 14, 2013
    Posts:
    60
    My phone has a resolution of 2400x1080. When I render at a lower resolution (which is barely noticeable btw.), I get smooth 60 FPS.

    I heard it's even common practise to render mobile games at a lower resolution, I didn't expect that.

    Thanks for all the tips though, they are just as useful and interesting.
     
    Aligdev and UnityLighting like this.
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's been common and established since 2009, when Plants vs. Zombies devs wrote about it. I made a post about that too a few times on these forums. The technique is older of course. Since the PC era from the late 80s, there's been variable resolutions.

    All desktop games I know of also support variable resolutions. Even when they don't, desktop and console games have dynamic resolution, which scales the rendered target depending on how under load it is.

    Put simply, it's just something new developers don't think about. Especially when phones often are asked to draw to a native display far bigger than a tv screen on a powered home console!

    In any case, building a scalable game is something Unity excels at, so you'll be fine.
     
    Aligdev likes this.
  11. ShadyMike

    ShadyMike

    Joined:
    Apr 14, 2013
    Posts:
    60
    I usually work on Desktop stuff where resolution is mostly not an issue.
     
  12. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
    7 years ago, i have used the resolution solution to run post effects smoothly on Mali 400 gpu
     
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It is always an issue, just apparently not for your own project.

    Most games on desktop and console now render around 1080p and upscale to 4K / VR res / or DLSS / other to requested display resolution.

    Internally, most games (even some of your own) will still have mixed resolution rendering, at loads of different places - even for example: post effects.

    In short, the only time resolution isn't usually messed with is when indies make a game.
     
  14. Jimaniki

    Jimaniki

    Joined:
    Nov 9, 2017
    Posts:
    20
    What do you mean about "render at a lower resolution" ?
    In UniversalRenderPipelineAsset / Quality / "Render Scale" : you set it to less than 1 ?
    or in Project Settings / Player / Resolution Scaling / Resolution Scaling Mode : frome "Disabled" to "Fixed DPI" ?
    or you force "Screen.SetResolution (value1, value2, true);" in a script for your players ?
    or something else ?
     
    starfoxy likes this.
  15. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    184
    Well, since it seems this thread has surfaced again, I will jump in with my own question.

    I am testing the URP pre-canned project and have set the Project Settings -> Graphics -> SRP Settings to use the URP - Performant pipeline asset.

    Oddly, this either doesn't seem to 'take' as a setting or something because I cannot set my camera to use:

    Rendering -> Renderer -> URP-Performant-Renderer.

    It is stuck at HighFidelity.

    Anyone have any idea what I should be doing to properly change to performant across the board?
     
  16. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    Hi, you can add other renderers to the active URP asset by clicking the "+" button.
    URP_AddRenderers.jpg
     
    starfoxy likes this.
  17. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    184
    wwWwwwW1 likes this.
  18. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    184
    This is a great question and I would like any insights available around how to approach this. @hippocoder ?
     
  19. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    I suggest changing the "Render Scale" because you can choose different upscale method and "Render Scale" should work with dynamic resolution in the future.

    My understanding of dynamic resolution:
    • Assume screen resolution is 100x100
    • Render 100x100 pixels when Render Scale is 1.0
    • Render 75x75 pixels to the same render texture (100x100) when Render Scale is 0.75
    • No need to allocate another 75x75 render texture and dispose the 100x100 one.
     
  20. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    After recently using URP for an Android build I can confirm it is not viable. That means 30fps or less regardless of settings.

    Built-in was 60+ fps faultless with Linear lighting/shadows/color grading/etc.
     
  21. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    If you're targeting at wide ranges of mobile devices (including very low ends like GL ES 2.0), then built-in is always a good choice.

    But built-in projects are more likely to have a CPU bottleneck (on desktop).

    Another option is to use LWRP (desktop + mobile, inverse-square light attenuation, ...), but it lacks most of the modern rendering features and won't receive any bug fix.
     
  22. OnoSaburo

    OnoSaburo

    Joined:
    Mar 25, 2023
    Posts:
    18
    Hello @Community
    Is URP(2D or 3D) mobile friendly?
    Even on low performance devices?
     
  23. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    No, at least, until someone can prove it the otherwise by providing an apple to apple comparison (an apk in built-in vs urp)
     
    Unifikation likes this.
  24. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    Asking if something is "mobile friendly" is meaningless when we can target everything from barely usable devices (eg iPhone 6) to incredibly powerful ones (eg iPad Pro). You need to specify the devices that you are interested in targeting, and even then you have to hope someone has tested on one.
     
    Last edited: Jun 23, 2023
  25. RogueStargun

    RogueStargun

    Joined:
    Aug 5, 2018
    Posts:
    296
    I'm getting 72 fps on quest 2. Unity is mobile friendly with URP, but you need to go through every shader and asset to make sure your not wasting performance on useless crap like 512x512 smoke textures
     
  26. Rakun665

    Rakun665

    Joined:
    Dec 22, 2020
    Posts:
    1
    I had the same issue. I created a new 'New Universal Render Pipeline Asset' and made some changes now my game is runs smooth. You can check this Unity video:
     
    bogdan3434 likes this.
  27. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,875
    URP has been optimized in maximum state by default. The problem is the old devices with es 2.0 compatible hardware. You must forget them (older than 2019 devices)
    build in is not optimized by default. You need a lot of working on the settings. But in best state the final result is same as urp
     
  28. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    Sorry to necrobump but URP is way worse on low-end devices than BIRP. Just swapping RP and converting the LIT shaders to Standard made my project to boost around 20 fps on Redmi Note 9 (which should be able to run even games with postprocessing applied).
     
    FilmBird likes this.
  29. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    Any other test devices btw? [edit: misread at first]
     
    Last edited: Dec 31, 2023
  30. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    I have an iPhone 12 which seem to not suffer as much as the Redmi but it has some framedrops when particle systems play and after the RP change, it gets solid 60 fps.
     
    FilmBird likes this.
  31. FilmBird

    FilmBird

    Joined:
    Apr 11, 2015
    Posts:
    26
    Was looking for info like this. Much thanks for the necrobump.
     
  32. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    234
    In our experience, performance differences are mostly about configuration, where a URP project might use to expensive settings or shaders. Did you have a chance to look at the new URP sample scenes? They contain setting assets that run on iphone S6 and up.
     
  33. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    I haven't as they are made for Unity 2022 while I'm using 2021LTS (because the editor performance regression is huge between those LTS once more). However, I made some more tests with a Poco x5, Redmi note 10, Redmi note 12 and a Black Shark 5 pro. The latest one gets stable 30fps on URP (same scene with 60K polys and 53 batches as before). The Poco x5 and the redmi note 12 get between 21-24 fps and the others between 10 and 17fps. I tried changing DPI, setting EVERYTHING to lowest settings, disabling Post-Processing, setting gamma space... nothing changed. After swapping to BIRP, all of them maintain the 30fps cap even with post-processing and screen space ambient occlusion. After disabling the 30fps cap, the iPhone 12 and high-end devices run at 60/target fps without issues. No idea what's going on with URP but it is not the first time I've encountered issues on mobile devices.

    When linking the profiler I saw Semaphore.WaitForSignal to use 85% of the computed ms even in empty scenes.
     
    Last edited: Jan 5, 2024
  34. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    Okay, tested new URP samples on my Redmi Note 9 (Mobile Low quality settings):





    Graphy shows 15 fps per scene (which is actually more than the fps shown in the benchmark). Tbh, no idea how you guys run this at 30 on iPhone 6 excepting some black magic with metal.
     
    Last edited: Jan 5, 2024
    FilmBird likes this.
  35. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    URP is just slower than BiRP in every way, e.g. custom image effects are slower and the base shader is needlessly complex, both the parsing of a pipeline and larger shader code give a massive overhead comparing to the optimized perfection that can be created using the BiRP.

    I would never use the URP for performance, BiRP is the only way to control your performance budget to the max imo

    Note also that URP is not a ready to use system, the coming Render Graph is changing the backend completly, to something even slower and much harder to make custom effects for, so besides slow, is not even remotly close to an actual Alpha stage.
     
    manurocker95 likes this.
  36. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    Hey @manurocker95
    Redmi Note 9 is below our min spec for the sample project and shouldn't be expected to run smoothly. I would expect the cockpit scene to give a stable 30fps though (a gut feeling, not tested) so I'll do a bit of investigation on that.
    Running the other scenes (which rely on URP Lit and Post Processing) on that device will be a challenge. The amount of geometry and cost of fragment shader is simply too high. I would experiment with using the simple lit shader and maybe even remove some geo (like vegetation) to cut down on costs. If you have a small project that shows clear worse performance in URP over BiRP I'm happy to take a look! We definitely want to iron out those cases.
     
    AljoshaD and ali_mohebali like this.
  37. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    @nasos_333
    Same for you! If you have a project that's clearly slower in built-in that you are happy to share, I'm happy to take a look!

    At the end of the day, they are two different technologies trying to solve a similar problem. So results will be different and it's not guaranteed that URP will be faster in all cases. We want it to be faster in as many cases as possible though!

    Regarding render graph I don't agree that it makes it harder to do custom effects. I actually think it becomes much easier and with better access to existing URP resources (like GBuffer, shadowmaps etc). We are also writing helper functions to make it even easier. You're right that render graph does incur some CPU overhead but hopefully that can be offset with other performance improvements coming down the line (made possible by render graph).
     
    Last edited: Jan 8, 2024
    AljoshaD likes this.
  38. kotbrain

    kotbrain

    Joined:
    Oct 13, 2019
    Posts:
    25
    Jonas-Mortensen likes this.
  39. FilmBird

    FilmBird

    Joined:
    Apr 11, 2015
    Posts:
    26

    I might be wrong but I think The cockpit scene in URP is obvious contender to be slower than BRP. It is clearly using rendertextures (or the full screen pass renderer feature for outline effect)


    BRP: Command buffers in BRP events like AfterGBuffer are generally more performant than Update loop commands because they execute within the rendering pipeline itself. This minimizes context switching and reduces overhead.
    URP: Command buffers in the Update loop for URP can be less performant due to frequent context switching between rendering and CPU operations. However, if you only need minor updates to the RenderTexture, like changing a few pixels, it might be negligible.

    The new Mesh Shader API on metal or similiar mesh shader api in unreal engine 5 powering the meshlets bedind Nanite are all about executing within the renderpipeline. The next generation and previous generation graphics seem to doing better then current generation. May Unity's Mesh Shaders come out of experimental stage soon.

    https://portal.productboard.com/uni...ing-visual-effects/c/1716-mesh-shader-support
     
    Last edited: Jan 10, 2024
    Jonas-Mortensen likes this.
  40. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    @FilmBird good point.
    Converting that scene to built-in will be a little bit of work but doable. If I find the time I will try it out.
     
    FilmBird likes this.
  41. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    I never expected it to work smoothly but closer to 25 fps than 15. I highly doubt you can find any scene that works faster on URP than BIRP on low end mobile devices, tbh.

    The thing is I've never seen URP properly working on low end mobile devices while BIRP does (even with postprocessing and SSAO).
     
  42. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    so URP won't support old devices?

    because my game used to running well on iPad from 2008,
    But now it cannot playable, after I use URP

    very bad decision...
     
  43. Lesha-VH

    Lesha-VH

    Joined:
    Jul 3, 2012
    Posts:
    96
    I tested the real-world mobile project (50m+ installs) and can confirm that URP is faster in my case 10-20% than built-in and deliver better visual quality (due to URP lit shader is better visual quality than built-in legacy/specular bump or built-in standard).

    URP uses standard shaders: lit / simple lit. URP options: hard shadows 1024, no post-processing, no SSAO. Lit only for main characters for better quality (with metallic / AO maps)

    Build-in uses mobile shaders, hard shadows medium quality, no post-processing, no SSAO

    The test was made on low-end/mid-end devices.

    Build in shows 50-55fps, URP stable 59-60fps. (android devices from 2017-2018 year)

    No doubt that URP definitely works a little bit better than built-in from the box (no custom modifications, no custom shaders). And URP give better visual quality - at no cost of performance metal or plastic can be drawn, no only flat colors.

    Note: on mobile devices you should decrease rendering resolution (do not render full HD on small screens, 0.7 scale will reduce twice less pixels and ~+35% performance rate at least)

    Also remember that users do no like HOT phones in hands))) But they definitely love 60fps, forget about less)

    Also note, that iOS devices are extremely powerful compared to android. They have no problem with performance, but you should not drain battery and make them hot.
     
    Last edited: Mar 25, 2024
    AljoshaD likes this.
  44. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    Can you tell the mobiles (and specs) you used for testing? As I have never found any project (or almost any) that works better on URP than BIRP on my Redmi Note 9, which is, as mentioned above, below the "minimum" specs for the URP demos. And ofc, I've never seen a URP project, not even demos, with 60 fps without outperforming on BIRP. Same goes for XR devices. At least on Meta Quest 2, 3 and Hololense 2.
     
    bart_the_13th likes this.
  45. Gasimo

    Gasimo

    Joined:
    Mar 3, 2015
    Posts:
    68
    Have you tried using non-URP shaders? From my testing it seems the URP shaders are not working that well on tiled GPU's, even the Simple Lit version.
     
  46. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    Wdym with non-URP shaders? if you are using URP you need to use URP shaders...
     
  47. Gasimo

    Gasimo

    Joined:
    Mar 3, 2015
    Posts:
    68
    Sorry for the confusion, what I meant was shaders which aren't based on the first-party URP Standard Shaders and their includes.