Skip to main content
New Participant
March 9, 2016

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

    Up and Coming
    March 9, 2016
    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.
    Inspiring
    March 11, 2016
    "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.
    Brad Davis - Developer for High Fidelity Co-author of Oculus Rift in Action
    Up and Coming
    March 14, 2016
    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