Godot Version
Godot 4.5
Question
Does SubViewport with use_xr = true produce a stereo texture (texture‑array) usable in OpenXR on Magic Leap 2 with Godot 4.5?
If not, what is the recommended way to produce per‑eye textures or masks for OpenXR on Magic Leap 2?
Setup
Scene with a script that sets “use_xr” of the main viewport to true:
SubViewport (use_xr=true)
+ Camera3D
XROrigin
+ XRCamera
+ MeshInstance3D_Box
+ MeshInstance3D_DebugQuad
Shader used on MeshInstance3D_DebugQuad:
shader_type spatial;
render_mode unshaded, cull_disabled;
uniform sampler2DArray xr_viewport_tex : source_color;
uniform int eye_index = 0; // 0 = first image
void fragment() {
vec4 c = texture(xr_viewport_tex, vec3(UV, float(eye_index)));
ALBEDO = vec3(0.1) + c.rgb;
}
Script on MeshInstance3D_DebugQuad linking the SubViewport texture to the shader.
extends MeshInstance3D
@export var subviewport: SubViewport
func _ready() → void:
var material := self.material_override as ShaderMaterial
material.set_shader_parameter(“xr_viewport_tex”, subviewport.get_texture())
material.set_shader_parameter(“eye_index”, 0)
Observation
- Windows (Forward+ renderer), “use_xr=false”: debug quad shows projected box

- Windows, “use_xr=true”: quad is empty

- Magic Leap: debug quad is empty
