Skip to content

Commit

Permalink
Fix 3D Gaussian Splat rendering in VR (#6896)
Browse files Browse the repository at this point in the history
  • Loading branch information
willeastcott authored and slimbuck committed Sep 5, 2024
1 parent f6da947 commit b44140e
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 b44140e

Please sign in to comment.