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. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    202
    URP consumes too much CPU, so even high end mobile will have problems.
     
    Ruslank100 likes this.
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I need to update and or release my game sooner than that, so as far as I'm concerned if Unity is fine having a broken product, so am I.
     
    Peter77 likes this.
  3. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Unfortunately most of us are tied into Unity for a several reasons, else we wouldn’t be here in the first place.
    Unity for many people isn’t just a hobby, it’s a full time job, and currently the state of Unity is making it much harder for people who are in that position (for example, Jason Booth, who is a great part of this community & the asset store). Users have invested in Unity as an engine and set of services but most importantly users have invested their time into Unity.

    The “if you don’t like it, don’t use it” mindset is a simplistic view on these issues. If you were talking about a free open source piece of software being developed by a solo developer or small team, I would agree, however that is not the case here.
     
    Bwacky, Ruslank100, Opeth001 and 5 others like this.
  4. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    202
    Competition is part of the development, do not tell others what to do because you are nothing.
     
  5. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    I'm sorry you are everything :)
     
  6. dlich

    dlich

    Joined:
    Apr 21, 2019
    Posts:
    11
    Faced the same issue with performance drop. After first profiling found out it was bloom. Then got confused when after disabling bloom or the whole PP volume, the performance was the same(around 10-20 fps). Started thinking that it was actually not the post processing but the 2d renderer and 2d lights, however, after disabling the Post Processing checkbox on the camera got convinced completely that it was the PP - fps went up to around 60. So I've just implemented a little system that tests the deltatime for 10 frames and if it's lower than certain theshold, disables the PP in the game. Additionally there's an option to turn on/off the PP in the settings for players crazy enough to play on ~15 fps...

    Btw, I've been testing on 2 devices: Pocophone F1 results in 60 fps with or without PP enabled, HUAWEI P20 LITE on the other hand lags miserably(10-20 fps). Also the profiler seems to be quite buggy for the last one and freezes the application when I try to profile the gpu.

    Hope this issue gets solved soon, so that I can provide most players with the same experience...

    Update: after additional testing it seems like the performance issue was related to Light2D after all. Both the postprocessing and the additional 2D lights( 2nd Global light for different layer and 1 point light) were contributing to considerable performance loss.

    Update2: after even more testing I found out that changing the dpi and turning off HDR on the rp asset affects the performance heavily. In fact even with pp and all the lights enabled, but hdr disabled the game can run full speed. Which leads me to think that it was the real culprit. Additional lights and bloom only cause more hdr color to be rendered on the screen (if I get it right) causing the lag.
     
    Last edited: Jul 1, 2020
  7. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    A general rule for mobile development is not to use any post processing effects at all. Today a lot of phones have resolutions higher than Full HD, even 4k so imagine a tiny mobile processor has to evaluate all these pixels. Also realtime lights are not meant to be used on mobile because of performence reasons.

    I read a lot of posts complaining about the performence of URP when in fact using a lot of features which are not recommended for phones anyway. It also just consumes too much the battery and the phone itself can get very hot if you stress it too much.
     
    Last edited: Jul 2, 2020
    laurentlavigne and JamesArndt like this.
  8. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Modern phones can handle PP just fine.
    I've been using post processing stack v1 on mobile with Unity 2018 with no issues. It gets worse with 2019 and 2020 with PPv2 but still usable. It's unplayable with URP.
    Performance is definitely deteriorating with each version of Unity and PP stack, while it's claimed otherwise.
     
  9. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    The problem is the design of PPv2 itself has significant performance overheads, many of which carried over to URP's built-in PP as well. The expensive volume blending logic (even when there is a single volume), the constant rebuilding of color grading LUTs, and rebuilding large command buffers from scratch every frame eat away a lot of precious main thread time. Not to mention the post processing shaders themselves could be made more efficient.

    The code looks like it was written to look smart, instead of being efficient.
     
    mgear, hippocoder and laurentlavigne like this.
  10. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    202
    i got 60 fps on mobile with bloom, vignette, and color grading, but with LWRP not URP, so dont blame PP.
     
  11. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    so, its definitely URP PP performance problem!! :]
     
  12. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Could you give us an update on your findings? Are you able to replicate the performance issues that were reported by some of the community members?
     
  13. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    I've been following this thread with morbid curiousity as a post-pro developer myself. I delved back into PPv1 LUT and compared it to current URP LUT, purely on the shader level (so not taking into account the other performance hits like Unity's terribly slow volume implementation).

    My findings: it is honestly embarrassing that Unity haven't fixed (the easiest part) of this yet. Here is the LUT code put through pyramid:

    PPV1 Default Settings


    URP PP Default Settings


    For those that don't know shaders: It's very easy - look at the last line of each. 18 instruction slots vs 38 instruction slots - heavily simplified, this means the URP LUT effect is by default 2* slower on the GPU than PPv1.


    How to fix it? Well, this won't get all the performance back, but to fix this egregiously easy performance hit for mobile, go into "Common.hlsl", replace the entire ApplyColorGrading method with:
    Code (CSharp):
    1.             half3 outLut = ApplyLut2D(TEXTURE2D_ARGS(userLutTex, userLutSampler), input, userLutParams);
    2.             input = lerp(input, outLut, userLutContrib);
    3. return input;
    (note: this will kill all color correction except your LUT, as it is a hack. Not that mobiles should need more than a single LUT to color correct anyway. I haven't actually tested this as I don't develop on URP but I am fairly confident that's all you need.

    So why do I think Unity have lagged on stuff like this for 6mo+ since bug reports? Simple. Their new PP stack, and SRP pipelines are a bloated mess, much like the Unity bureaucracy that has allowed them to become that way, so what should take one dev 2 hours to fix, now is an open bug case for over 6 months.
     
  14. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Interesting, and sad. Thanks for taking the time to do this!

    I see this is between PPV1 and PPV3, however is PPV2 any better than PPV3?


    Unfortunately this seems like the case for lots of issues with URP (for example the SpeedTree Shaders are broken in URP and it was a 2 line fix.)

    The URP team has their priorities completely out of wack, or there is a serious lack of competence/workforce.

    Now, not sure if this happens currently or not but -

    ↓↓↓

    What about having some sort of additional priority for bugs/improvements based on a rough estimate on how long they would take to be fixed, this would at least help get a substantial amount of issues cleaned up that are assumed to have a low "time to fix" yet have almost no priority in whatever order these things are currently being addressed by the URP team / Unity.
     
    Last edited: Jul 5, 2020
    Devil_Inside likes this.
  15. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    just for conclusion:

    does a chance to get 60fps on low mobiles [like as Android 6.0 phones / glES 3.1] with URP?? [projects as like as Boat Attack Demo]
    and when?? [any ETA?? which version of URP?? 8.3x? 9.x? 10.x??]
     
    Last edited: Jul 18, 2020
  16. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    It would say for low end and/or older GLES 2.0 devices, it's very hard if you use the new Lit shader from URP because of the realistic light model. Performence can be improved by using Simple Lit or you sacrifice lighting completely by using Unlit.
    The specular from Lit shader drains a lot of performence. With post processing on, no chance. Reference was a HTC One M7.

    A Lit shader with less texture inputs would be also useful ...
     
    Last edited: Jul 18, 2020
  17. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i mean low end glES 3.1 :]
     
  18. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    I'm glad I'm not the only one running into performance drops with URP after updating.
    Back with 2019.2 + URP 7.2 (Or around there) my project was running at a stable 60 FPS on a Samsung Note 8, now with 2019.4 + URP 7.4.1 it dips as low as 24 FPS and I don't think I've made any changes that would explain the huge performance drop other than updating URP.

    I've run the profiler on the phone and most of the frame time is spent on Rendering, so it's not like one of my scripts is causing it to suddenly be worse.
    I keep looking around for a magic setting that got changed that would explain the drop but I'm not seeing anything. It really just seems like URP got way slower.
     
  19. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    From what I recall in this thread, as quick summary:
    • It seems post-processing is the main performance offender
    • If you use post-processing, untick the "Stop NaN" option and check if it makes a difference
    • URP performance is worse than builtin on some devices, but not all
    • Unity Technologies don't seem to be able to reproduce most performance issues complained in the forums
    If you have a chance to submit your projects "2019.2 + URP 7.2" and "2019.4 + URP 7.4.1" to Unity Technologies to take a look, hopefully be able to reproduce it and work on a fix.

    Otherwise I have very little confidence those issues are fixed, if they don't get actual real-world-projects they can use.
     
    transat likes this.
  20. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    But they even admit the Boat Attack demo had performence drops.
     
  21. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    I ran a test where I created the same scene in 2019.2 and 2019.4 and 2019.4 was faster like you would expect, so I tried loading one of my backups from 2019.3.
    My project in 2019.3.10f1 runs at double the framerate compared to 2019.4.5f1. (60+ FPS on 2019.3 and ~33 FPS on 2019.4)
    I'm going to see if I can upgrade the mostly empty 2018.2 project to 2019.3 and repro it without all my game data included.
    Or alternatively if I can figure out what setting difference is causing it that would be helpful too.

    Edit: Ok I successfully reproduced it in brand new scenes, dragging one spaceship model from my game into a fresh URP project in 2019.3 and 2019.4 with otherwise identical settings...
    2019.3 runs at 21 FPS
    2019.4 runs at 11 FPS
     
    Last edited: Aug 1, 2020
    laurentlavigne and rxmarccall like this.
  22. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    True. But the repos are public and technically we're able to submit pull requests to fix some of the low-hanging fruit Unity can't find the time to sort out. I don't know how much of that is going on though. Maybe Unity should reach out to some of the talented shader devs in the community, as has oft been requested? And I think they should offer rewards for accepted PRs to make it worth an indie dev's time.
     
    DungDajHjep and GoGoGadget like this.
  23. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    Unfortunately I'm not able to reliably reproduce the lower framerate with 2019.4 + URP 7.4.1 well enough to make a repro project... it's like sometimes it runs at half the framerate one second, but wait long enough or reboot the app and suddenly it'll start running at full speed again.
    And I've seen the project built in 2019.3 do the same thing, so I guess it's an intermittent issue with both and not just that 2019.4 is slower.
    I'm not sure what causes it to run really badly sometimes then suddenly snap out of it and run smoothly again, but it seems like something isn't right.
    Edit: Sustained performance mode was for sure off.
     
    Last edited: Aug 2, 2020
  24. liiir1985

    liiir1985

    Joined:
    Jul 30, 2014
    Posts:
    147
    We had similar issue like you described, maybe you can try the following thing to look if it's the same issue:
    1. This regression is introduced in 2019.3.5, try use an unity version prior this version and after this version and see if it's the case
    2. The problem occurs if you have set targetframerate and the gpu load is just above the time it's needed to maintain that framerate
    3. Framerate will drop about 30% to 50%, reduce the gpu load a little bit it will then recover the framerate to normal

    We have purchased the source code license and found the location caused this problem, but don't know how to reach the dev, who's responsible for that code. It's apparently trying to fix some rare problem of some specific devices, after reverting that change, all performance regression in our project are gone
     
    laurentlavigne and Rich_A like this.
  25. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    can you share this solution?? XD
     
  26. liiir1985

    liiir1985

    Joined:
    Jul 30, 2014
    Posts:
    147
    I'm afraid I can't because it needs source code modification. the best way to solve this is if I could reach the dev to inform them about it or to make a repro project to file a bug report
     
  27. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,023
  28. liiir1985

    liiir1985

    Joined:
    Jul 30, 2014
    Posts:
    147
    DM sent
     
    Davood_Kharmanzar and aleksandrk like this.
  29. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    This is the biggest issue we have ATM;
    the CPU on consoles is going through the roof with URP.
    What we win on GPU,we lose all of it on the CPU.
     
  30. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    seriously? the URP cpu muching is higher than built-in? benchmarks please.
     
  31. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,708
    I’m seeing the same thing , not digging into it yet but flagging it.
     
    goncalo-vasconcelos likes this.
  32. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    I can't share benchmarks for the consoles, and modern computer are not affected as they are much more efficient to multi-thread. What I can say, it's the CPU is used to prepare the frame on forward rendering is heavily used and cost a lot. The side effect is also that this is causing the GPU to wait for the frame to be ready.

    We managed to save a bit by disabling shadows (take less time to prepare the frame), but it's kind of lame to disable the shadow on current gen consoles, because URP is eating all the CPU.

    I'm pretty sure it's the same on mobile, as one of the console we're developing is using the same hardware than some older gen android tablet.
     
    goncalo-vasconcelos likes this.
  33. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    but you stayed with URP so that means it's still faster than built-in overall... or other reason?
     
  34. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    Because It's heavily customizable, so even if at equal configuration it's not as good as the build-in, with the build-in you reach a point where you can't go lower.
     
    laurentlavigne likes this.
  35. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Interesting! Can you go more in detail beyond shadow off ? I'm not yet familiar with what's possible with SRP.

    Anecdotal counter evidence: I ran benchmarks on a downclocked tegra and found that URP was noticeably faster than forward, about 50% and almost on par with builtin deferred so I wonder what features you use that gives the opposite result. Skinmeshes? I haven't tested those yet and they don't benefit from SRP batching from what one dev said in a thread (thanks man for some transparency, hope you didn't get in trouble)

    My guess is that in a VFX heavy game URP wins hand down with the GPU particles. Call me an optimist or a fool to trust that system...
     
  36. DungDajHjep

    DungDajHjep

    Joined:
    Mar 25, 2015
    Posts:
    202
    Instead of making us show the benchmarks, why don't you upload your project so we can learn how to configure urp in our project?

    I am so fed up with people who always yell we upload a buggy project with urp, it's just a blank project, some sprite, post processing with bloom, color grading.
     
  37. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    On a personal level I feel the performance has increased a lot recently. I’m on 2020.2a21 and have now upgraded to URP 10 and things seem faster than they’ve been in a long time. Performance really depends on the nature of your project.
     
  38. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    Is URP 10 faster than 8 and 9?
    Every benchmark I run pushes URP ahead. Perhaps the others are using heavily optimized shaders, I only use standard/lit.
    today I tested skinmesh:
    Built in: 9.4 fps
    URP: 20.2 fps
    that's 2X !!
    with these on
    upload_2020-8-26_19-12-14.png
    haven't profiled CPU usage yet, lemme do that now... elevator music...
    upload_2020-8-26_19-17-47.png
    ignoring the right part of the graph with is lit shader in builting, you can see the left Lit shaders in URP with CPU in dark blue eating up a lot and in pale blue mecanim doing these weird plateau pulsing o_O
    in contrast standard in builtin is like a saw with nearly zero cpu usage
    upload_2020-8-26_19-22-14.png
    so yeah you better learn to love jobs because URP is a CPU fiend!
    could be better
     

    Attached Files:

  39. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    on a side note, something weird I noticed: skybox intensity = 1 will give this in builtin
    upload_2020-8-26_19-30-40.png
    and that in URP:
    upload_2020-8-26_19-31-5.png
    gotta nearly double sky intensity to get the same look
    upload_2020-8-26_19-33-14.png
    super saturated colors too...
     

    Attached Files:

  40. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    One would hope so! In an ideal world each new version would be faster. Without having done thorough testing, it looks like I’ve gained almost 10fps going to URP 10. And that’s with SSAO added in as well. But it could be down to something else - so many factors in play to determine performance.
     
  41. sebsmax

    sebsmax

    Joined:
    Sep 8, 2015
    Posts:
    118
    FYI, the way to do benchmark is not to count the FPS but the Ms.
    The FPS gives a good indication overall, as it's a good indicator for the last second.

    But in a game you can end up with your CPU and GPU that are bound and gives huge spikes. This could result in a 30fps but feel chunky because during the lasts second the amount of time to output a frame as been going between 1ms to 200ms.

    To reach a stable 30 fps, you can spend per frame 32ms.
    And for 60fps you can spend 16ms only.

    On your graph above you can see the amount of milliseconds for your CPU that is going between 4ms and probably 6ms (I can't really say), but it would be already above 150fps.

    So if you reach a total of 20 FPS at the end, I can only guess that you are GPU bound and the graphic card is using all your resources with probably 35-40ms to output a frame.

    Also you have enabled a lot of settings that are supposed not to be enabled for all platforms.
    - compute skinning, you are moving the task for some skinned mesh from the CPU to the GPU, offloading the CPU even more when it doesn't needs it.
    - graphic jobs will crash on certain consoles after playing for 10min.
     
    cosmochristo likes this.
  42. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,358
    From.my experience urp and hdrp are vastly worst in performance, for mobile i suggest standard pipeline and custom shaders, which is by million miles more optimized than anything standard in urp.

    Hdrp shader is pretty unusable as well even on high end machines, just extremly heavy if not need all effects.
     
    Last edited: Aug 28, 2020
    NoFS likes this.
  43. MarkFaasen

    MarkFaasen

    Joined:
    Oct 23, 2018
    Posts:
    13
    I can confirm that perfomance is degrading. After running a simple 2d game dev-build on my phone with sub 20fps i resreached on performance issues and stumbled accros this thread. After i istalled 2019.3 with URP 7.2 i got about 40fps. Then i ditched the URP PP and installed the PPsV2, used the "same" effects (bloom with fastmode) and now i have reach 50fps. This is very strange. I will stick with this version for the coming months i guess...
     
    DungDajHjep and nasos_333 like this.
  44. cosmochristo

    cosmochristo

    Joined:
    Sep 24, 2018
    Posts:
    250
    Good point, I think we need to know more about how GPU bound apps perform with the different pipelines.
     
  45. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    From my testing PPV2 runs much better than URP post processing.
     
  46. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,358
    Thanks for the heads up. I wonder also how draw instanced geometry behaves vs the standard.
     
  47. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    I ended up ditching URP post processing altogether and went with one of the many "Fast Mobile Post Processing" assets on the asset store for a few bucks... They function as "Renderer Features" instead of as post processing, so I went in and commented out the Update function that updates volumes for post processing whether you're using it or not and my FPS went from 40 to 60+. Quality is like 80-90% as good. You lose the ability to have different PP volumes throughout a scene.
    Supposedly an option to disable updating post processing volumes without modifying code was coming soon, idk if the latest version has that or not.
    URP is pretty fast, but some of the ways things are implemented where they run in an update function whether you use them or not seem to hold it back.
    Hopefully more stuff like the ability to turn off updating volumes every frame is added so I don't have to go in and delete all the stuff I don't want every time there is an update to gain like 5-10 FPS.
    For low end devices the little stuff like not looping through shadow code every frame when shadows aren't even used adds up fast.
    Still, the fact you can go in and comment out junk you don't want makes URP leaps and bounds better than the black box that was standard.
     
    Last edited: Sep 16, 2020
  48. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    very cool info
    you bought the stuff by Rufat?
     
  49. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
  50. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    I also experienced some strange issues related to the fps with 2019LTS.

    When framerate drops for 30-50%, will touching display bump it up instantly to 60fps?

    There is another issue, if you set targetframerate to 60 you would expect rock-solid 60fps as it was on older Unity versions, but somehow framerate is not stable, you get 60fps for few seconds, and then in a split-second drops to 58-59 fps and gets back to 60fps. The same thing happens in the editor on my more or less high-end PC. Setting targetframerate to 61 fixes this on mobile, more or less.

    Unity 2019LTS, Built-in rendering pipeline, Android, S7 Edge.

    You would expect more improvements with the new Unity versions, but all we get are more problems, more broken things, and worse performance than before. I'm spending 5 times more time detecting and trying to pinpoint issues than I work on my project which worked totally ok on the previous 2017 version.