capture_viewport_to_buffer

omni.kit.viewport.utility.capture_viewport_to_buffer(viewport_api, on_capture_fn: Callable, is_hdr: bool = False)

Captures the current viewport and sends the image to a callback function.

Parameters
  • viewport_api (ViewportAPI) – The viewport API instance to capture.

  • on_capture_fn (Callable) – The callback function that will receive the image.

  • is_hdr (bool, optional) – If True, captures the HDR buffer; otherwise, captures the LDR buffer. Defaults to False.

Returns

A future-like object that can be awaited to ensure the capture completes.