# Displaying "over/under" stereo pairs in XR

**URL:** https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730
**Category:** Questions
**Tags:** uv-mapping, webxr, xr, uvs, uv
**Created:** [March 17, 2025, 9:32pm UTC](https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730 "2025-03-17T21:32:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [March 17, 2025, 9:32pm UTC](https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730/1 "2025-03-17T21:32:36Z")

</div>

I am trying to display stereo pairs in XR mode and follow this [canonical example with a nice girl](https://threejs.org/examples/#webxr_vr_video).

Everything is fine when pairs are in “side-by-side” format, but unfortunately I have them only in “over/under” format and can’t change the source. Looking at example code I see that all magic is in remapping UVs the following way, but can’t figure out how to modify this part for “over/under” case:

```javascript
// Left
const geometry1 = new THREE.SphereGeometry( 500, 60, 40 );
// Invert the geometry on the x-axis so that all of the faces point inward
geometry1.scale( - 1, 1, 1 );

const uvs1 = geometry1.attributes.uv.array;
for ( let i = 0; i < uvs1.length; i += 2 ) {
  uvs1[i] *= 0.5;
}

const material1 = new THREE.MeshBasicMaterial( { map: texture } );

const mesh1 = new THREE.Mesh( geometry1, material1 );
mesh1.rotation.y = - Math.PI / 2;
mesh1.layers.set( 1 ); // Display in left eye only
scene.add( mesh1 );

// Right
const geometry2 = new THREE.SphereGeometry( 500, 60, 40 );
geometry2.scale( - 1, 1, 1 );

const uvs2 = geometry2.attributes.uv.array;
for ( let i = 0; i < uvs2.length; i += 2 ) {
  uvs2[i] *= 0.5;
  uvs2[i] += 0.5;
}

```

Could some experts help me to understand how to solve this task ?

---

<div class="post-metadata">

### Author: ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)
#### Post date: [March 17, 2025, 9:36pm UTC](https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730/2 "2025-03-17T21:36:20Z")

</div>

```javascript
     uvs2[i] *= 0.5;
     uvs2[i] += 0.5;

```

is taking the UV from full screen.. to half screen .. then offsetting it by half the screen.

For top/bottom it may be something like:

```javascript
for ( let i = 0; i < uvs1.length; i += 2 ) { //Top half uvs
    uvs1[i+1] *= 0.5;
}

```

```javascript
for ( let i = 0; i < uvs2.length; i += 2 ) {
    uvs2[i+1] *= .5; // Map UVs to bottom half
    uvs2[i+1] += .5; 
}

```

---

<div class="post-metadata">

### Author: ![yesbird](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/yesbird/32/46097_2.png) [@yesbird](https://discourse.threejs.org/u/yesbird)
#### Post date: [March 17, 2025, 9:42pm UTC](https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730/3 "2025-03-17T21:42:42Z")

</div>

Thanks a lot - you are the wizard !  
It was the fastest assistance in my life 🙂

---

<div class="post-metadata">

### Author: ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)
#### Post date: [March 17, 2025, 9:43pm UTC](https://discourse.threejs.org/t/displaying-over-under-stereo-pairs-in-xr/79730/4 "2025-03-17T21:43:22Z")

</div>

we aim to please! 😃
