Forum Discussion

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

OculusSDK OpenGL and Scale

I'm trying to understand how to determine how to relate OpenGL units to real life units. For example if I make a plane that is 10.0f x 10.0f in OpenGL it's not looking like 10 meters x 10 meters when in the Rift. Is there a method to calculate the appropriate ratio?

3 Replies

  • Mars3D's avatar
    Mars3D
    Honored Guest
    Somewhere in your code you should be setting a property called HmdSpaceToWorldScaleInMeters, setting that property to 1 should make 1 unit in OpenGL appear 1 meter in the Rift.
  • "mfrancis107" wrote:
    I'm trying to understand how to determine how to relate OpenGL units to real life units. For example if I make a plane that is 10.0f x 10.0f in OpenGL it's not looking like 10 meters x 10 meters when in the Rift. Is there a method to calculate the appropriate ratio?


    Make sure you're using a consistent scale for your rendering:


    • Base camera matrix

    • Individual eye camera matrix

    • Near and far planes of the projection matrix


    In particular, you need to make sure that the eye cameras are separated by the interpupillary distance (IPD). If they aren't then the motion parallax of the objects in the world won't match the binocular parallax and it can lead to VR sickness.

    Make sure you're telling the Oculus SDK what your scale is in the HmdSpaceToWorldScaleInMeters member of the ovrViewScaleDesc structure that is passed to ovr_SubmitFrame.

    If that's not working for you, you should post some example code for how you're setting up your matrices.
  • galopin's avatar
    galopin
    Heroic Explorer
    There is absolutely no constraint on the units with GL or Direct X, all that matters is that the whole is consistant. It is also true for Y versus Z up, left or right handed...

    The only difference notable gl versus direct x is the projected space cube on depth, GL visible space is -1..1 while DX is 0..1