Interpupillary Distance (IPD) Parameter Configuration in Game Code

Our video game development company runs independent projects, jointly creates games with the client and provides additional operational services. Expertise of our team allows us to cover all gaming platforms and develop an amazing product that matches the customer’s vision and players preferences.
Showing 1 of 1 servicesAll 242 services
Interpupillary Distance (IPD) Parameter Configuration in Game Code
Simple
~2-3 business days
FAQ
Our competencies
What are the stages of Game Development?
Latest works
  • image_games_mortal_motors_495_0.webp
    Game development for Mortal Motors
    663
  • image_games_a_turnbased_strategy_game_set_in_a_fantasy_setting_with_fire_and_sword_603_0.webp
    A turn-based strategy game set in a fantasy setting, With Fire and Sword
    859
  • image_games_second_team_604_0.webp
    Game development for the company Second term
    490
  • image_games_phoenix_ii_606_0.webp
    3D animation - teaser for the game Phoenix 2.
    533

IPD (Interpupillary Distance) Parameter Setup in Code

IPD—distance between pupil centers, average 63–65 mm in adults, real range 54–74 mm. VR headset not accounting for user IPD gives blurry image, double vision, headache after 15–20 minutes. IPD setup not optional feature but basic VR application requirement.

How IPD is implemented at hardware and software level

Most VR headsets solve IPD physically: Quest 3 and Index have mechanical adjustable IPD (Quest 3—three fixed positions: 58, 63, 68 mm; Index—smooth range 58–70 mm). PSVR2—software adjustment without mechanical slider.

Software part: even with correct physical IPD, game engine must position virtual cameras correctly. In Unity via OVR SDK physical IPD automatically read via OVRPlugin.GetFloat(OVRPlugin.BoolType.ipd) and applied to eye offset—distance between left and right camera. Don't need manual adjustment unless using non-standard camera rig.

Problem arises in projects with custom camera rig—e.g., when developer made own VRCameraController on top of OVRCameraRig or XRRig, hardcoded eye separation = 0.064f (standard). User with IPD 57 mm gets incorrect stereo, experiences eye strain. Few days later—negative review "my eyes hurt."

Programmatic IPD reading and application

For Meta Quest via OVR SDK:

float ipd = OVRPlugin.GetEyeRecommendedResolutionScale() > 0
    ? OVRPlugin.ipd
    : 0.064f; // fallback to standard

leftCamera.transform.localPosition = new Vector3(-ipd / 2f, 0, 0);
rightCamera.transform.localPosition = new Vector3(ipd / 2f, 0, 0);

OVRPlugin.ipd returns actual value in meters, read from sensor or system settings. Updates dynamically on physical IPD change (devices with mechanical adjustment)—recommended to subscribe to OVRManager.DisplayRefreshRateChanged or check in Update() with throttling every 0.5 seconds.

For OpenXR (XR Interaction Toolkit): eye offset managed via XRCameraSubsystem, gets data from specific XR Provider. Direct IPD access via UnityEngine.XR.InputDevice.TryGetFeatureValue(CommonUsages.eyesData, out Eyes eyes)—returns both eye positions in world coordinates, IPD calculated as Vector3.Distance(leftEyePos, rightEyePos).

IPD configuration in user interface

For PSVR2 and other headsets with software IPD—need settings screen in application. Standard UX: horizontal slider 54–74 mm, 1 mm steps, real-time preview. Applied via vendor-specific API—for PSVR2 this Unity PS VR2 Plugin with VRSamples.IPDInterop.

IPD test: settings screen shows two vertical lines or crosses—one for left eye, one for right. At correct IPD, lines perceived as one. Standard technique used by manufacturers themselves.

IPD and rendering: impact on depth perception

IPD in code affects not only physical comfort but object scale perception. Eye separation in engine controls parallax—difference between left and right eye images. Larger eye separation than real IPD makes objects seem smaller (macro scale effect). Smaller makes them bigger (gigantism effect). Artistically used in games—giant scale VR intentionally reduces eye separation.

For realistic simulators and educational VR—eye separation deviation from user's real IPD unacceptable. Precision critical.

Common Unity project mistake: Camera.stereoSeparation and IPD different things. stereoSeparation—software parameter added on top of hardware IPD. Both non-zero causes double shift. Value should be 0.0f in most VR projects unless using intentional artistic displacement.

Task Estimated timeline
Audit and fix IPD in existing camera rig 1 business day
Implement software IPD UI with preview 2–4 business days
Cross-platform IPD layer (Quest + OpenXR + PSVR2) 1–2 weeks

Cost is determined after analyzing current camera rig state and target platforms.