Search Unity

Stereoscopic live Camera

Discussion in 'AR/VR (XR) Discussion' started by Kreliou, Mar 27, 2015.

  1. Kreliou

    Kreliou

    Joined:
    Mar 27, 2015
    Posts:
    1
    Hi,
    I am currently working on a VR project with the oculus. We were thinking using unity 3D for our client since the oculus sdk is easier to implement with it than pure openGL.
    Basically I have two CV::Mat (OpenCV) which updates from a server and I would like to show them with the oculus distortion each on half of the screen. Without taking on account the movement of the head.

    Having never used Unityor the oculus I wanted to know if anyone knows of a way to do this?
     
    Last edited: Mar 27, 2015
  2. SoylentGraham

    SoylentGraham

    Joined:
    Nov 12, 2013
    Posts:
    46
    Make a plugin in which you send a texture's NativeTexturePtr() to in a function;
    In that function Convert the CV::Mat's into an array of pixels and copy them to the texture. (eg. with opengl glTexImage())
    Depending on the platform and renderer, you may have to do this in the render thread with the normal plugin IssuePluginEvent design.
    As a CV::Mat is basically a giant array of floats, you may be able to get away with copying them to a float texture, but this all depends on what format the CV::Mat represents and which platform you're targetting in unity.