--- a/composition/shared/social-stage.js +++ b/composition/shared/social-stage.js @@ -208,6 +208,14 @@ const corners = [new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3(), new THREE.Vector3()]; const normal = new THREE.Vector3(), centre = new THREE.Vector3(), toCam = new THREE.Vector3(); const mapScreen = (el, group, dims) => { + // The footage is a DOM layer above WebGL. Clip it in screen-local space + // before the perspective transform, using the same quadratic corners as + // roundedPlane(), so no rectangular video corners cover the device bezel. + const w = el.offsetWidth, h = el.offsetHeight; + const rx = dims.sr / dims.sw * w, ry = dims.sr / dims.sh * h; + el.style.borderRadius = "0"; + el.style.overflow = "hidden"; + el.style.clipPath = `path("M ${rx} 0 H ${w - rx} Q ${w} 0 ${w} ${ry} V ${h - ry} Q ${w} ${h} ${w - rx} ${h} H ${rx} Q 0 ${h} 0 ${h - ry} V ${ry} Q 0 0 ${rx} 0 Z")`; const z = dims.d / 2 + 0.0016; corners[0].set(-dims.sw / 2, dims.sh / 2, z); corners[1].set(dims.sw / 2, dims.sh / 2, z);