Forum Discussion
DrowningMonkeys
10 years agoHonored Guest
Can we use Screenspace Overlay? I can see UGUI in DX11
Hi guys,
I'm a little confused, and just can't seem to find any posts talking much about UI in any of the forums (Except the post titled "New Unity UI + OVR Look-Based Input HOWTO"). One of the things that seemed clear from the gate was that you couldn't do traditional UI in oculus because of the two cameras, etc etc. But when I compile the game with DX11 (or launch with -force-d3d11), and ran a few tests with unity's new UI (4.6) and a "Screen Overlay" canvas, I actually see the canvas, it's just upside down and backwards. I can see my mouse cursor, I can select buttons. Everything works as expected, without having to do any tricks... EXCEPT that it's upside down and backwards. Am I the only one seeing this? Does this mean that using the screen overlay canvas is a possibility?
I'm a little confused, and just can't seem to find any posts talking much about UI in any of the forums (Except the post titled "New Unity UI + OVR Look-Based Input HOWTO"). One of the things that seemed clear from the gate was that you couldn't do traditional UI in oculus because of the two cameras, etc etc. But when I compile the game with DX11 (or launch with -force-d3d11), and ran a few tests with unity's new UI (4.6) and a "Screen Overlay" canvas, I actually see the canvas, it's just upside down and backwards. I can see my mouse cursor, I can select buttons. Everything works as expected, without having to do any tricks... EXCEPT that it's upside down and backwards. Am I the only one seeing this? Does this mean that using the screen overlay canvas is a possibility?
10 Replies
Replies have been turned off for this discussion
- dignifiedwebExpert ProtegeScreen overlay is possible, but it only usually renders on one eye when I've tried it. There are 3 options to set the canvas from what I remember: 1.) Screen overlay 2.) Camera something... 3.) Worldspace
With the 2nd option, you can select cameras to render the UI on. So it's like screen overlay, but you can drag the left and right cameras onto it. I believe Oculus' best practices recommend something like Worldspace though, as you can get a better focus on it if you can move it around to the center of your view/lens.
Hope that helps. - DrowningMonkeysHonored GuestNot exactly... The problem there is that you need to render the camera to a rendertexture, then attach the rendertexture to the center anchor so that it sits properly between the left and right cameras. You can't render "Screenspace - Camera" to the left or right eye - because then you'd only be able to see it out of one eye. This does not provide a good solution for my specific problem right now, which is rendering HealthBar's over enemies. So when I saw the mouse cursor behaving properly and the "Screenspace Overlay" almost behaving properly, my hope was that they were working towards solving this problem with UI.
- cyberealityGrand ChampionLook at how the Oculus demo scenes (included w/ the integration) make a HUD when pressing space.
- DrowningMonkeysHonored GuestThey do it the way i mentioned before - they render to a render texture. I don't have a problem with this methodology in general guys, that's not what this post is about. This post is about the fact that "Screenspace - Overlay" mostly works, and if theres a way to get it to work 100% That's what i want. It would make rendering healthbar's and status effects over realworld characters MUCH easier. Rendering to a render texture is very difficult for that.
- cyberealityGrand ChampionSo why not just have quads floating in space. This should work fine, no?
- dignifiedwebExpert Protege
"DrowningMonkeys" wrote:
They do it the way i mentioned before - they render to a render texture. I don't have a problem with this methodology in general guys, that's not what this post is about. This post is about the fact that "Screenspace - Overlay" mostly works, and if theres a way to get it to work 100% That's what i want. It would make rendering healthbar's and status effects over realworld characters MUCH easier. Rendering to a render texture is very difficult for that.
Is that a Unity 5 thing? I did a quick test in Unity 4 a week back or so using the "Screenspace - Camera" and I didn't have to do a render texture. I just made a duplicate of the canvas and selected the left eye anchor, then the right eye anchor on the other one and it seemed to work on both eyes just fine.
I was talking about it here for a bit too:
https://forums.oculus.com/viewtopic.php?f=77&t=22828
It may not be the best solution, but just what I tried that seemed to also work. You might be able to add a second canvas component instead of having a duplicate gameobject.
Also, what cyber said too, that's what I've heard a lot of people do. - DrowningMonkeysHonored Guest
"cybereality" wrote:
So why not just have quads floating in space. This should work fine, no?
Because canvases are in 2D space, so you'd need a canvas for every healthbar you were trying to render. - DrowningMonkeysHonored Guest
"dignifiedweb" wrote:
"DrowningMonkeys" wrote:
It may not be the best solution, but just what I tried that seemed to also work. You might be able to add a second canvas component instead of having a duplicate gameobject.
You can't have two canvas's on one gameobject, so i'd have to add additional code to manage 2 sets of everything. This would mean id need new code, twice the draw calls, to manage the same UI I'm getting on a regular GUI. It seems like not the most efficient method here. - DrowningMonkeysHonored GuestHere's something that the oculus guys did in 0.6 that i never thought of, instead of attaching a rendertexture to the 'CenterEyeAnchor', they attached a worldspace canvas. That makes sense and should solve most my problems, gonna try it now.
- dignifiedwebExpert Protege
"DrowningMonkeys" wrote:
Here's something that the oculus guys did in 0.6 that i never thought of, instead of attaching a rendertexture to the 'CenterEyeAnchor', they attached a worldspace canvas. That makes sense and should solve most my problems, gonna try it now.
Sorry man, I should have suggested that first. That's my goto thing. I could have swore I suggested that, guess I didn't. Hope it works out.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 4 years ago
- 2 years ago
- 9 years agoAnonymous
- 11 months ago
- 9 months ago