@abhishekjoshinj luckily @mati-nvidia covered the topic of changing viewport renderer programmatically in a past livestream using action registry. though not directly through viewport API, hopefully it’s still worth knowing:
and below is the snippet for each of the renderers:
# RTX Real-Time
import omni.kit.actions.core
action_registry = omni.kit.actions.core.get_action_registry()
action = action_registry.get_action("omni.kit.viewport.actions", "set_renderer_rtx_realtime")
action.execute()
# RTX Path Tracing
import omni.kit.actions.core
action_registry = omni.kit.actions.core.get_action_registry()
action = action_registry.get_action("omni.kit.viewport.actions", "set_renderer_rtx_pathtracing")
action.execute()
# Iray
import omni.kit.actions.core
action_registry = omni.kit.actions.core.get_action_registry()
action = action_registry.get_action("omni.kit.viewport.actions", "set_renderer_iray")
action.execute()
# Storm
import omni.kit.actions.core
action_registry = omni.kit.actions.core.get_action_registry()
action = action_registry.get_action("omni.kit.viewport.actions", "set_renderer_pxr_storm")
action.execute()