Search Unity

SetTargetBuffers with stereo camera (Solved)

Discussion in 'AR/VR (XR) Discussion' started by jvo3dc, Oct 21, 2016.

  1. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    I made a custom reflection before that uses SetTargetBuffers to assign a separate depth buffer. (That way I can read from the depth buffer later.) SetTargetBuffers doesn't seem to work when the camera is in stereo mode though. (Also not with the eyes set to left only. I haven't tried none yet, is that the intended way?)

    I'm using 5.4.1p4. I use a camera that is set to be rendered before the main camera to store the reflection data (with depth information.) When stereoEnabled is true, the buffers remain empty. When false, they still work as expected. Since I'm essentially rendering the scene again, Graphics.Blit doesn't sound like a useful alternative.
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Ok, Camera.stereoTargetEye = StereoTargetEyeMask.None is the answer here. Setting it to one eye or enabling stereoMirrorMode doesn't help. You can render to a specified RenderTexture in these modes, but overwriting the color and depth buffers separately using SetTargetBuffers is not possible. Probably because StereoTargetEyeMask controls whether the output ends up in the RenderTextures for the left and right eye.
     
    Kronnect likes this.
  3. ModProg

    ModProg

    Joined:
    Nov 27, 2016
    Posts:
    2
    I just want to add a search term here: "Dimensions of color surface does not match dimensions of depth surface", because that was my error message, and I took ages to find the solution.