Skip to content

Commit

Permalink
Fix 3D Gaussian Splat rendering in VR (playcanvas#6896)
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott committed Aug 28, 2024
1 parent 04847c6 commit 500475c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/scene/gsplat/gsplat-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ class GSplatInstance {
const device = this.splat.device;
viewport[0] = device.width;
viewport[1] = device.height;

// adjust viewport for stereoscopic VR sessions
if (this.cameras.length > 0) {
const camera = this.cameras[0];
const xr = camera.xr;
if (xr && xr.active && xr.views.list.length === 2) {
viewport[0] /= 2;
}
}

this.material.setParameter('viewport', viewport);
}

Expand Down

0 comments on commit 500475c

Please sign in to comment.