Skip to main content
Up and Coming
May 4, 2013

Incorrect IPD math (maybe)

I have been feeling that the world scale has been weird since the first release despite using correct numbers. I have also seen comments concerning IPD adjustment seeming to not have much effect. After digging through the code I have finally figured out why.

The IPD math is off. The ingame cameras are being spaced (your IPD)+64mm apart, which for the average person makes the world appear exactly half its expected size. This stuff is kind of off the beaten path of CG, so I will try to be thorough if a bit long-winded. Please bear with me.

The reason is that an IPD offset is being applied on top of the lens offset. When the projection matrix is constructed it is transformed 32mm in either direction in post-perspective-transform screen space so that it lines up with the center of the each lens. For a 1:1 scale world that results in a 32mm transform in world space as well. You can make sense of this by thinking of sliding the eye position along the near plane of the camera.

But, after this is done, the camera transform position is also shifted IPD/2mm in either direction. For the above person, this would put the centers of the ingame cameras a total of 128mm apart.

Try substituting the OVRCameraController.ConfigureCamera method with the code below, which instead offsets the eye positions by the difference between IPD and inter-lens distance:


void UpdateCameras()
{
// Values that influence the stereo camera orientation up and above the tracker
if(FollowOrientation != null)
OrientationOffset = FollowOrientation.rotation;

if(UpdateCamerasDirtyFlag == false)
return;

float ipdDifference = IPD - 0.064f; // I assume the lenses are exactly 64mm center to center

float distOffset = 0.5f + (LensOffsetLeft * 0.5f);
float perspOffset = LensOffsetLeft;
float eyePositionOffset = -ipdDifference * 0.5f;
ConfigureCamera(ref CameraLeft, distOffset, perspOffset, eyePositionOffset);

distOffset = 0.5f + (LensOffsetRight * 0.5f);
perspOffset = LensOffsetRight;
eyePositionOffset = ipdDifference * 0.5f;
ConfigureCamera(ref CameraRight, distOffset, perspOffset, eyePositionOffset);

UpdateCamerasDirtyFlag = false;
}


If you load up Tuscany, set your IPD and height correctly (it defaults to you being super tall) and play standing, you should see a night and day difference from before. Everything seems exactly as big and as distant as it should be. The high vaulted ceiling looks as impressive as it should be for being over two stories high. Go back to the unmodified Tuscany and it feels like a dollhouse.

If you don't trust my explanation, try to simply set eyePositionOffset to zero. Far from getting zero stereo separation as you might intuitively expect, it should look very close to correct if you have average IPD.

I haven't looked at the C++ samples yet, and I don't think the Unreal code is accessible, but I suspect they have the same problem. The Unreal demos I tried also made the world seem tiny, though thats made worse by the intentionally out of proportion design of most unreal samples.
    This topic has been closed for replies.

    15 replies

    Up and Coming
    July 28, 2013
    Has there been any more interest in this?

    I'm testing some full body scanned data in Unity (was using UDK) The scans are correct to scale by the micro mm. So if I load in a 6 foot tall scan, imported correctly into Unity and viewed on the Rift the model looks too small. I have my IPD set to about 65.00 (I'm about 6 foot tall) this clearly has an impact on scene scale. If I adjust the IPD down to 55 in Unity, the full body scans begin too look like the correct scale.

    I'm certain the scans are imported in to the correct scale but when viewed in Unity using my calibrated IPD, the scans look too small. I've also noticed size issues in other Unity demos, like flying cockpit demos where the hands are visible hands.

    IPD really seems to effect scene scale.
    _________________________________________________ I N F I N I T E www.ir-ltd.net
    July 29, 2013
    Just spotted this, it certainly looks interesting. It hadn't occurred to me how closely tied together the height and IPD would be.
    sh0v0r
    Up and Coming
    August 1, 2013
    "Infinite" wrote:
    Has there been any more interest in this?

    I'm testing some full body scanned data in Unity (was using UDK) The scans are correct to scale by the micro mm. So if I load in a 6 foot tall scan, imported correctly into Unity and viewed on the Rift the model looks too small. I have my IPD set to about 65.00 (I'm about 6 foot tall) this clearly has an impact on scene scale. If I adjust the IPD down to 55 in Unity, the full body scans begin too look like the correct scale.

    I'm certain the scans are imported in to the correct scale but when viewed in Unity using my calibrated IPD, the scans look too small. I've also noticed size issues in other Unity demos, like flying cockpit demos where the hands are visible hands.

    IPD really seems to effect scene scale.


    Adjusting the 'software' IPD in the SDK as far as I can tell only affects the perception of scale which is relatively different for everyone especially when height is factored into it. The reason you want to match this is to try to simulate your own perception accurately assuming you have something that is a good real world scale reference.

    If you get my game Lunar Flight and press - / + to shift the IPD you will quite clearly see the effect it has on your perception of the scale in the cockpit. You can make it feel cavernous or really cramped. My IPD just happens to be exactly 64mm according to the new profiling tool. I have built the cockpit to feel correct for my perception of scale. Part of the reason I have avoided exposing the software IPD is because for most people it feels right and adjusting the horizontal lense separation is much more important.

    I am currently trying to work out how to shift the actual screen space position of the final render target so that I can future proof my game once adjustable horizontal lense separation is available in the Consumer kit.

    I've done some rough measuring of the devkit and have determined that there is only about 8mm of play before you can clearly see the edge of the panel likewise there is only about 5mm inward before the lense bases touch each other, it's possible the inner edges could be cut off as there is always some overlap of the FOV here.

    So Max 73mm & Min 60mm or 55mm if you cut some of the lense cup base.

    This is a downside of having a single display. Ideally in the future each eye would have a very small HD display around 2x3 cms H/W, 540x960 pixels min, that can be offset rather than manipulating the output coordinates in screenspace.
    sh0v0r
    Up and Coming
    August 1, 2013
    I actually did some rough measurements today as well and drew this.

    CLICK ME - IMAGE IS TO LARGE

    The circle at the top was my idea for a dial that you could turn on the top of the headset which would be hooked up to some cogs to adjust the lenses offsets.

    I'm not sure if it's at all clear what my motivations were for doing this but after doing so I could see the physical issues with actually allowing the lenses to be offset.
    sh0v0r
    Up and Coming
    August 1, 2013
    I started a new Thread about this in the General Development Channel. Come on over, we've been graced by Tom F himself! 8-)

    viewtopic.php?f=20&t=3222