Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
MajortomVR's avatar
MajortomVR
Honored Guest
11 years ago

Irrlicht/Ogre - Rift integration

I am planning to do a bit of development for the rift since forever. I would love to make something using a free 3D Engine like Irrlicht. Problem is there are no tutorials out on how to integrate the Rift within Irrlicht or Ogre (with the lastest SDK using SDK rendering).

So my Question is: Is there someone out there that would be so awesome and write a basic hello world oculus rift app for irrlicht or/and ogre. Maybe simply by using the existing basic Hello World and adding just the rift with a few comments.

It doesn't even need to be Irrlicht or Ogre. It just should be somewhat easy to learn and run on Linux.

Thanks in advance!

Link to Irrlicht Example 1:
http://irrlicht.sourceforge.net/docu/example001.html

12 Replies

  • sbf0202's avatar
    sbf0202
    Honored Guest
    So, aside from running the Irrlicht scene through a distortion renderer, is mostly a matter of mapping the Yaw, Pitch and Roll parameters from the Oculus SDK to camera node in Irrlicht?
  • Ybalrid's avatar
    Ybalrid
    Expert Protege
    Basicly, ovrHmd_BeginEyeRender() returns you a "pose" containing both the orientation quaternion and a position vector.

    You use thouses info to set the camera position and orientation.

    Using quaternion in Ogre I do this :


    //Get the eye pose
    ovrPosef eyePose = ovrHmd_BeginEyeRender(hmd, eye);

    //Get the hmd orientation
    OVR::Quatf camOrient = eyePose.Orientation;

    //Compute the projection matrix from FOV and clipping planes distances
    OVR::Matrix4f proj = ovrMatrix4f_Projection(EyeRenderDesc[eye].Fov,nearClippingDistance,10000.0f, true);

    //Convert it to Ogre matrix
    Ogre::Matrix4 OgreProj;
    for(char x(0); x < 4; x++)
    for(char y(0); y < 4; y++)
    OgreProj[x][y] = proj.M[x][y];

    //Set the matrix
    cams[eye]->setCustomProjectionMatrix(true, OgreProj);

    //Set the orientation
    cams[eye]->setOrientation(cameraOrientation * Ogre::Quaternion(camOrient.w,camOrient.x,camOrient.y,camOrient.z));

    //Set Position
    cams[eye]->setPosition( cameraPosition +
    (cams[eye]->getOrientation() *
    - //For some reason cams are inverted here. Take the oposite vector
    Ogre::Vector3(
    EyeRenderDesc[eye].ViewAdjust.x,
    EyeRenderDesc[eye].ViewAdjust.y,
    EyeRenderDesc[eye].ViewAdjust.z))
    );


    "cameraPosition" & "cameraOrientation" are the position/orientation value the game logic whants the cameras to be. These are the value I manupulate for mouving the player into space.

    You also have to aply the projection matrix given by the OculusSDK to the camera. Don't know how it works with Irrlicht.

    I aslo adjust the "nearClippingDistance" of the projection matrix because I put cameras inside of players mesh model head.

    Thouse thing have to be done each frames and for both left and right cameras.

    If you want an example I've done with Ogre, you can see it here : https://github.com/Ybalrid/OgreOculusRenderer/blob/master/OgreOculusRender.cpp (see the "OgreOculusRender::RenderOneFrame" method)

    As I remember with Irrlicht the only way to correctly orient a camera is to set the "look at" and "up" vector position. You can easily get them with a little bit of math.

    Hope it helps! ^^"