alelievr / HDRP-UI-Camera-Stacking

Optimized implementation of camera stacking for UI only in HDRP.
MIT License
181 stars 22 forks source link

VR Support? #7

Closed hybridherbst closed 9 months ago

hybridherbst commented 2 years ago

It's great to see this referenced from the official Unity blog!

While I understand this is absolutely no guarantee for support here would still be great if this would indeed support VR where performance is pretty critical (and goes bad with a separate UI camera right now).

As far as I can see that would mostly mean supporting the right RT layout, and supporting stereo instancing in the compositing shader...

alelievr commented 2 years ago

Hello :)

I looked into this and sadly adding VR support is more complicated than that, it requires another compositing system because it overlaps with the XRMirrorView in HDRP. I still want to add VR support but the API for that is not there yet.

Also, this package was mainly developed for screen-space UI which doesn't work for VR (the UI needs to be projected in world space to match the views).

tkslan commented 1 year ago

@alelievr any updates can be made to support VR ?

alelievr commented 1 year ago

Hey, I didn't had time to work on this unfortunately but I'm trying to officially integrate this work in the HDRP package with a new "UI" mode for the camera. The goal for this official implementation would be to also support XR.

Btw, can you confirm that you need this package for "Screen-Space" UI in VR and not world space UI? (i.e. a HUD like in this video with the score and HP: https://youtu.be/jVAI1LzKuUs?si=h60nRccyJxy8L-2e&t=318)

DriesVRBase commented 10 months ago

Just gonna leave a comment to say thanks for the package! For my project World space UI would be very useful but I understand that that isn't easy :)

alelievr commented 10 months ago

The issue with world space UI is that you need depth test in the shader and if the depth buffer is jittered (TAA, DLSS, etc.), then you can't use it outside of the Forward HDRP pass. In this situation, you have to deal with the jittering of your objects when they are depth-tested either by trying to stabilize the depth (expensive and complicated) or try to fade out the problematic areas.

DriesDeRidder commented 10 months ago

Thanks for the explanation! I made it work now with 2 global custom pass volumes. Seems to work fine for now :)

alelievr commented 9 months ago

I added VR support in the latest version as experimental so I'm going to close this issue. There will probably be some things that don't work as expected inside the headset, so you can re-open new issues if that happens :)