Skip to main content
Capture a still image from a MuJoCo/R3F canvas. This is useful for dataset provenance, visual regression checks, thumbnails, and policy rollout reports. For WebGL scenes, pass gl={{ preserveDrawingBuffer: true }} to MujocoCanvas when you need deterministic captures after the frame presents.

Signature

Usage

When you use MujocoCanvas, the forwarded MujocoSimAPI exposes capture methods directly:
Use the hook when you own the canvas or want to capture a container:

Standalone Helpers

MujocoSimAPI also exposes getCanvas(), captureFrame(), and captureFrameBlob() for the common MujocoCanvas ref path.

Options

Notes

  • A container target uses the first descendant canvas.
  • capture() returns a data URL for JSON/API payloads.
  • captureBlob() returns a Blob for file uploads or object URLs.
  • Browser canvas security rules apply: cross-origin textures can taint the canvas.