engine icon indicating copy to clipboard operation
engine copied to clipboard

GSplats stereoscopic rendering (viewport size issues)

Open Maksims opened this issue 2 years ago • 1 comments

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.

Maksims avatar Feb 15 '24 10:02 Maksims

another mention: https://forum.playcanvas.com/t/apple-vision-pro-examples/36024/12

mvaligursky avatar Aug 27 '24 09:08 mvaligursky