Worldspace UI (UI widgets that respect camera depth buffer)

Has true worldspace UI been added to Nvidia Omniverse? (Note that when the term “Worldspace UI” is used it is referring to UI that can be occluded with stage/scene geometry/prims.)

I have seen a few other posts relating to this topic but they have all been closed or have gone unanswered:

Are there any Omniverse examples of true worldspace UI or does the Omniverse engine only support worldspace overlay UI using omni.ui.stage and viewport overlays?

Is it possible to have a XForm plane object within a stage then use a normal UI window render to a texture to then pass that texture to the plane’s material?

Example of what my end goal is:
Worldspace UI Example

Yes we already support all of that. Please refer to our SCENE UI extension. Overview — Omniverse Kit

Also we have even built some XR / VR menu examples you can play with here GitHub - NVIDIA-Omniverse/kit-xr-samples

1 Like

Awesome, Thanks!

For others who are looking for a direct answer:
Make sure to add these to your kit app dependencies list (yourapp.name.kit)

"omni.kit.xr.scene_view.core" = {}
"omni.kit.xr.scene_view.utils" = {}

Then make a new python class:

from typing import Any, Dict, Optional
from omni import ui
from omni.kit.xr.scene_view.utils import UiContainer, WidgetComponent

class SimpleTextWidget(ui.Widget):
    def __init__(self, text: Optional[str] = "Simple Text", style: Optional[Dict[str, Any]] = None, **kwargs):
        super().__init__(**kwargs)

        if style is None:
            style = {"font_size": 50}

        self._ui_label: Optional[ui.Label] = None
        self._text = text
        self._style = style
        self._build_ui()

    def set_label_text(self, text: str):
        self._text = text
        if self._ui_label:
            self._ui_label.text = self._text

    def _build_ui(self):
        self._ui_label = ui.Label(self._text, style=self._style, alignment=ui.Alignment.CENTER)

Spawn text into scene

static_text_widget_component = WidgetComponent(SimpleTextWidget, width=400, height=200)
self._static_text_widget_container = UiContainer(static_text_widget_component)

The example above is from the kit-xr-examples extension repo. Within the repo you must use the toolbar once the example extension is loaded to display their examples.

See more widget examples

1 Like

Great ! Thank you for posting the solution !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.