Set custom viewport resolution

Hi,
I am using the viewport_api together with the SyntheticDataHelper to extract images from predefined cameras for my application. To this means I need to set the Camera resolution to a predefined value.

However when I create a viewport window in a StandaloneApplication and set the desired resolution, after every call to SimulationApp.Update() the viewport_api resolution is reset to the default value.
The Debug stack shows that this is caused by the Viewport-Window Menubar, which calls the resolution setter in its _on_current_item_changed callback and thereby resets the resolution back to the default value. (See attached screenshot)

Can I disable the menubar in the viewport-window I am creating, or avoid this issue in any other way?

Thanks
Thomas

camera = create_camera_prim(camera_prim_path, position, orientation, attributes)

viewport_resolution = (800, 400)
window_width = viewport_resolution[0]
window_height = viewport_resolution[1]

viewport_window = create_viewport_window(
        name=window_name,
        position_x=0.0,
        position_y=0.0,
        width=window_width,
        height=window_height,
        camera_path=camera_prim_path,
    )

viewport_window.viewport_api.set_active_camera(camera_prim_path)
viewport_window.viewport_api.resolution = viewport_resolution

viewport_window.viewport_api.set_active_camera(camera_prim_path)
viewport_window.viewport_api.resolution = viewport_resolution
resolution_before_update = viewport_window.viewport_api.resolution
simulation_app.update()
resolution_after_update_1 = viewport_window.viewport_api.resolution
simulation_app.update()
resolution_after_update_2 = viewport_window.viewport_api.resolution


Hi @ManicMunchkin. Looks like this is more specifically an Isaac Sim issue so I’ve moved this topic to that forum.

Hi there,

you can use the Replicator API for accessing synthetic data:

Or using the camera sensor:

Hi
thanks for pointing me towards the Camera Sensor! That somewhat simpllifies my code.
However I still would like to preview the camera image in a viewport, for which I would need to adapt the viewport resolution accordingly.
Does the viewport-resolution setting need to be applied after every world reset?

Regards
Thomas