Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is there a way to mirror exactly what the VR user sees on a monitor? Default aspect ratio is wrong.

Discussion in 'AR/VR (XR) Discussion' started by Dreamwriter, Dec 28, 2016.

  1. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    Using a Vive, the image within VR shows more vertical space than the mirrored "deviceView" shown on the monitor, so on the monitor the top and bottom are cut off. We need to see exactly what the VR user sees, is there a setting to enable this?
     
  2. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Funnily enough, I had a similar yet opposite problem - not rendering exactly what's being displayed in the headset, as I alluded to in my thread https://forum.unity3d.com/threads/a...eview-to-render-into-a-render-texture.444554/

    Basically if you capture the RenderTexture source in OnRenderImage, you'll see the exact images being sent to the headset, so you should be able to use that.

    e.g. something like this:
    Code (csharp):
    1.  
    2.   public class VRCamera : MonoBehaviour
    3.    {
    4.      private Camera _camera;
    5.      private int _frameCount;
    6.  
    7.      public RenderTexture MirrorTexture { get; private set; }
    8.  
    9.      void Awake()
    10.      {
    11.        _camera = GetComponent<Camera>();
    12.        MirrorTexture = new RenderTexture(_camera.pixelWidth, _camera.pixelHeight, 0);
    13.      }
    14.  
    15.      private void OnRenderImage(RenderTexture source, RenderTexture destination)
    16.      {
    17.        Graphics.Blit(source, destination);
    18.  
    19.        ++_frameCount;
    20.  
    21.        if (_frameCount % 2 == 0)
    22.          Graphics.Blit(source, MirrorTexture);
    23.      }
    24.    }
    25.  
    It's frustrating that there aren't more options/flexibility to showDeviceView, though.
     
  3. grobm

    grobm

    Joined:
    Aug 15, 2005
    Posts:
    217
    Also consider Multi-displays option.
     
  4. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    What sucks about that is it kills the framerate, which is really really bad for VR.