bjornblissing / osgoculusviewer

An OsgViewer with support for the Oculus Rift
Other
106 stars 67 forks source link

Picking up inter pupil distance IPD from Oculus Configuration Utility. #47

Closed ChrisDenham closed 9 years ago

ChrisDenham commented 9 years ago

This may be a misunderstanding on my part, but I'm wondering why the function "OculusDevice::calculateEyeAdjustment()" does not seem to pickup the IPD setting from the Oculus Configuration Utility (at least in SDK 0.5.0.1)?

I seem to get the same values for left and right eye positions regardless of the IPD setting in the configuration. I always get positions x=-0.032m and x=+0.032m i.e. IPD=64mm.

Am I missing something, or do I need to pickup the IPD configuration in some other way?

Thanks. Chris.

bjornblissing commented 9 years ago

Well, I have not tried this my self. But the values for the IPD is contained in the m_eyeRenderDesc array. This array should be initialized in the OculusDevice::initializeEyeRenderDesc() function, which in turn calls the Oculus SDK function ovrHmd_GetRenderDesc().

Could you try using a debugger to inspect the values returned from that Oculus SDK function?

ChrisDenham commented 9 years ago

The positions I got were using the debugger on: ovrVector3f leftEyeAdjust = m_eyeRenderDesc[0].HmdToEyeViewOffset; ovrVector3f rightEyeAdjust = m_eyeRenderDesc[1].HmdToEyeViewOffset; I assumed those structures were filled by a call to ovrHmd_GetRenderDesc(), but I'll check that. Thanks.

ChrisDenham commented 9 years ago

Yep, OculusDevice::initializeEyeRenderDesc() fills those structures by calling ovrHmd_GetRenderDesc, so I'm at a loss to understand why it's not giving me the configured IPD as the eye offsets.

bjornblissing commented 9 years ago

So what you are saying is that the ovrHmd_GetRenderDesc() function fill the structs with the correct IPD information. But when you reach OculusDevice::calculateEyeAdjustment() these structs have been changed into containing incorrect IPD values (i.e. default values)??

ChrisDenham commented 9 years ago

No, that's not what I was saying. I assume the +0.032 -0.032 positions are filled by the call to ovrHmd_GetRenderDesc and they are not subsequently modified. But I will check to make 100% sure tomorrow to confirm that is true and they aren't modified before your code gets to use them in the calculateEyeAdjustment function.

ChrisDenham commented 9 years ago

Ok, I can confirm 100% (at least for me on Windows SDK 0.5.0.1) that the values for eye positions returned by ovrHmd_GetRenderDesc() only return values for the default IPD of 64mm. i.e. they are unaffected by changes to the IPD setting in Oculus Configuration Utility.

So, as I see it, there are these possibilities: 1) It's only happening on my setup. 2) I am wrong to expect the eye offset values to change from the default. 3) There is a bug in Oculus SDK that means it does not pass through IPD setting from the config.

On a possibly related note though: the Oculus Configuration setting "Enable Personalized Rendering For This Eye Position" does affect the eye offset positions returned by ovrHmd_GetRenderDesc(), but not in a way I understand. When that option is enabled, I always get positions: (x=0.0320, y=0, z=0.0025) and (x=-0.0320, y=0, z=0.0025) but with that option disabled, I always get: (x=0.0320, y=0, z=0) and (x=-0.0320, y=0, z=0)

I wondered if anyone would be able to do a quick test to confirm whether they're getting the same results as me?

bjornblissing commented 9 years ago

Well, it is not just your system. I am getting the same values on my computer running the 0.5.0.1 SDK and the 0.6.0.0 runtime.

ChrisDenham commented 9 years ago

Thanks for confirming that. One for the Oculus forums then I guess? Seems odd though, as it implies the stereo image for each eye is potentially being rendered with incorrect camera positions, which could lead it incorrect perception of depth and maybe makes simulator sickness worse than it needs to be?

ChrisDenham commented 9 years ago

Ah, I see 'someone' beat me to the Oculus forum with the same question: https://forums.oculus.com/viewtopic.php?f=20&t=24132

bjornblissing commented 9 years ago

Well, it seems that this is an Oculus SDK bug. Since Oculus do not fix bugs in older SDKs leaves us with a broken custom IPD setting via the configuration utility. It can be implemented manually, but that would require reading and interpreting the config file located at: %localappdata%\Oculus\ProfileDB.json.

ChrisDenham commented 9 years ago

Thanks very much for following that up. It does seem very odd that such a bug would have gone unnoticed. I wonder if there is another factor here, maybe even something daft like a space in the windows username? I've known sillier theories to be true, so I'll test that tomorrow. (EDIT: space in name theory eats dirt)

Do you have a feeling for what's left to do to get the 0.6.0.0 version working? Happy to help if there is anything i can do.

bjornblissing commented 9 years ago

Well, my windows user name have given me problems before (due to it containing the Swedish character ö). So that could be the reason here... Who knows...

Or maybe the profile generated by the 0.6.0.0 runtime is not backwards compatible with 0.5.0.1 SDK.

Regarding the 0.6.0.0 work, see the issue #46 for more details.

ChrisDenham commented 9 years ago

I was having the same problem before installing 0.6.0.0 runtime, so I think that's probably not related.

bjornblissing commented 9 years ago

I will close this since this bug only affects the Oculus 0.5 branch.