Search Unity

Best Practices for HDRP Minimaps?

Discussion in 'High Definition Render Pipeline' started by DK_A5B, Dec 4, 2020.

  1. DK_A5B

    DK_A5B

    Joined:
    Jan 21, 2016
    Posts:
    110
    I’m curious what the best practices are for creating minimaps in HDRP. A standard approach with other render pipelines is to use a second (overhead) camera, render this to a texture, and then place the Render Texture as a Raw Image in the UI. This approach also works in HDRP, but as it has been noted is several places, extra cameras in HDRP come with significant performance costs.


    The cost of an additional Camera in HDRP can be mitigated by selecting “Custom Frame Settings” on the Camera and using the overrides to turn off all the features that won’t be used by the minimap Camera (unused post-processing, shadows, reflections, etc.). This certainly helps, but the cost is still not insignificant.


    I know that HDRP has a Graphics Compositor which can be used to combine image sources from multiple places (for example, from multiple Cameras). I haven’t experimented with this yet because the documentation explicitly states that the Graphics Compositor “is not recommended to be used in performance critical applications such as video games” (under the “Performance Considerations” section). For this reason I’ve held off on experimenting with it, although the Compositor has multiple components to it and I wonder if that warning is intended to apply to some parts (like Graph-Based Composition and 3D Composition) and not others (like Camera Stacking). Also, most of the cost seems to come with rendering the camera, not compositing the image, so I don’t know how much performance gain could really be extracted using the Compositor.


    Obviously, another approach to take is to generate the minimap without using a second Camera. It’s straight forward enough to take your world state data and write a representation of it out to a 2D image. However, at that point you’re basically just writing another rendering pipeline (albeit a highly simplified, 2D one) and, ideally, I’d like to use an out of the box solution. If this is the best approach in HDRP, so be it, but that seems unfortunate.


    If anyone has any tips or ideas on how to squeeze better performance out of a second Camera, or better options for how to setup a minimap I’d really appreciate it. I’m just looking to understand what the best practices are for setting up a minimap in HDRP and how best to tune that setup to minimize the performance impact.
     
  2. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    436
    Have you managed to find any decent solution?
     
  3. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Ruchir likes this.
  4. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    436
    thanks! that was my first go:to section, but I am wondering how it will perform. I guess I'll have to find out! :)
     
  5. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    CustomPassUtils RenderFrom -functions are blazing fast in comparison to separate camera. It's just what you can render with them may not be what everyone wants for minimap usage. If you just render select objects color from ortho view, it should work fine.
     
    nehvaleem likes this.
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    anyone got this working? i'm trying to use renderfromcamera to a rendertexture and it seems the rendertexture output only rendered once, like the rendertexture not updating when the camera render target are moving.