Skip to main content
Up and Coming
May 21, 2015

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?
    This topic has been closed for replies.

    10 replies

    Inspiring
    May 21, 2015
    Screen 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.
    Check out my Mobile VR Jam 2015 title Man Overboard! - Try the DK2 Version if you don't have a Gear VR
    Up and Coming
    May 21, 2015
    Not 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.
    Inspiring
    May 21, 2015
    Look at how the Oculus demo scenes (included w/ the integration) make a HUD when pressing space.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Up and Coming
    May 21, 2015
    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.
    Inspiring
    May 21, 2015
    So why not just have quads floating in space. This should work fine, no?
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    Inspiring
    May 21, 2015
    "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.
    Check out my Mobile VR Jam 2015 title Man Overboard! - Try the DK2 Version if you don't have a Gear VR
    Up and Coming
    May 21, 2015
    "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.
    Up and Coming
    May 21, 2015
    "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.
    Up and Coming
    May 22, 2015
    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.
    Inspiring
    May 22, 2015
    "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.
    Check out my Mobile VR Jam 2015 title Man Overboard! - Try the DK2 Version if you don't have a Gear VR