useFrameCapture, this renders the scene to an offscreen render target.
It does not require preserveDrawingBuffer.
Signature
CameraFrameCaptureResult and CameraFrameCaptureBlobResult include
source.kind, which is one of mujoco-camera, mujoco-site, mujoco-body,
custom-camera, explicit-pose, or fallback-camera. Dataset recorders should
prefer the MuJoCo-mounted source kinds.
Usage
API Ref Path
MujocoSimAPI exposes the same offscreen camera capture methods:
mujocoCameraCompatibility is only applied to named MuJoCo <camera> captures.
It derives width/height from MJCF resolution, uses MJCF fovy, copies visual
clip planes when available, and installs an asymmetric projection matrix from
cam_intrinsic and cam_sensorsize when those arrays are exposed by the WASM
model. Leave it off for synthetic position + lookAt probes where you are
manually matching a dataset view.
Use projectionMatrix when you already have calibrated camera intrinsics. Use
visualOverrides to temporarily override scene background, environment, fog,
shadow maps, tone mapping, or output color space for one capture. Use
renderIsolation when policy or training images should be rendered with an
independent offscreen WebGLRenderer instead of inheriting viewer renderer
state.
Policy Image Payloads
UseusePolicyCameraFramesFromMountedStreams or
capturePolicyCameraFramesFromMountedStreams when a policy expects image keys
such as observation.images.front and observation.images.wrist.
The helper resolves dataset stream names to mounted MuJoCo cameras, sites, or
bodies, captures each stream, and returns both raw frames and payload-ready
data URLs.
result.frames.wrist, result.images.wrist, and
result.images["observation.images.wrist"] are populated even though the
mounted MuJoCo camera is named wrist_cam.
Notes
- Use
cameraNamefor MuJoCo<camera>elements, orsiteName/bodyNamefor robot-mounted camera frames. - Use
positionOffsetandquaternionOffsetto calibrate a mounted camera pose without editing MJCF. Offsets are applied in the mounted camera/site/body local frame. Quaternion arrays use Three.js order[x, y, z, w]; convert MuJoCo[w, x, y, z]quaternions before passing them. - Use
position+lookAtonly for synthetic fixed debug cameras. - Use
quaternionwhen replaying a recorded camera pose. - Use
camerato clone an existingTHREE.Camera. - The returned canvas is generated from an offscreen render target.
- Use
hiddenGeomGroups,visibleGeomGroups, orhiddenGeomNamesto match a dataset renderer without changing the interactive scene. - Use
visualOverridesandrenderIsolationfor canonical policy/training captures that should not inherit the interactive viewer’s visual effects. - Use
flipXto mirror captured frames horizontally when matching a policy dataset or camera convention that stores mirrored images. - Advanced renderers can attach a function to
CAMERA_FRAME_CAPTURE_RENDER_USER_DATA_KEYin scene objectuserDatato provide custom Three pixels for capture.