Search Unity

Mutiple camera masking issue.( need someone thinking with portals)

Discussion in 'Shaders' started by Yoirgla, Oct 10, 2017.

  1. Yoirgla

    Yoirgla

    Joined:
    Jan 2, 2015
    Posts:
    20
    Hello everyone.

    I'm doing a tech test for the fun of it and try to reproduce Portal in VR.
    I'm facing an issue maybe you guys can help me with.
    For the moment, each portal's shader is a Depth mask showing the Camera that is behind.
    portal.png
    This works but only to some extent. From time to time, i have one of my shader showing the wrong camera.
    (I can explain why but it's quite long and maybe I need to create a video for it)
    So my question is this :

    Does anyone know if there is a shader that can take the pixels of a camera of my choosing and replace the object's pixels with the pixels from that camera ? But ONLY that camera, not other ones who may be at different places in the renderqueue.

    I can't really use rendertextures because of asynchronous timewarp and because of the fact it's VR => 3D.
    Let me know if it's unclear. otherwise I can always do a video for you guys.

    Thanks.

    Yoirgl.
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    I'd recommend using the stencil buffer for this. That should also work fine for VR and single pass stereo. The other way would be RenderTextures, but those are not supported for VR camera's, so you'd have to split into separate camera's.