Table of Contents

Class MobileVRInterface

Generic mobile VR implementation.

Inheritance
MobileVRInterface

Remarks

This is a generic mobile VR implementation where you need to provide details about the phone and HMD used. It does not rely on any existing framework. This is the most basic interface we have. For the best effect, you need a mobile phone with a gyroscope and accelerometer.

Note that even though there is no positional tracking, the camera will assume the headset is at a height of 1.85 meters. You can change this by setting eye_height.

You can initialize this interface as follows:

var interface = XRServer.find_interface("Native mobile")
if interface and interface.initialize():
    get_viewport().use_xr = true

Note: For Android, input_devices/sensors/enable_accelerometer, input_devices/sensors/enable_gravity, input_devices/sensors/enable_gyroscope and input_devices/sensors/enable_magnetometer must be enabled.

Properties

display_to_lens

The distance between the display and the lenses inside of the device in centimeters.

var display_to_lens : float = 4.0

Property Value

float

Remarks

  • void set_display_to_lens(float value)
  • float get_display_to_lens

display_width

The width of the display in centimeters.

var display_width : float = 14.5

Property Value

float

Remarks

  • void set_display_width(float value)
  • float get_display_width

eye_height

The height at which the camera is placed in relation to the ground (i.e. XROrigin3D node).

var eye_height : float = 1.85

Property Value

float

Remarks

  • void set_eye_height(float value)
  • float get_eye_height

iod

The interocular distance, also known as the interpupillary distance. The distance between the pupils of the left and right eye.

var iod : float = 6.0

Property Value

float

Remarks

k1

The k1 lens factor is one of the two constants that define the strength of the lens used and directly influences the lens distortion effect.

var k1 : float = 0.215

Property Value

float

Remarks

k2

The k2 lens factor, see k1.

var k2 : float = 0.215

Property Value

float

Remarks

offset_rect

Set the offset rect relative to the area being rendered. A length of 1 represents the whole rendering area on that axis.

var offset_rect : Rect2 = Rect2(0, 0, 1, 1)

Property Value

Rect2

Remarks

  • void set_offset_rect(Rect2 value)
  • Rect2 get_offset_rect

oversample

The oversample setting. Because of the lens distortion we have to render our buffers at a higher resolution then the screen can natively handle. A value between 1.5 and 2.0 often provides good results but at the cost of performance.

var oversample : float = 1.5

Property Value

float

Remarks

  • void set_oversample(float value)
  • float get_oversample

vrs_min_radius

The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.

Note: Mobile and Forward+ renderers only. Requires vrs_mode to be set to Viewport.VRS_XR.

var vrs_min_radius : float = 20.0

Property Value

float

Remarks

  • void set_vrs_min_radius(float value)
  • float get_vrs_min_radius

vrs_strength

The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.

Note: Mobile and Forward+ renderers only. Requires vrs_mode to be set to Viewport.VRS_XR.

var vrs_strength : float = 1.0

Property Value

float

Remarks

  • void set_vrs_strength(float value)
  • float get_vrs_strength