ValveSoftware / openvr

OpenVR SDK

Home Page:http://steamvr.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected projection matrix extents for FOV calculation

UltraEngine opened this issue · comments

When using ivrsystem->GetProjectionRaw() my top and bottom extents are not the same.

With an HTC Vive, the top angle is -55.7750092 degrees and the bottom angle is 55.6199341.

Why this discrepancy? This makes some basic 3D math in shaders not work. Is this a bug? I have never seen a projection matrix that didn't point straight forward.

float left, right, top, bottom;
system->GetProjectionRaw(vr::Eye_Left, &left, &right, &top, &bottom);
float a0 = ATan(top);
float a1 = ATan(bottom);

VR headset displays usually don't have symmetrical fields of view relative to the forward direction of the camera. As long as you calculate the correct off-center projection matrix, is should work the same in shaders as a symmetric one.

What Rectus said is the reason.
If your app cannot support off-center projection matrices, what you can do is take the max and build your own, then make sure to pass it back to SteamVR when you call IVRCompositor::Submit using VRTextureWithDepth_t (you can safely leave the depth texture handle null if that is problematic).

Ah okay. I think this is basically what is going on. The screens are not facing the viewer straight-on:
hmd

The displays don't even have to be canted for it to happen. It will happen if any side of the display is longer, so the optical axis doesn't align with the center or the display.

Imagine if you stretched the outer edges of the displays along their planes to give you a really wide field-of-view to the sides. The optical axis wouldn't move, but you would get a bigger angle on only the outer sides.