Control interpupillary distance (IPD)

Note: you are currently viewing documentation for a beta or an older version of Varjo

Setting interpupillary distance parameters

It is possible to set interpupillary distance (IPD) parameters of the Varjo headset by calling the method SetInterPupillaryDistanceParameters in the VarjoHeadsetIPD class.

// Sets interpupillary distance (IPD) parameters of the headset.
bool SetInterPupillaryDistanceParameters(IPDAdjustmentMode ipdAdjustmentMode,
    float? RequestedPositionInMM = null);

The requested IPD adjustment mode can be either Manual or Automatic.

// Interpupillary Distance (IPD) Adjustment Mode
public enum IPDAdjustmentMode
    Manual = 0,
    Automatic = 1

With the Manual adjustment mode, the headset can be set to the desired IPD position by supplying the parameter RequestedPositionInMM containing a floating point value in millimeters. When using this parameter, the caller should typically set the position value to be equal to the known IPD of the user, even if the the value is out of the supported IPD range of the headset. The headset will then drive the IPD motor to the closest supported position.

Note that passing a negative, infinite or not-a-number value via the RequestedPositionInMM argument will result in a failure and the function will return false. An attempt to set a specific IPD position will also fail if the Automatic adjustment mode is requested.

The accuracy of the Manual IPD adjustment mode via the API is nearly the same as via the user interface (UI) in Varjo Base and thus there is little to no gain in setting a more accurate IPD value via API (e.g. by passing more digits of the decimal fraction) than by setting the value via the UI, given the level of accuracy reached by setting it via the UI.

Reading interpupillary distance parameters state

You can query the currently used IPD adjustment mode by calling the method GetAdjustmentMode in the VarjoHeadsetIPD class.

// Get interpupillary distance adjustment mode
IPDAdjustmentMode GetAdjustmentMode();

You can read the interpupillary distance set in the headset in millimeters by calling GetDistance() from the same VarjoHeadsetIPD class. It will return zero if the headset is not connected.

// Get current headset interpupillary distance in millimeters
float GetDistance();