Forum Discussion

EudenOne's avatar
EudenOne
Explorer
24 days ago
Solved

How to render UI over 3D mesh and controllers on top of UI

What I want is for the UI to be visible over all 3D geometry (ignoring depth) BUT at the same time have the line-casts and the controllers visible over that UI.

[ UI Panel ] | [3D World Mesh] | o------ [Hands or controllers]

With underlay the UI Panel is not visible, culled by the 3D Mesh.
With overlay, the controllers and lines are covered by the UI.

My solution, but awful for performance:
Using URP stacked cameras, the UI and controllers are rendered over everything. Again performance tanks with this method but it's exactly what I want.

Possible solution:
Underlay transparent but ignoring depth... hard to test as it requires making a custom shader. 
I can set controllers to 4000 render queue and transparent and they do render over everything.

  • SOLVED:

    Using Unity URP Render Features:

    • Add Render Objects to the features
    • Event: After Rendering Transparent; Queue: transparent; Layer: <one layer, mine called Overlay UI>
    • In Overrides: Mode: None; Depth Test: Disabled 
    • Set on OVROverlay Canvas: Overlay type: Underlay; Opacity: Transparent
    • Finally, the interactor rays must be on the defined layer and with a transparent material.

    And that's it, the important bits are in bold. Now the UI renders above any 3D mesh, and the pointer also are above the UI and any other mesh, all that without the performance hit of rendering twice via stack camera. 

1 Reply

  • SOLVED:

    Using Unity URP Render Features:

    • Add Render Objects to the features
    • Event: After Rendering Transparent; Queue: transparent; Layer: <one layer, mine called Overlay UI>
    • In Overrides: Mode: None; Depth Test: Disabled 
    • Set on OVROverlay Canvas: Overlay type: Underlay; Opacity: Transparent
    • Finally, the interactor rays must be on the defined layer and with a transparent material.

    And that's it, the important bits are in bold. Now the UI renders above any 3D mesh, and the pointer also are above the UI and any other mesh, all that without the performance hit of rendering twice via stack camera.