Search Unity

Performance going downhill with latest versions of Unity, Post Processing and SRP

Discussion in 'Universal Render Pipeline' started by Devil_Inside, Dec 2, 2019.

  1. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Thanks for dropping by!
    I've reported a bug with 5 test projects attached that I used to compare performance: Case 1202538
     
    phil_lira and quixotic like this.
  2. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    It's very unlike that URP is worse than LWRP in performance. In fact it could just be a rename instead of different package if package manager supported it.

    The big different in them is post-processing (v2 vs v3) but in our tests ppv3 is faster.
     
  3. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Its faster but not backwards compatible, and custom post effects are not yet supported.
    Do you know when they will come?
     
  4. buFFalo94

    buFFalo94

    Joined:
    Sep 14, 2015
    Posts:
    273
    Can we have some numbers from BoatDemo for example as it's seems to be the main demo for testing
     
  5. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Were anyone in the Unity team able to test the projects I've attached with the bug report?
    Each project is using a different Unity version, a different render pipeline or a different post processing stack, but the scenes are the same and the settings are the same. So it's should be simple to check performance for each combination of Unity version, render pipeline and pp stack in basically the same conditions.
     
    Ruslank100 and DungDajHjep like this.
  6. raidzhi

    raidzhi

    Joined:
    Jan 13, 2016
    Posts:
    32
    If URP not for mobile, so which one for mobile? HDRP?
    sorry, if not mobile, please use HDRP.
    If URP and HDRP both for high end hardware, is that mean srp not for mobile?
     
    Ruslank100 and forestrf like this.
  7. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Write your own pipeline;)
     
  8. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Hi,
    Currently the bug is with QA and they are running test, so far they have been unable to re-produce the same issue, they haven't managed to track down the exact device but the last test was done on a phone with the same SoC and was fine. This could point to android versioning or driver issue, or some other thing we have not run into. If we could get some actual numbers and profiling from you that would help a lot as I have just pulled the project and did my own tests in an iPhone 5s and in all cases Universal RP out performs Builtin with PPv1.

    Entire PlayerLoop: both held up by vsync.
    upload_2019-12-11_12-14-7.png

    PostLateUpdate: seems we are missing a lot of profiler tags in URP and we need to look into what is happening, actual Camera Rendering is 50% faster though in URP.
    upload_2019-12-11_12-16-10.png

    Render Thread:URP is slightly faster here when using the brute-force 'Stop NaNs' feature, this is very slow and should only be used in development as the source of the NaNs should be solved first before resorting to this. With 'Stop NaNs' disabled we are at a multitude faster than builtin.
    upload_2019-12-11_12-18-43.png

    The actual rendering:URP is slightly better here but actually worse in some cases, these are the Un-needed Copy Depth which we currently have a PR for, and also the NaN killer is still here, with those sorted we will be much lighter than Builtin with the same settings.
    upload_2019-12-11_12-21-28.png

    So make sure you don't use Stop NaNs, this is very slow, it doesn't exist on v1 post, and was enabled in both the tests of builtin v2 and URP. I was unable to do an Xcode capture with builtin and v1, will look into this as I need to do some profiling there for other reasons, this will help show what is taking exact milliseconds on the GPU rather than the Unity profiler which is only showing CPU costs.

    One thing we need to keep working on but are having trouble finding the time with all the other features needing work is making sure we have similar optimisations out of the box as builtin does, for example by default mobile project in builtin switch to a much cheaper PBR BRDF and in some cases back to a Blinn Phong even though in the editor it will be showing the full GGX BRDF, our Lit shader in Universal RP is always a full GGX BRDF, so the standard shader in builtin on mobile will cost the same as the SimpleLit shader in Universal.

    There are many little things like this that we do not automagically downscale in the background as we wanted you guys to have full control over how the project runs everywhere, but this has come at a big cost when out of the box settings are much more expensive than out of the box settings in builtin. Trust me we are constantly looking into this since Universal RP is a fact faster than builtin, but it is very easy to stumble into settings that are more detrimental on mobile than builtin also.

    Here are some numbers from it was introduced in LWRP(seconds before we changed to URP):
    upload_2019-12-11_12-33-6.png
     
  9. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    @Andre_Mcgrail
    Thanks for a detailed reply!
    I haven't tested this on iOS yet. I will try this next.
    Here are the profiler screenshots from my Xiaomi Mi A1 phone.
    As you can see, it takes almost twice as long to render the frame in 2020.1 URP vs 2018.4 built in.
    Also, just switching from 2018.4 builtin to 2020.1 builtin - the difference is huge.

    I've tested this on 2 different phones, Xiaomi Mi A1 and Nokia 6.1. While Nokia is slightly faster, the trend is exactly the same.

    Built-In - 2018.4.3f1 - ppv1 - Standard shader


    Builtin - 2020.1.0a13 - ppv1 - Standard shader


    URP - 2020.1.0a13 - Lit shader


    URP - 2020.1.0a13 - Simple Lit shader

     
    DungDajHjep likes this.
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is stop NaN unticked?
     
  11. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Yes. Stop NaN is unticked for those last profile screenshots.
    I've tested enabling and disabling Stop NaN and the difference is ~1 frame per second, so it's definitely not the main issue here.
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    (Offtopic) That's not true nor how performance should be looked at. You could be stressing ALU but bottlenecked by bandwidth, or the reverse. It can bring things close to a tipping point, especially with vsync. Please don't dismiss things like that, which are taxing the GPU in different areas, they will come back and bite you.

    Also what's the ms cost? nobody cares about FPS because FPS is a gamer's metric. For example lets say NaN is not the bottleneck here? add 1 single shader that does tax ALU elsewhere and absolutely would be the problem but you'd have already decided it didn't take any performance and blame the new shader instead....
     
    MrMatthias likes this.
  13. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Yea this is not great, one thing to try would be using 19.3 rather than 2020.1, it is alpha and currently we have not generated a 20.1 SRP package. This is the project uploaded in the bug repot I assume? Do the draws line up with what I posted above in the frame debugger? also what android version and API are you running these tests on?
     
  14. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    I've tested 2019.3 as well, which is almost identical to 2020, so I haven't included it in the bug report.
    Here are the results for 2019.3:
    URP - 2019.3.0f1 - Lit shader


    URP - 2019.3.0f1 - Simple Lit shader



    Frame Debug 2019.3 URP


    Both devices are running Android 9, API level 28.
     
    DungDajHjep likes this.
  15. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    I think the message for the Unity team is to share these deep-dives with us as much as possible. Statements like "When upgrading a project from the built-in render pipeline to the Universal Render Pipeline, you should expect similar or improved performance" might very well be true, but we should see detailed information to back it up.

    I also think we need more URP hero project examples.
     
  16. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    I got a reply from Unity that they were able to reproduce the issue and the case was sent to developers for further investigation and a fix.
    I hope this actually gets fixed.
     
  17. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Did you get a case number, so we can track the progress in the public issue tracker?
     
  18. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Case number is 1202538, however I can't find an entry in the public issue tracker.
    Is there a way to search by ID?
     
    Claytonious and Peter77 like this.
  19. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
  20. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    CubeGameStudio and Claytonious like this.
  21. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Any update on this?
     
    itskarlos, agovoruchin and TinyRoar like this.
  22. CubeGameStudio

    CubeGameStudio

    Joined:
    Dec 1, 2019
    Posts:
    18
    I am having similar issues on my project too. When enable post processing in the camera and testing on an Android device my frame hate drops by ~20fps even without any volumes in the scene.
     
  23. GilG

    GilG

    Joined:
    Jan 30, 2017
    Posts:
    27
    For me I only have the drop of 20 fps (over 60) when using Bloom on a Samsung Galaxy S7.
    Not sure if it should cost that much.
     
  24. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Hey all,

    I'll give a quick update on some things I know. There are a few issues at play that are making things slow, there are some issues with mobile specific, there are issues with 19.3 being slower across the board, there are regressions in URP performance. We are working on fixing as many of these as we know about but being that some are engine side and some are package side its taking longer to track the root causes down.

    A thing we are trying to land soon in URP at least is simple being able to disable Volume sampling and also remove Post-processing completely if you are not using either of these or rolling your own PP.
    We are also looking at adding some lower quality setting for the heavy PP effects, especially bloom, so that you can minimise as much as possible the cost if you are ok with the loss of image quality.

    These are some of the ongoing efforts which we will be focusing a lot more on once we get some last outstanding features that have been high on the list for URP(including AO). I myself am definitely hitting slow downs as the Boat Attack demo we showed at Unity does indeed run slower than it did back then which is not OK and this should not be the case.

    One thing I would like to note though is that PPv2 is not being supported going forwards, the reason we put it back into URP for now is that we are behind on getting a nice workflow in place for custom PP in the embedded URP PP, so performance issues in PPv2 in URP is semi expected as we do not plan to support it in future versions of URP and our attention is on making the embedded PP feature complete and highly customisable and efficient.
     
  25. GilG

    GilG

    Joined:
    Jan 30, 2017
    Posts:
    27
    Thank you ! You made my day :D
     
  26. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Thanks for the update, Andre!
    Unfortunately I can't say I'm relieved.
    It feels like the issues that are causing the performance regressions are complex to the point that no proper fix is coming in a foreseeable future or coming at all. I somehow doubt that the confirmed quick fixes (available when, in a month, two, three?) will have any noticeable impact. I'm also not interested in complex PP effects, that could be optimized by reducing quality.
    This kind of leaves me with built-in renderer and PPv1, since the breathtaking performance dip experienced with URP+Post probably won't be fixed anytime soon.
    :sadface:
     
    Ruslank100, protopop and AlejMC like this.
  27. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Is there anyway to remove the post processing completely as of now? Is it currently impacting performance even if post processing is disabled on the camera?
    I am doing post process through a Blit render feature, I wouldn't want the additional cost of the builtin Post Processing solution as well.
    Whats the best approach for the time being?
     
  28. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @deverolirc "any" way - yes, you can modify URP as you need, including kicking out whatever passes you definitely don't want. With a bit of carefulness (and git rebase) upgrading is still possible albeit of course much less comfortable than just upgrading URP directly.
     
  29. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    I would hope there is an alternate solution to this, will wait to hear word from UT before I get tangled up with modifying the pipeline.
    I am curious about the performance contrast between "completely" disabled vs disabled via the camera toggle, how substantial is it?
     
  30. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Depending on the platform, the performance difference can be huge. Upcoming versions of URP are supposed to finally fix that, but so far even with PP completely user-disabled there were extra (unnecessary) blits and render passes on e.g. Quest, Hololens (where perf really matters).
    Waiting for an official UT reply might not be the best strategy depending on your timeframe, XR communication is ... minimal. If you get an answer it'll probably be "next version fixes all XR issues" and then in the next version sth else breaks (at least that's been the situation for me for a year now).
     
    Ruslank100 likes this.
  31. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Currently this will disable the post-processing pass, but the content is still included in builds, which will increase build size. The main issue is the Volume system, as this will alway run regardless. There is a PR on Github for disabling this and Post which should land next week, with an expected package coming 3 weeks from now.
     
  32. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    How big of an impact does a Volume system have currently and how much performance boost can we expect from disabling it? Will it have any noticeable impact alone?
     
  33. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Thanks, so disabling it via the camera will disable the pass, only issue for now is that the post processing resources are included in the build?

    Also curious about this --
     
  34. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    So far we have seen reports of up to 2ms on some mobile devices, since the volume system essentially always samples a default volume, it does scale well, so if you have many volumes it doesn't scale cost*n which is good, but if you are not using volumes at all, it's good to be able to gain that time back.

    Correct, there isn't too much, but there are shaders, which will slow build time and potentially be loaded into memory and also grain textures/default LUTs etc, which will add a few kilobytes to a game from what I remembered(the shaders are actually bigger than the textures). So again if you want to write your own PP using only RendererFeatures you can skip both our PP as well as Volumes if you want really fast simple post.
     
  35. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    While 2ms is huge, unfortunately it won't help my FPS going from 60 to 26 when enabling LUT color grading.
     
    Last edited: Mar 2, 2020
    Ruslank100 likes this.
  36. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    LUT color grading will enable fullscreen blit passes. This will kill performance, as you see. Don't use this on Quest :)

    Also @Andre_Mcgrail the postprocessing Uber shader alone adds more than 25MB to a Quest build if not manually removed from every place that references it. "Few kilobytes" is a huge understatement ;)
     
    Ruslank100 and chrismarch like this.
  37. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    For post-processing resources always being included, could you open a bug report for this so we keep track of the work?

    For ColorGrading optimization we have work planned to optimize it. Essentially all post-processing that would sample the current fragment could use FramebufferFetch / VkRenderPass. This will happen sometime after deferred renderer lands.
     
  38. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    And this wasn't the case with built-in + PPv1, where I still get stable 60fps?

    So, the time frame for a fix that might make URP+Post usable for me is ~6+ months?
     
  39. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    I've looked at your case and can't figure out more information if color grading is the issue causing the regression.
    I've poked the developer assigned to it for an update. It should not take that long, the bug is flagged as High User Pain.
     
  40. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    @fherbst @Devil_Inside about ppv1 not doing a Blit for color grading. Afaik Ppv1 didn't use framebuffer fetch (and certainly not RenderPass). I just poked the PP developer and he confirmed color grading in ppv1 is being done in Uber post pass.

    Could you show me a framebuffer capture of ppv1 with colorgrading?
     
  41. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    @phil_lira Wasn't exactly sure what you meant by framebuffer capture.
    I'm attaching the frame debugger for PPv1 and PPv2 for comparison:



    Let me know if you meant something else or if you need more info!
    Thanks!
     
  42. AlexisTB

    AlexisTB

    Joined:
    Jul 26, 2017
    Posts:
    20
    This seems interesting, I haven't found where I can get ppv1 is there a download link somewhere? On the git im not sure which branch to get if v1 is on it. I'm on Unity 2018.4f1 and using PPv2 Bloom and Blur effects, but on Switch it cost between 7 and 10ms for both effects (losing the 60fps target).
     
    Last edited: Mar 6, 2020
  43. buFFalo94

    buFFalo94

    Joined:
    Sep 14, 2015
    Posts:
    273
    https://github.com/Unity-Technologies/PostProcessing/tree/v1
     
    Devil_Inside likes this.
  44. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
  45. buFFalo94

    buFFalo94

    Joined:
    Sep 14, 2015
    Posts:
    273
    LMAO
     
    hippocoder likes this.
  46. Deleted User

    Deleted User

    Guest

    So I hate to bump an old topic: but i'm using Unity 2020 alpha (2020.1.0a25.3171)

    The game I am making is cross platform (Android, PC, Mac, and Linux) using the URP and the built in post processing within URP, and with standalone builds the game runs great. But with the android build (built using IL2CPP) when I am in a menu (no post processing) I am getting 60 fps. My level creator also gets 60 fps (no post processing). But when I switch to the main game I drop to 30 fps with my Google Pixel 3a. HOWEVER after a couple seconds the fps will spike back up to 60 fps and hold there until I go back to the menu and into the main game again. Note my game is built using only ONE scene so the amount of objects in the scene so switching to main menu, level creator, and main game means the only difference is the main camera enters a sphere collider that triggers post processing.
     
  47. AlejMC

    AlejMC

    Joined:
    Oct 15, 2013
    Posts:
    149
    Kudos to the effort by @Devil_Inside in clearly defining a test case.
    Myself I have noticed a consistent drop in performance without quite being able to pinpoint exactly how or why... with no time to see the underlying issue, just trying to go around the issue by game design changes or disabling features altogether (which were fine before even older devices).
    If I'm making a game, I'm trusting what the engine devs tells us, if something goes wrong I'll assume first that it's my fault since everywhere it's advertised as "faster, better, stronger!"
    Thanks again for taking the time to make clear steps, most people don't really have time to be digging in like that.
     
    Ruslank100 likes this.
  48. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I wonder if any improvements has been made with URP and postprocessing in regarding to this performance issue.
    I think I am also getting it using 2drenderer with URP... In my case, I am running it on Switch, so I can't confirm for the mobile case, but since Switch do share similar performance issue as mobile, I am assuming that the same performance issue is still there. I am rendering relatively very simple 2D scene, but getting like 10ms rendering across 2 cameras, the actual rendering may not be that long, but CPU time that takes per each camera to render takes around 5ms each , no matter what it is trying to draw.

    I am pretty sure that when I used legacy rendering pipeline, it was not this slow.
     
  49. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    You can check this post:
    https://forum.unity.com/threads/universal-rp-status.826323/page-3#post-5775334
     
    itskarlos likes this.
  50. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I buy a lot of screen space image effects from the unity asset store.

    Some are components directly attached to the main camera and others work through the post processing stack (I’m using ppv2 in unity 2019.2)

    I’m thinking ahead and I don’t want to get stuck unable to update. It’s been mentioned here that ppv2 is going away. Does this mean current image effects I bought likely won’t work with ppv3 unless the devs update them?

    To avoid this I am thinking that it will be better not to use image effects that use unity’s post processing stack because they are more at risk of obseletion, and I should stick with image effects that attach directly to the camera because they bypass pp stacks.

    Does this sound right and does anyone have any suggestions or ideas about how best to approach this?

    Edit: I should mention I only make games for iOS/Android platforms if this makes a difference

     
    Ruslank100 and NateReese77 like this.