Vixen
02b45cc4
csharp
public static class XrProjection

The projection matrix a headset's frustum asks for.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Why this is not PerspectiveFieldOfView. That takes one vertical field of view and an aspect ratio, which describes a frustum symmetric about the view axis. A headset's is not: the lenses are canted outwards, so each eye sees several degrees further towards its own side than towards the nose. Projecting with a symmetric matrix puts the two eyes' images at slightly different places, which the visual system reads as the world being the wrong size and the viewer reads as a headache.

It is the same convention as the rest of the engine. Right-handed, row-vector, and reverse-Z — the near plane maps to 1 and the far to 0, the depth test is GREATER and depth clears to 0. Feeding a headset a matrix from some other engine's convention is the second most common way to get a black eye buffer; the first is forgetting that the runtime owns the swapchain.

Methods (1)

  • public static Matrix4x4 FromFieldOfView(in XrFieldOfView fov, float nearPlane = 0.05, float farPlane = 0)

    Builds a projection from four half-angles.

Used by (2)

  • XrProjectionTestsVixen.Xr.Tests
  • XrViewVixen.Xr