[SOLVED] Render worldspace UI on top of everything.

Hello, I have a basic worldspace UI canvas that I need to render on top of everything in front of it. This is for VR so I have reasons. Its a simple rectangular UI sprite image, with a basic UI mask sprite (circle). I’m using built-in render pipeline, and we are not using the Unity layering system (yes I know :sweat_smile:)

I created a basic unlit frag shader with Z space parameters as such

Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
ZWrite Off
ZTest Always

I attached this to the image and mask, and it renders them on top of every thing but the mask stops masking. Can anyone recommend a way to enable the mask?

My research tells me I might need to use a stencil buffer, but I’m not entirely sure how that works

You can try using normal Canvas

Recalculate when the camera moves

Calibrate the world spatial position that the image should correspond to

Thanks for replying. By normal canvas do you mean screen space overlay? I’m using VR so I need to use WorldSpace, nor can I reference the camera, as there are two. One for each eye. I tried a Stencil mask, works very well. But stencil doesn’t seem to work with UI objects

I found the solution: there is a modified UI default shader that included stencil parameters. I added Ztest Always:|