Top Description Fields Constructors Methods
org.lwjgl.openxr

public Class VARJOViewOffset

extends Object
Class Inheritance
Imports
org.lwjgl.system.*

The XR_VARJO_view_offset extension.

Varjo headsets use video pass-through cameras to create the mixed reality (MR) image. The cameras are located around 10 cm (3.9 inches) in front of the user’s eyes, which leads to an offset in depth perception so that real-world objects in the video pass-through image appear larger than they are in real life. The image below gives a visualization of the difference between what the camera sees and what the user would see in real life.

This magnification effect is pronounced for objects that are close to the user – for example, their hands may appear unnaturally large in the image. The effect decreases with distance, so that objects at a distance of 2 meters already appear close to their actual size, and the sizes eventually converge at infinity. Note that while the objects' sizes may differ, their geometry, relative sizes, locations, etc. remain accurate. The extent of the magnification effect ultimately depends both on the application itself and the user’s physiology, as the human visual system is highly adaptive in this type of setting.

When blending the video pass-through image with virtual content, it is important that their relative geometries – position, size, and disparity – match one another. To achieve this, Varjo’s runtime automatically places the virtual reality cameras in the same position as the physical cameras when the video pass-through feature is enabled (see ENVIRONMENT_BLEND_MODE_ALPHA_BLEND). This allows virtual and real-world content to appear at the same distance and on the same plane when viewed together. While this can be observed as an apparent jump in the location of virtual objects compared to VR-only content, this does not cause any distortion in the object geometry or location; it is only the viewer’s location that changes.

In some cases, moving the VR content to match the real-world position may not be desirable. This extension enable the application to control where the VR content is rendered from the location of the user’s eyes while the video pass-through image uses the camera locations. For example, if the virtual object is close the user, or if the application is switching between VR and MR modes. Offset values between 0.0 and 1.0 are supported. You can use this to create a smooth, animated transition between the two rendering positions in case you need to change from one to the other during a session.

Field Summary

Modifier and TypeField and Description
public static final String
public static final int
XR_VARJO_view_offset_SPEC_VERSION

The extension specification version.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static int
xrSetViewOffsetVARJO(XrSession
an XrSession handle previously created with CreateSession.
session
,
float
the view offset to be applied. Must be between 0 and 1.
offset
)

Set view offest.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

XR_VARJO_VIEW_OFFSET_EXTENSION_NAMEback to summary
public static final String XR_VARJO_VIEW_OFFSET_EXTENSION_NAME

The extension name.

XR_VARJO_view_offset_SPEC_VERSIONback to summary
public static final int XR_VARJO_view_offset_SPEC_VERSION

The extension specification version.

Constructor Detail

VARJOViewOffsetback to summary
protected VARJOViewOffset()

Method Detail

xrSetViewOffsetVARJOback to summary
public static int xrSetViewOffsetVARJO(XrSession session, float offset)

Set view offest.

C Specification

The SetViewOffsetVARJO function is defined as:


XrResult  xrSetViewOffsetVARJO(
    XrSession                                   session,
    float                                       offset);
Description

The SetViewOffsetVARJO function takes a float between 0.0 and 1.0. 0.0 means the pose returned by LocateViews will be at the eye location, a value of 1.0 means the pose will be at the camera location. A value between 0.0 and 1.0 will interpolate the pose to be in between the eye and the camera location. A value less than 0.0 or more than 1.0 will fail and return error ERROR_VALIDATION_FAILURE.

Note that by default the offset is set to 0 if the pass-through cameras are not active, a.k.a. in VR (ENVIRONMENT_BLEND_MODE_OPAQUE), and 1 if the cameras are active, a.k.a. in MR (ENVIRONMENT_BLEND_MODE_ALPHA_BLEND or ENVIRONMENT_BLEND_MODE_ADDITIVE).

Valid Usage (Implicit)
Return Codes
On success, this command returns
On failure, this command returns

Version History

  • Revision 1, 2022-02-08 (Remi Arnaud)
    • extension specification
Parameters
session:XrSession

an XrSession handle previously created with CreateSession.

offset:float

the view offset to be applied. Must be between 0 and 1.

Annotations
@NativeType:XrResult