Search Unity

Question Using Command Buffers with the Scene View Camera

Discussion in 'General Graphics' started by MiSFrey, Jan 19, 2021.

  1. MiSFrey

    MiSFrey

    Joined:
    Jan 19, 2021
    Posts:
    2
    I'm currently trying to implement a "view mode" for the scene view window that shows certain objects in relation to their occluders.

    Regarding the setup: Many environmental objects, like walls, stacks of crates, and so on have occluders which are approximate volumes that are used for rendering line of sight. To make it easier to debug these occluders a special view is to be implemented that marks parts of meshes inside of their occluders green while those outside are marked red.



    The view has to be able to render many of these objects at the same time since the scenes feature a lot of objects with occluders.

    My current approach is to render the front and backsides of the occluders into depth textures and then comparing the fragment depth of the object to those. If a fragment is between the min and max depth of an occluder it's rendered green and otherwise, it's rendered red. This is done by using a command buffer on the camera.

    The problem is, that while I seem to be able to add command buffers to the scene view camera, they apparently aren't executed.

    Is there any way to execute command buffers on the scene view camera? Alternatively, I'll take suggestions as to how I could create the same effect in a different way.