engine
engine copied to clipboard
GSplats stereoscopic rendering (viewport size issues)
Currently GSplats has to use viewport dimensions which affects the way they are rotated and scaled. Aspect ratio of this viewport is the main driving element. In WebXR stereoscopic scenario, viewport is split into two so the the renderer of the splats look wrong.
The quick workaround I've made is to detect if there are multiple XR views, and split viewport width in two:
const viewport = [0, 0];
pc.GSplatInstance.prototype.updateViewport = function () {
const device = this.splat.device;
viewport[0] = device.width;
viewport[1] = device.height;
if (app.xr.active && app.xr.views.list.length === 2)
viewport[0] /= 2;
this.material.setParameter('viewport', viewport);
};
But it needs a slightly better solution, for getting an actual viewport of a view.
another mention: https://forum.playcanvas.com/t/apple-vision-pro-examples/36024/12