Search Unity

The URP post processing “Bloom” has too much draw calls.

Discussion in 'Universal Render Pipeline' started by Mr_TZ, Dec 1, 2019.

  1. Mr_TZ

    Mr_TZ

    Joined:
    Apr 5, 2018
    Posts:
    12
    The post processing stack v2 bloom has a paramter that can control the blur times of the effect.
    But after i upgrade to URP.The bloom does not contains that paramater.
    So the drawcall of Bloom is increasing from 2 to 22.
    It's performance awful.
    I can't use it anymore.
     
    dev_34Disorder, Opeth001 and Chmyke like this.
  2. Mr_TZ

    Mr_TZ

    Joined:
    Apr 5, 2018
    Posts:
    12
    PostProcessPass.cs

    const int k_MaxPyramidSize = 16;


    this controls the downsampling times.

    this should not be a const value.

    Because of the purpose the URP,it should be performance friendly to mobile or vr platforms.
     
  3. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    A 16-texture bloom is absolutely insane, that's movie-CG level bloom, overkill for just about any existing use case tbh. As you mentioned, there's no reason that should be a constant - but looking at the naming scheme, it looks like Unity intend for it to be like that :/
     
  4. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    If I recall correctly you have worked with post processing a bunch so I trust your experience :) , do you have any manual tips to squeeze better performance out of URPs post processing?

    Seeing stuff like this is very concerning, as I imagined Unity would atleast have options for the fastest possible settings.

    Cheers
     
    GoGoGadget likes this.
  5. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Given the lack of real customization options they give you in-editor, you have one choice if you stick with URPs post-processing: Edit it and maintain your own version. Decreasing the bloom k_maxBloomPyramid (IIRC) var from 16 to 8 will instantly save you 8 passes for instance, the rest of what you save is up to you.
     
    Ahmadhp and o1o101 like this.
  6. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Hey,

    So in practise you would think this, and when you think of it as pure number of draw calls then yes it seems a bad idea, but I would suggest you profile it, as 80% of the cost of bloom is the initial sample down and the last sample up in the pyramid, the successive iterations become exponentially cheaper, which is why we have so many, if you were to change it to 8 vs 16 I would be surprised if you gained more than 10% performance.

    I have looked at this myself in the Boat Attack demo as I though it was insane too and when I asked the developer about it I was explained this, so I then went back to profiling to see the cost of each sample and saw that it indeed becomes was less costly with the huge benefit of being able to have very wide blooms that can cover the entire screen.

    If you want to speed bloom up the number one solution is the initial resolution you start with, and if developing on mobile you might be hitting the issue of silly screen resolutions.

    One thing that could be improved is that we could skip right down to quarter res rather than going to half res for the first/last iteration but this will impact the quality severely as it will skip any small details completely and lead to massive amounts of flickering.

    We know bloom is our most expensive post processing effect by large, but without crippling the quality we are still tossing ideas up on the best compromise.
     
  7. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    That's all true, including what your developer said - but they obviously haven't thought about all the use cases for bloom in a universal render pipeline.

    Mobile bloom, more often than not, just requires a small glow around objects - even modern mobile games like TES:Blades don't use more than that, which can be achieved in ~2 textures, maybe 4 for very high quality bloom. Even if the extra individual passes in the GPU profiler don't look like they add up to much, any mobile dev will tell you that looping through two for loops ~12 more times than they need to, while adding 12 extra passes, is far from best practice. It is trivial to at least add in the option for mobile users to set the maximum # of passes and maximum bloom texture size - something that as you mentioned is also an issue, and should be controllable in the pipeline (as it is in some 3rd party assets, like PRISM).
     
    ViraGW, Alex-CG, Ruslank100 and 6 others like this.
  8. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Interesting, can we use use some sort of SRP batcher, that we no need to bother of draw calls number for post process effects?
     
  9. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    I agree - stop running the URP demos on giant PC monitors and run them on 5" mobile and Nintendo Switch screens - which is what we are all using URP for. The default should be maximum performance for all settings first and foremost. Much easier to ramp up the visuals on our end (the game developer side) than to examine every minute setting to squeeze out performance.
     
    Last edited: Dec 12, 2019
  10. mayu

    mayu

    Joined:
    Mar 1, 2014
    Posts:
    2
    Physical screen size != Render resolution

    There are 5" devices from 2013 with current average PC monitors "1920x1080" resolution, the switch does 1080 tv to 720 hand held.

    Question... is all of this poor performance due to depth texture being forced on by the render pipeline???
     
  11. hellowill89

    hellowill89

    Joined:
    Jan 8, 2013
    Posts:
    45
    Yes, it is far too costly for mobile platform currently
     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,525
    Yes please options to choose half or more or full
     
    Ruslank100 and powersupersport like this.
  13. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Wasn't "performance by default" supposed to be a thing that Unity is trying to achieve? What if we don't need "very wide blooms" on the screen, but much more subtle glows? We pay for it regardless. Please expose the quality options instead of shipping your tech demo code and calling it production ready.
     
    arkano22, Regone, Alex-CG and 4 others like this.
  14. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I think it will ultimately come down to the choices. Just enable the iteration numbers etc exposed as public value so the developers can choose the value they like.
     
  15. interpol_kun

    interpol_kun

    Joined:
    Jul 28, 2016
    Posts:
    134
    I was waiting for the "optimized" URP PPv3 just to see this, interesting. Can you just expose as much parameters as you can instead of telling us that already heavy PP effect should have more draw calls for a sake of nothing. I already have 20 FPS with only bloom being enabled (and 2 static sprites on the scene) with current LWRP PPv2.

    It's obvious you'll never be able to develop a performant mobile game using URP + PPv3. Look at any developer conference out there and see how people achieve performant bloom on mobile devices. There are so many hacks, they fighting for every ms and you just waste precious resources on unnecessary stuff. Look at the Raid Shadow Legends speak from your OWN conference for example.



    It's an another proof that if you won't start developing your own production ready games you will never provide anything good for us.
     
  16. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Well whenever this kind of thing happens in Unity we had plan b called asset store... but the problem with current case is that the asset store developers cant make alternative solution (yet) for the post processing in urp. Which, is ironically, in my opinion the worse situation to worry about... Personally I never used ppsv1 or ppsv2 in non srp applications because of either lesser performance or lesser quality of it. Sometimes it makes me wonder if this is actually a business model? Dont get me wrong. I still like Unity for its flexibility and as a tool.
     
    Ruslank100 and GoGoGadget like this.
  17. andrejpetelin

    andrejpetelin

    Joined:
    Oct 14, 2017
    Posts:
    31
    I disagree. They renamed it to Universal Render Pipeline from LightWeight because it was meant to target a wide range of devices. If they keep removing features soon we'll be left with monochromatic 16 shades of grey rendering and a max display of 640x480.

    It's a universal solution (allegedly... I don't know how universal it is, the results are below expectations so I'd expect it should be able to run on a potato), not mobile only. Plus Android is not a phone only OS, you can have Android on a TV device.
     
    Ruslank100 likes this.
  18. interpol_kun

    interpol_kun

    Joined:
    Jul 28, 2016
    Posts:
    134
    The most universal solution is to expose as many performance-related parameters as possible. Not to keep such basic performance sensitive parameter under the hood. I have no problems seeing 16-texture bloom on URP as default as long as I can control that option without creating my own PP effect.
     
    ViraGW, Immu, Ruslank100 and 5 others like this.
  19. andrejpetelin

    andrejpetelin

    Joined:
    Oct 14, 2017
    Posts:
    31
    I do tend to agree. Personally I think it's maybe not the best time to be using Unity... the old render pipeline is not getting any more love - there's been issues with flickering shadows since like 2010 and they still persist to this day, except the current stance is "move to URP or HDRP instead, we're not fixing that" except when you go to URP the shadows are pretty much even worse... I don't know. Maybe one day they'll get it right :)
     
  20. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    Nope. Grand strategy games and RTS games need optimization for everything. Please dont make assumptions like this.

    But I agree. URP is because we want fastest, not prettiest. So default should be fastest.
     
    Last edited: Jan 22, 2020
  21. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    365
    Haha dam, came here wondering why i was wasting milliseconds on bloom and how to fix it, cool to see its intended and there's no fix :D
     
    ViraGW, Ruslank100 and andrejpetelin like this.
  22. Ahmadhp

    Ahmadhp

    Joined:
    May 31, 2013
    Posts:
    33
    Alex-CG and Lars-Steenhoff like this.
  23. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hey

    How/where did you change the amount of downsamples in PPv2? I haven't seen that parameter, but I would like to further optimize the bloom in PPv2.
     
  24. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    when will be come shader quality switch feature on URP 10 ??
     
    Lars-Steenhoff likes this.
  25. Vongsomxai

    Vongsomxai

    Joined:
    Feb 23, 2017
    Posts:
    3
    when k_MaxPyramidSize = 2 you can have some bloom in Oculus quest. But 4 or 8 ---- nope.
    I didn't work on empty project. But I have a need to edit this file please do not reset the code every single time.
     
  26. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    I read the bloom shader and script and real time it does indeed, more than 4 iterations later and the resolution is negligible!
    But there are a couple of fast bloom tools on the asset store, which only use 1/8th resolution for calculations and no dithering, but lose the Gaussian blur.

    All in all, bloom can be chosen between cpu and gpu.
     
  27. FranFndz

    FranFndz

    Joined:
    Sep 20, 2018
    Posts:
    178
    i already profile it on my target device, i exposed the property and reduce it to 4, it gave us huge MS benefits.
    (it wont look as good)


    pd; we decided to make or own bloom (more control for blurry type and texture size)
     
    ViraGW likes this.
  28. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Unity really needs to expose more paramaters. Set the default you want, but let us have the ability to change it easily.
     
    ViraGW and Yigeun like this.
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I completely agree. I don't care what the default setting the Unity thinks it is supposed to be good. We should have complete control over the parameters and expose them so we have choice on what we think it is good for each project cases.
     
    ViraGW likes this.
  30. PrateekPanwar

    PrateekPanwar

    Joined:
    May 13, 2020
    Posts:
    5
    In Unity 2021.3.8f1 (as of now), How can I change k_MaxPyramidSize?
    I'd be very helpful.
     
  31. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    My dude... Implying that a 10% performance gain its a small thing is sooooo wrong for a variety of reasons... You should not treat developers like that, being a developer yourself (i assume you are), I mean, its just insane to read such comment. Anyway, using 2021.3.12f1 here and i can tell you, URP is the worst it has ever been right now. How come we are in the year 2022 and we have worse technology available for us devs than in 2018? Yes i know, its an exageration, but be sure as hell that it does feel like that some times, specially when you see things like this one, a 2022 bloom PPFX is absolute garbage when you compare it with the bloom PPFX we had back in the day (around 2015-2017)... And how come that nowadays everything feels so damn bugged and strict? i remember all a while ago pretty much all effects had a ton of config option and you could even edit the code/shaders without much trouble... Ngl, unity's way of doing thing in the last couple of years has been just dissapointing, tbh it seems like the fact of naming the engine versions as the YEARS is a complete S*** show of a race nobody is able to win, cause my dude, we are at the doors of 2023 and the most reliable stable versions to work with are between 2018-2020... Thats just dissapointing, but hell, what could we expect from an administration which bussiness model revolves around hiding its own brand from players, right?
     
    blade0, ViraGW, bart_the_13th and 5 others like this.
  32. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    Couldn't agree more!
     
    Last edited: May 11, 2023
    deadlycrow likes this.
  33. ViraGW

    ViraGW

    Joined:
    Aug 25, 2023
    Posts:
    1
    I enabled bloom and went from 30 (target) to 22 FPS. Couldn't find any meaningful parameter to tune the performance, then found this thread. It's really disappointing this is still the case in 2024.

    This old documentation has 2 sets of bloom (optimized and normal) with many settings well documented for each effect. It looks like the mobile optimized variant was dropped entirely at some point.

    10% can be 24% and more depending on specs, load and so on. I don't know why this optimized version couldn't be included in PPV2 or URP post processing stack. Current implementation is overkill for my needs and I need the extra performance.
     
  34. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    Funny how that post was before the whole unity debacle of this year hahah
    BUT ITS STILL HAPPENING in 2022.3.18f1 hahahaha
     
  35. ryanmillerca

    ryanmillerca

    Joined:
    Aug 12, 2012
    Posts:
    143
    Universal RP v 14.0.8 (or possibly earlier) has added in some options for us. Bloom now has Downscale (quarter, half) and Max Iterations (2-8) properties for us to tweak. Max iterations can bring down draw calls as you would expect.

    Thanks for listening, devs!
     
    JesOb and Lo-renzo like this.
  36. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    +1 Thank you!