Search Unity

Depth Texture forced due to post processing - but only using bloom + color correction

Discussion in 'Universal Render Pipeline' started by Prodigga, Sep 26, 2019.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hi there. If I only want to use bloom and some other simple post processing effects like color correction, the camera forces the depth texture to render. This eats up performance, and the depth texture isn't even used by any of the effects.

    Is this intended? For mobile, this is not very great for performance. We don't need the depth texture for the effects we pick, so it shouldn't be forced on, right?

    2019.3b, URP 7.1.2.

    Simply the act of ticking on the PostProcessing checkbox on the camera results in doubling of drawcalls and the entire depth texture being rendered for seemingly no reason.
     
    Last edited: Oct 18, 2019
    Peter77 and Tartiflette like this.
  2. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    You can modify this line in UniversalRenderPipeline.cs file
    cameraData.requiresDepthTexture |= cameraData.isSceneViewCamera || cameraData.postProcessEnabled;
     
    mkracik likes this.
  3. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Cool, and thanks for the workaround. Though I should have been clearer - I am reporting this more as a 'bug', I guess? I really just wanted to double check that this was the intention before I file a bug report. It doesn't seem right that depth textures are enabled without even checking to see which post processing effects are enabled, right? The post effects should have some way to signal that they require the depth texture, and if you do not enable any post fx that require the depth texture then the depth texture should be disabled.

    It is clear in that snippit of code above that no checks are being performed and that it is blindly assuming that depth textures will be required if post processing is enabled. This isn't always the case right?
     
    interpol_kun likes this.
  4. interpol_kun

    interpol_kun

    Joined:
    Jul 28, 2016
    Posts:
    134
    Yeah, or more like feature request.
     
    Prodigga likes this.