Search Unity

Question How to cull objects behind ui

Discussion in 'General Graphics' started by VictorKs, Dec 4, 2022.

  1. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    Bottom quarter of my screen is covered with UI all the time how can I stop things behind it from rendering?

    My ideas:
    1)Customize culling: But how could I do that? I mean can I influence built-in culling? There is a Camera.cullingMatrix could this work? Or do I need to roll my own culling algorithm?

    2)Can I change camera screen size so it skips bottom quarter?

    3)Maybe I could do a scissor test with a command buffer that would save me the execution of fragment shaders.

    4)Maybe I could render camera to a smaller render texture(without bottom part) and then output that render texture to the camera?

    What direction should I take to solve this problem? Drawing a quarter of the screen without needing is really wasteful.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
  3. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    But will this actually reduce resolution for gpu calculations or just scale them down to fit the smaller rect. Because when I change rect size I get the same frame result just scaled down. Maybe I also need to change my other camera settings with the rect.