Is there a way to capture a screenshot of a camera or viewport
that is not looking at the screen?
When I click a button, I want to save a screenshot of the area
illuminated by a specific camera, not the screen the user is looking at.
I looked at omni.viewport.utililty and omni.kit.widget.viewport,
but they only had the ability to capture a screenshot of the active viewport.
I had two ideas.
One thing is to create two viewports:
the main viewport is the viewport the user is looking at,
and the second viewport is the viewport looking at the screen
I want to take a screenshot of.
This is the code I tried
from omni.kit.viewport.utility import get_viewport_from_window_name, capture_viewport_to_file viewport = get_viewport_from_window_name("Viewport 2") capture_viewport_to_file(viewport, r"capture.png")
When this code is executed,
the file is saved normally when the user is looking at the corresponding viewport,
but it does not work when the user is looking at a different viewport.
The second idea is to add a camera
that is facing the area I want to take a screenshot of,
so I can switch to Switch Camera → Capture Screenshot → Switch back to the main camera.
However, this is a method that I do not want to use as much as possible
because the screen flickers when viewed by the user.
If there is a good way, please let me know.