Search Unity

Question Why Camera.Render calls Volume.OnEnable even if PostProcessing is disabled on it?

Discussion in 'High Definition Render Pipeline' started by alexandre-fiset, Apr 26, 2022.

  1. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    We use a Camera with RenderTextures to stream journal pages on a notebook. The four cameras are all super barebone, with everything unticked in Custom Frame Settings.

    Still, each camera takes 40 ms to do the Camera.Render. Why is that? We have 7660 GC.Alloc calls for no reason and it seems like all post processing effects get called as well.

    Is there any way to work around this?

    upload_2022-4-26_14-42-49.png
     
    Last edited: Apr 27, 2022
  2. Julien_Unity

    Julien_Unity

    Unity Technologies

    Joined:
    Nov 17, 2015
    Posts:
    72
    Hi,

    The reason why you are seeing Volume framework related call is because the volume framework is not just about post processing. Pretty much all features in HDRP rely on the volume framework.
    We maintain one instance of the volume stack per camera (because all cameras might interpolate differently) and if a camera is not used for a while we free all the data associated with it. This is most likely what you are seeing here, at the moment the camera is enabled, we need to initialize the volume stack for it. To go around that you can use this API https://docs.unity3d.com/Packages/c...n_HDAdditionalCameraData_hasPersistentHistory on the HDAdditionalCameraData component. This tells the system that it should keep internal data around even if the camera is not used. This should prevent this kind of patterns to happen.
     
    alexandre-fiset likes this.