Search Unity

Cubemap rendering performance bottlenecked by the render pipeline

Discussion in 'Universal Render Pipeline' started by Fewes, Oct 8, 2020.

  1. Fewes

    Fewes

    Joined:
    Jul 1, 2014
    Posts:
    259
    Hi there,

    In the process of trying to create a very efficient time of day system, I am rendering a single inverted sphere mesh to a reflection probe. The sphere uses a shader which renders a simple ground plane, some clouds and atmosphere in a single fragment shader (meaning I am not rendering any geometry or even the skybox to the probe). After the reflection probe finishes rendering, it is then reduced to spherical harmonics on the GPU which provides accurate IBL without having to sync anything to the CPU. This would result in a dynamic time of day with nice reflections, ambient lighting and good performance, or so I thought.
    Using the profiler, I can see that a significant amount of time (almost 2ms) is spent every frame rendering the reflection probe. It is worth noting that this happens even if the resolution is set to 16x16px per cubemap face, I am rendering nothing to the probe and I've got the time slicing set to "Individual Frames", which results in the smallest performance hit. I suspect that I'm hitting a bottleneck caused by the render pipeline here, and the profiler seems to confirm:

    probeperf.png

    I could maybe get around this by writing my own code for rendering the cubemap, but the code for the specular convolution is closed off and the shader code available is extremely hard to understand. A Graphics.ConvolveCubemap() function which uses the same code as the reflection probes do internally would be wonderful, especially if it has a time slicing option.

    Additionally, why can't I specify the ForwardRendererData or UniversalRenderePipelineAsset for a reflection probe? This seems like the perfect place to be able to configure a high-performance renderer where unnecessary features like culling are turned off.
     
    Ruslank100 and MP-ul like this.
  2. MP-ul

    MP-ul

    Joined:
    Jan 25, 2014
    Posts:
    230
    Well this is interesting. I wonder if others have hit this kind of problem.