Issue 1:
Description of the problem

As a dev, I'd like to align the XR view to an arbitrary space. It would help to be able to set an offset reference space for the WebXRManager, to be used when reading the getViewerPose and getPose from the XRFrame.

Proposing:

// add an override reference space to use for reading XR poses
renderer.xr.setOffsetReferenceSpace(space: XRReferenceSpace);

// reset to the initial reference space
renderer.xr.resetReferenceSpace();

WebXRManager.onAnimationFrame : if there is an offsetReferenceSpace set, prefer that space while reading the poses for the player/controllers during the onAnimationFrame

frame.getViewerPose(offsetReferenceSpace || referenceSpace)
frame.getPose(offsetReferenceSpace || referenceSpace)

Usage:

// Shift to an arbitrary position/alignment!

// From the base tracking space.
const baseReferenceSpace: XRReferenceSpace = renderer.xr.getReferenceSpace();

// offset the rotation by 30 degress
const playerRotation = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), MathUtils.DEG2RAD * 30);
const offsetRotation = { x: playerRotation.x, y: playerRotation.y, z: playerRotation.z, w: playerRotation.w };

// offset the tracking to center on our player
const playerPosition = new Vector3(100, 1, 30);
const offsetPosition = { x: playerPosition.x, y: playerPosition.y, z: playerPosition.z, w: 1 };

const transform = new XRRigidTransform(offsetPosition, offsetRotation);
const viewerSpace = baseReferenceSpace.getOffsetReferenceSpace(transform);

renderer.xr.setOffsetReferenceSpace(viewerSpace);

This will enable use of the native webxr XRRigidTransform and XRReferenceSpace for locomotion/movement without requiring the controllers + cameras conform to a specific hierarchy with the camera.parent to be placed at the guess of the floor location.

The controllers already support alternate reference frames now by way of the WebXRController.update(inputSource, frame, referenceSpace) call, which is great, however without a way to set a referenceSpace on the WebXRManager:

1: It only has a visible effect on the view if done in the scene.onBeforeRender (?)

2: Shifting the controllers to a custom reference space duplicates the updates for everything in that hierarchy, which was more perf impactful than I'd imagined when using the XRControllerModelFactory controllers attached.

Note: It is technically possible to use XRTransforms/XRReferenceSpace style currently, but requires a lot of ugly workarounds and intimate knowledge of what WebGLRenderer/WebXRManager is doing and when.

Noticing that the WebXRManager onAnimationFrameCallback includes the XRFrame in the callback, and storing/referencing the XRFrame in your setAnimationLoop.

Inserting a callback into scene.onBeforeRender to read the frame.getViewerPose(myCustomReferenceSpace), and apply to the cameras.

very fragile!

Issue 2:
I'm using Chrome 59.0.3071.125 on an android 5.1.1 device (Epson Moverio BT-300) and it looks like that the lights are not working correctly.

Simple test when running the webgl_interactive_cubes example, all cubes are black beside the one active/selected. Same issue on webgl_geometry_colors, webgl_geometry_colors_blender examples.

webgl_geometry_colors_lookuptable is working limited as colors are visible but detailed structure is not visible and colors are not as shiny as on other devices.

Also MeshLambertMaterial document page shows a black canvas on the device instead of the blue shaded torusKnot. When changing the ambient light of the scene or the emission of the MeshLambertMaterial to a color it is at least flat visible (no 3d effect). Refraction and reflection are working. When using the 'gras' map the torus becomes visible in a 3d manner.

I did also several other tests and it seems that only Materials which are light independent (MeshNormalMaterial, textures) are rendered correct. Either shadows are not visible or the geometry stays black.

Console does not show any error.

Dev

r87

...

Browser

All of them

Chrome

Firefox

Internet Explorer

OS

All of them

Windows

macOS

Linux

Android

iOS

Hardware Requirements (graphics card, VR Device, ...)