Search Unity

Segmented rendering via ViewPort clipping

Discussion in 'General Graphics' started by arnebp, Oct 29, 2015.

  1. arnebp

    arnebp

    Joined:
    Oct 15, 2013
    Posts:
    22
    I have set up a scene that renders segmented parts of the scene in high detail via viewport clipping. I am doing this using 2 cameras. One camera rendesr the full scene in low detail and another renders a segmented part of the viewport in high detail. The 2 RenderTextures of the cameras are finally combined using a 'combine depth' shader.



    I am experiencing 2 challenges using this approach.

    First, the segmented area is set up to update as I move the mouse around. That means that the perspective projection matrix of that camera is updated when the mouse is moved. I am experiencing a 'trailing' effect when I move the mouse fast, which indicates that something I am doing is very expensive performance wise. I am unable to identify what this might be?

    Second, I would like to apply a 'circular mask' on the camera that renders the segmented region. I am looking for a method to do this that is inexpensive performance wise. I have experimented with several approaches. I have been unsuccessful in solving this with replacement shaders on the segmented camera. I am looking for some ideas on how to do this?




    The project is available for download here. Please download if interested and have a look.

    Thanks!
     
    fffMalzbier likes this.