forked from EXT/VR180-Web-Player
Revert "Fix stereo rendering glitches on Meta Quest browsers"
This commit is contained in:
@@ -428,20 +428,25 @@ function init() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use view matrix eye offset for reliable stereo detection
|
const xrCamera = renderer.xr.getCamera();
|
||||||
// This works consistently across Quest Browser updates and Safari/VisionOS
|
|
||||||
// Left eye has negative X offset, right eye has positive X offset
|
|
||||||
const viewMatrix = activeCamera.matrixWorldInverse;
|
|
||||||
const eyeOffsetX = viewMatrix.elements[12];
|
|
||||||
|
|
||||||
if (eyeOffsetX < 0) {
|
if (xrCamera && xrCamera.cameras && xrCamera.cameras.length >= 2) {
|
||||||
// Left eye - show left half of SBS video
|
if (activeCamera === xrCamera.cameras[0]) {
|
||||||
material.map.offset.x = 0;
|
material.map.offset.x = 0;
|
||||||
} else {
|
} else if (activeCamera === xrCamera.cameras[1]) {
|
||||||
// Right eye - show right half of SBS video
|
|
||||||
material.map.offset.x = 0.5;
|
material.map.offset.x = 0.5;
|
||||||
|
} else {
|
||||||
|
material.map.offset.x = 0;
|
||||||
}
|
}
|
||||||
material.map.repeat.x = 0.5;
|
material.map.repeat.x = 0.5;
|
||||||
|
} else {
|
||||||
|
const projMatrixEl8 = activeCamera.projectionMatrix.elements[8];
|
||||||
|
if (projMatrixEl8 < -0.0001) {
|
||||||
|
material.map.offset.x = 0; material.map.repeat.x = 0.5;
|
||||||
|
} else if (projMatrixEl8 > 0.0001) {
|
||||||
|
material.map.offset.x = 0.5; material.map.repeat.x = 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize 2D camera
|
// Initialize 2D camera
|
||||||
@@ -1726,12 +1731,6 @@ function renderXR(timestamp, frame) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Ensure video texture is synchronized with render loop
|
|
||||||
// This prevents glitches from texture update timing issues on Quest browsers
|
|
||||||
if (videoTexture && video && !video.paused && !video.ended) {
|
|
||||||
videoTexture.needsUpdate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleControllerInteractions();
|
handleControllerInteractions();
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user