Search Unity

Oculus Camera Distortion

Discussion in 'AR/VR (XR) Discussion' started by Nmck, Mar 5, 2016.

  1. Nmck

    Nmck

    Joined:
    Jul 10, 2015
    Posts:
    14
    Hello,

    I am currently implementing a "portal" like doorway that uses a render texture to show the other room.

    In 2D it looks great, you cant tell that the doorway isn't just a regualr doorway. But in VR using the DK2 the render texture is quite jittery and I believe it is because the camera that is attached to the render texture doesn't have the same distortion applied to it as the players camera.

    The field of view looks good, but when I turn my head so the doorway is more towards the peripherals of the view then the alignment looks off.

    Is there a way to apply the DK2 distortion to a camera? Or something similar that may fix this issue, thanks.
     
  2. Nmck

    Nmck

    Joined:
    Jul 10, 2015
    Posts:
    14
    Update:

    It may not be the distortion that is the problem, but might be the render texture refresh rate. Is there a way to increase the refresh rate of the render texture?

    Thanks
     
  3. Freezy

    Freezy

    Joined:
    Jul 15, 2012
    Posts:
    234
    you will need to render it once each frame for each eye (OnWillRenderObject).
    If performance is of any concern be sure to reuse the same rendertexture and consider using a replacement shader to reduce rendering time for that camera.

    left eye renders, sees the portal, renders the portal in a texture (you might be able to set up the other camera so that it renders directly into the current eye rendertexture but good luck with that), which applies the rendertexture to the portal mesh with finally gets rendered.

    right eye renders, sees the portal, does the same thing

    if you can somehow split the rendering into a multi-threaded approach where you render two textures first, after that start the left/right eye cameras, it might also work, but it would use more resources and most likely still need block your camera's until the render-textures are complete.