gl.scissor region tracking a
DOM element — a transparent picture-in-picture overlay on the main canvas. Unlike
useCameraStream, it scissors into the main canvas
instead of re-reading pixels, so it is cheaper, but it has constraints (see
below).
Signature
CameraViewportOptions is the camera-selection and pose subset of
CameraFrameCaptureOptions (cameraName / siteName / bodyName, position +
lookAt, fov, offsets, mujocoCameraCompatibility, …).
Usage
useCameraViewport with a ref to your element. Call it inside <MujocoCanvas>;
the tracked element can live anywhere in the DOM:
Notes
- The render is composited into the main canvas at the tracked element’s screen rect, so the element itself stays transparent — style it with a border/label, not a background.
- The managed render loop only activates while a view is mounted; apps that never
use
CameraView/useCameraViewportkeep R3F’s automatic rendering. - Prefer
useCameraStreamfor tiles embedded in HTML panels, postprocessing setups, or splat-heavy scenes.