Oculus Rift fieldOfView?
#1
Hi,

I am having some issue with the Oculus rift field of view. The thing is I'm not too sure if I needed the camera to follow the exact movements of the Oculus Rift sensors because Something was right about the field of view that the Oculus Rift displays. I thought that by making the camera follow the movements of the Oculus Sensors that it would fix the problem.

So I went ahead and made this snippet of code Inside an "update" method:


Code:
            bool latencyMark = false;

           TrackingState trackState = _ovr.GetTrackingState(_oculusRiftVirtualRealityProvider.SessionPtr, 0.0f, latencyMark);
           PoseStatef poseStatefer = trackState.HeadPose;

           Posef hmdPose = poseStatefer.ThePose;
           Quaternionf hmdRot = hmdPose.Orientation;

           double roll = Math.Atan2(2 * hmdRot.Y * hmdRot.W + 2 * hmdRot.X * hmdRot.Z, 1 - 2 * hmdRot.Y * hmdRot.Y - 2 * hmdRot.Z * hmdRot.Z);
           double pitch = Math.Atan2(2 * hmdRot.X * hmdRot.W + 2 * hmdRot.Y * hmdRot.Z, 1 - 2 * hmdRot.X * hmdRot.X - 2 * hmdRot.Z * hmdRot.Z);
           double yaw = Math.Asin(2 * hmdRot.X * hmdRot.Y + 2 * hmdRot.Z * hmdRot.W);

           _camera.Heading = yaw;
           _camera.Attitude = pitch;
           _camera.Bank = roll;


This makes it able (i think) to have the camera get the exact movement that the Oculus Rift has and copies it. But the problem isnt fixed. Its as if the culling mode or field of view or Something just interferes and i start losing the view of my terrain even when I get closer to it and whatever if the pitch/yaw/roll are positive or negative it doesnt change the fact that i lose the view of the terrain at angles I should normally be able to view it. So I know its probably me just not using the correct settings of the OVR or whatnot but if anyone has got any ideas on how to fix my problem i would really appreciate it?

thank you.
nine
#2
I will check that next week when I come from vacation - I do not have Oculus with me :)

Until then I would advise you to check how this is done in the samples that come with Oculus.Wrap library.
Andrej Benedik
#3
Hi,

I was able to fix the problem by changing a variable directly Inside the DXEngine.OculusWrap Library Inside the OculusWrapVirtualRealityProvider.cs script where it says:

Code:
//zFar *= 1.2f; // increase the zFar - the FarPlaneDistance is not exactly correct because the camera can be higher because the eye's Position can be over the Camera's position

zFar *= 10f; /// I just changed the zFar variable to *=10f which might be too much i dont really know. It renders anyway so im gonna be testing that.

That fixes the "field" of view or whatever its called (im a bit short on knowing exact syntax of settings and whatnot). Since I know absolutely Nothing about Matrixes and those types of stuff I was still wondering if its possible to have a "sphere" like type of matrix to store the "field of view" instead of a "square" like "field of view". So im not too sure that I should be fiddling around that script as i undersand approx 1% of it haha but still its obvious to me that the "field of view" issue was due to it beeing square and not beeing far enough so at least the distance is fixed. Im probably getting ahead of myself there stating that i should try to make a sphere matrix of "field of view" since i know Nothing about matrixes.


Also I stumbled upon this snippet of code here in the same OculusWrapVirtualRealityProvider.cs and was wondering if the index was right? Isnt it supposed to be 0 instead of 1 since the two statements just seem to overwrite each other there.

Code:
             _eyeRenderDesc[0] = _ovr.GetRenderDesc(_sessionPtr, EyeType.Left, _hmdDesc.DefaultEyeFov[0]);
           _hmdToEyeOffset[1] = _eyeRenderDesc[1].HmdToEyeOffset; /// isnt this one supposed to be the index 0. i tested it anyway and it                                                                                     /// doesnt really change anything. 

            _eyeRenderDesc[1] = _ovr.GetRenderDesc(_sessionPtr, EyeType.Right, _hmdDesc.DefaultEyeFov[1]);
           _hmdToEyeOffset[1] = _eyeRenderDesc[1].HmdToEyeOffset;
  


Forum Jump:


Users browsing this thread:
1 Guest(s)