- Home /
Unity UI for AR Glasses and object tracking? (Stereoscopic)
Trying to make an app that has 2 things going on simultaneously:
-Tracking an image and having a 3D object (using Vuforia) follow it in the view -Has a UI using the Unity UI system
These appear to be mutually exclusive. Using a pair of ODG R-7's by the way. The UI system doesn't seem to work with the ARCamera (which has one camera for each eye since it's stereoscopic) and I either can't see the UI at all, or the UI is overlaid over both cameras, so one eye gets half and the other eye gets the other half (which as you can imagine looks really weird).
Is there any way I can get the UI to render / overlay properly to both cameras so I can have a stereoscopic setup that is tracking and rendering the 3D object with a Unity UI being rendered properly simultaneously?
Seems like I'm missing something here....
Answer by Straafe · Apr 29, 2017 at 09:41 AM
I found a wacky approach that actually seems to be working. I hate how janky it is, but it might be the only thing that works right now, if anyone else needs it:
--Make a new camera, that renders to a render texture. Make the actual UI only visible to this camera and nothing else (I think I set the original ui to Screen Space Overlay Camera as well, poitning at the ARCamera's camera), and set clear flags to depth only so the render texture is transparent anywhere there isn't UI stuff.
--Now, create a second UI Canvas. It should only contain 2 UI objects: 2 Raw Image objects. Each of them should be set to stretch and be exactly half of the canvas, one on the left and one on the right.
--You guessed it, put the render texture from step 1 as the texture for the Raw Image objects, so now we have the original UI being rendered on each half of the screen. This second canvas can now be set to Screen Space Overlay and the two halves should each have the original UI and it looks correct in the glasses (the original UI is on both eyes).
It worked for me on my first basic test, but I tried a bunch of janky stuff like this and sometimes they don't work in every situation. Also, I knew the exact resolution of the AR glasses' screens (1280x720) beforehand, so of course I set that up as the render texture's resolution.
Your answer
Follow this Question
Related Questions
Random NVidia 3D Vision behavior (window mode) 0 Answers
How to use stereoscopic rendering for CAVE systems 0 Answers
Using "Stereo Display (non head-mounted)" in Virtual Reality generates very low resolution 1 Answer
Game is in Stereo 3D, but I want that the UI looks 2D. Do you know how it works? 1 Answer