Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Why Do Volumes Process If They Do Not Exist?

Discussion in 'Universal Render Pipeline' started by RedVonix, Feb 11, 2020.

  1. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    I am getting plagued with some performance problems in a game we are working on, and in profiling, it looks like the VolumeManager is doing some heavy processing in our scene - however, we don't even have any volumes in our scene! Check the attached photo and you can clearly see the VolumeManager going crazy.

    What is causing the volume manager to do such heavy processing even with zero volumes in the scene? Is it possible to just disable the volume manager entirely?
     

    Attached Files:

  2. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Yes this is a problem, we have no way of knowing if a scene has a Volume in it or the render needs to sample the volume system. In saying this it would be a good idea for us to add and advanced option to opt-out of checking the volume system to save on the performance if you know you do not need it.

    Would you please open a bug for this, as we would like to make sure we can action it, since it is a performance issue we will consider it a bug.
     
    Lars-Steenhoff likes this.
  3. Tudor_n

    Tudor_n

    Joined:
    Dec 10, 2009
    Posts:
    359
    Was doing a similar thing today. I had a good chuckle when I saw them.

    This gets worse when you realize it's done per camera. 25% of our frame time is spent doing this. Quite another serious chunk is spent doing Post-Processing setup ( which we also don't use and also per camera ). Some of it seems volume-related as well. IMHO, this is a major oversight, rather than a bug.

    We use a dual-camera setup for UI/ rendering. Even if we would have used Post and Volumes, the ui one should really not pay this cost. Ultimately, this makes URP less interesting to us. Regretfully, there are too many risks in URP right now imho, would not use in production as of yet.

    upload_2020-2-11_17-22-27.png
     
    Last edited: Jul 28, 2020
  4. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Created a bug report (number 1218778). Would it be possible for me to be informed of and provided updates on this? It is currently preventing us from being able to submit updates to a client due to the performance issues (I can't really send them a build that gets 10fps).

    Thank you!
     
  5. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Thank you! And yes, you should receive updated from the bug-report itself, so here you will know the status, I will also try to remember to post here when we have more of an idea of when this work might happen.
     
  6. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    421
    Great thank you! I hope work can be done soon, as my client is waiting as we speak. :)
     
  7. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    This still doesn't seem fixed as of 2019.4.5f + URP 7.4.1.
    I have the only post processing volume set to "global" but profiler shows "VolumeManager.Update()" taking a third of the total render time.
    Am I missing something or is this just still not fixed?
     
  8. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    The volume system in URP was made based off the same system in PPv2, which has similar CPU performance issues involving volume and post-process setup due to the very way it was designed. The only way to really "fix" it is to re-think and re-write it from scratch.
     
  9. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    Yeah, I guess. There are paid assets on the asset store that claim to do similar quality effects like bloom and tone mapping for a fraction the overhead of URP integrated PP (250% faster according to the asset), so I guess it might just be one of those things where you can pay some random dude $14 for better mobile post processing than the unity team could ever do...
    Still, usually assets like that arrive at their final results in a hacky way that will probably be broken by every other future unity/URP update... and using unity built in stuff is usually less of a hassle in that regard.
    So incremental improvements to the built in unity stuff is always nice.
    Like was mentioned farther up, all it really needs to not waste render time is a toggle somewhere for using post processing volumes without global enabled.
    It isn't like the performance is that terrible to begin with... but it's still not really viable on anything but the latest flagship mobile devices. (From 60+ FPS without PP to 44 FPS with bloom + FXAA on my Note 8)
     
    Last edited: Aug 5, 2020
  10. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    I tried one of the post processing assets from the asset store and even though built in post processing is disabled and the post processing package uninstalled with zero volumes in the scene it still spends 1/3rd of the total rendering time updating volumes...
    So it is literally unavoidable no matter what you do...
    URP is supposed to be more open source and flexible than standard right? That was the whole point of it's existence? So it would presumably be possible for a pro to go in and change this functionality themselves if they wanted?
    Edit: OK that was super easy... I just went into VolumeManager.cs and commented out the update function and boom 30% faster rendering.
    If it's that easy why is there no way to toggle it off on the render pipeline asset...
    That really makes me wonder how blazing fast a pro could get URP by going in and deleting all the stuff they don't need.
     
    Last edited: Aug 7, 2020
  11. Elvar_Orn

    Elvar_Orn

    Unity Technologies

    Joined:
    Dec 9, 2019
    Posts:
    160
    I have a PR that introduces a dropdown in the renderers so you can choose between URP updating the volumes every frame or you do it via scripting. The PR is currently in testing.
    https://github.com/Unity-Technologies/Graphics/pull/750
     
    shinyuri23_imc, _geo__ and Meceka like this.
  12. Saturn1004

    Saturn1004

    Joined:
    Nov 14, 2014
    Posts:
    42
    Great. That'll help.
     
  13. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,298
    Any intel on when this might land? And will we be able to turn this on/off at runtime? Would love to let the users turn PP on/off in the settings or maybe even add this to the "Adaptive Performance" package.

    I have resolved it for now by disabling the Volume update whenever postprocessing is disabled. This does at least remove the overhead in cases where PP is off.

    Simply add this in "UniversalRenderPipeline.cs":
    Code (CSharp):
    1. static void UpdateVolumeFramework(Camera camera, UniversalAdditionalCameraData additionalCameraData)
    2. {
    3.     if (additionalCameraData != null && additionalCameraData.renderPostProcessing == false)
    4.         return;
    5. ...
     
    Last edited: Aug 12, 2020
    ApenasVB likes this.
  14. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    823
    Any progress on this? The Github PR is closed and in Unity 2020.3.0f1 the overhead is still present.
     
  15. caletbak-sp

    caletbak-sp

    Joined:
    Dec 11, 2018
    Posts:
    6
    Wow a message from today just when I found the same issue :p
    Yes it would be nice a fast update of the URP package as it does not seem too complex to fix this.
     
  16. drallcom3

    drallcom3

    Joined:
    Feb 12, 2017
    Posts:
    163
    I stumbled upon this today in my profiler. Is it still not fixed? Judging by the Git entry it's not happening anytime soon.
     
  17. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    823
    With Unity 2021.1 it is now supported to disable the post-processing layer in the Forward Renderer Data:
    upload_2021-5-16_0-37-44.png


    I still see some unnecessary UpdateVolumeFramwork, but I think it got less than before :)
    upload_2021-5-16_0-36-37.png
     
    SolidAlloy likes this.
  18. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    391
    Is there any way to apply this optimization to Unity 2020 LTS? @_geo__ I can't seem to apply your suggestion as changes made in UniversalRenderPipeline.cs are overwritten to the package defaults on recompile.
     
  19. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,298
  20. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    391
    @_geo__ Oh nice! Was not aware of this, appreciate that added bit of wisdom. I will do just that and apply your above fix, thanks man!
     
    _geo__ likes this.
  21. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    242
    I met this issue too, but was surprised this was released in 2021.2 :
    https://portal.productboard.com/uni...-effects/c/688-volume-system-update-frequency

    I cannot find the setting anywhere in the pipeline settings (please answer here if you find it !), but this can be set on a per-camera basis :
    upload_2022-3-30_19-19-37.png

    Haven't tested yet the performance implications, but my intention is to completely remove the 0.5ms spent on the main thread for updating the volumes, on our target device.
     
  22. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    245
    I'm struggling to find any documentation on what function to call to make the 'Environment' update when I'm set to 'Via Scripting' - any help anyone?
     
  23. Midiphony-panda

    Midiphony-panda

    Joined:
    Feb 10, 2020
    Posts:
    242