Fix residual roll inversion: CV->GL camera conversion is 180 about local Y, not X
This commit is contained in:
@@ -16,12 +16,13 @@ const $ = (s) => document.querySelector(s);
|
|||||||
|
|
||||||
/* The fused pose is a camera-in-world transform in OpenCV convention
|
/* The fused pose is a camera-in-world transform in OpenCV convention
|
||||||
* (+X right, +Y DOWN, +Z FORWARD along the view axis). A Three.js camera uses
|
* (+X right, +Y DOWN, +Z FORWARD along the view axis). A Three.js camera uses
|
||||||
* OpenGL convention (+X right, +Y UP, looks down LOCAL -Z). The two differ by a
|
* OpenGL convention (+X right, +Y UP, looks down LOCAL -Z). The correct change of
|
||||||
* 180° rotation about the camera's local X axis. Without this the world renders
|
* basis between them is a 180° rotation about the camera's local Y axis: it flips
|
||||||
* upside-down and back-to-front (camera appears inverted) even though the pose
|
* the forward axis (+Z_cv view -> three.js -Z) AND the up axis (+Y_cv down ->
|
||||||
* position and scene orientation are correct. Applied after copying the fused
|
* three.js +Y up) together, leaving roll correct. (A 180° about X fixes the view
|
||||||
* quaternion each frame. */
|
* axis too but leaves roll inverted — ghosts render upside-down when the phone is
|
||||||
const CV_TO_GL = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI);
|
* upright.) Applied after copying the fused quaternion each frame. */
|
||||||
|
const CV_TO_GL = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI);
|
||||||
|
|
||||||
let info = { mode: 'dev' };
|
let info = { mode: 'dev' };
|
||||||
let scene3, camera3, renderer, video, canvas2d, ctx2d;
|
let scene3, camera3, renderer, video, canvas2d, ctx2d;
|
||||||
|
|||||||
Reference in New Issue
Block a user