Hololens Unity app always deploys in 2D instead of 3D - unity3d

I'm developing an app for the Hololens 1 in Unity, and it runs perfectly fine on the device when using Holographic Remote. However whenever I build and deploy the application through Visual Studio, it then only launches in 2D mode on the Hololens (as a flat "window" you can position in space). What settings control this behaviour?
Unity version is 2019.1.4f1,
Visual Studio is 2017 Community Edition,
I'm on Windows 10.
Developer mode is turned on on both the HL and my desktop. Virtual Reality Support is ticked in Unity, the Mixed Reality SDK is added to the list and the Build settings are on x86 / D3D Project.
I tried replacing my scene with one of the examples from the MRTK, but to no avail. Strangely enough, if I make a clean new project with nothing except the MRTK example in it it does deploy properly, so there must be something in my project interfering. I just can't figure out what.
Expected behaviour is that the application launches in "room scale" mode, i.e. all other applications disappear and the objects in my scene can be viewed in 3D.
EDIT: This has been marked as a possible duplicate. The answers given there do not solve my problem, however. I already made sure that "Virtual Reality Supported" is ticked in the XR settings and the SDK is added to the list. I don't think I have a Windows Insider preview, but since I was able to deploy perfectly fine with a fresh project I don't think that's really the problem...

It appears Vuforia was causing the issues. I got it to deploy in 3D with 'Vuforia Augmented Reality Supported' ticked and the following settings in VuforiaConfiguration:
Camera Device Mode: MODE_OPTIMIZED_SPEED
Device Type: Digital Eyewear
Device Config: Hololens
Video Background DISABLED
Device Tracker DISABLED
Furthermore, 'Vuforia' must not be added to the list of Virtual Reality SDKs in XR Settings.
Note that I have not tried all subsets of these settings individually, some of them might not have an impact whatsoever (except for the last one, I am quite certain adding that SDK will force the app into 2D mode).
Also note that I haven't verified that Vuforia actually works correctly on the Hololens, just that I can deploy the app in 3D mode with it enabled, given the above settings. If someone could confirm that Vuforia is even supported by MRTK v2?
EDIT: apparently the problem is also caused by ticking "WSA Holographic Remoting Supported" in the XR Settings, so be sure to disable that.

Related

Unity 3D GameObjects not visible in HoloLens2, MRTK

I followed this tutorial https://learn.microsoft.com/en-us/training/modules/learn-mrtk-tutorials/1-1-introduction and did every step. But when I run it on the HoloLens, I don't see anything.
Build configurations are as in the tutorial, HoloLens2 is in Developer mode and has been paired before. Tools are as in https://learn.microsoft.com/de-de/windows/mixed-reality/develop/install-the-tools?tabs=unity
I am building the app over WIFI.
When the app starts on HoloLens, mesh appears for a moment and I get a question asking if it is allowed to use on my microphone.
"Build with Unity" or similar does not appear, and no objects either. I see "nothing".
What could be the problem?
I use:
Unity 2021.1.20f
MRTK v1.0.2206. Preview (from Microsoft Download Center)
It was actually the wrong Unity version.
I am now using Unity 2020.3.4 and I can see and move the objects.

Mismatch of stereoscopic rendered images on HoloLens2

I am using Unity 2019.3.15f1 with the MRTK 2.4.0 for developing an augmented reality app on the HoloLens 2. Unfortunately, the stereoscopic rendering is not working correctly. There is a mismatch between the images rendered for the right and the left eye. You see two images of the scene, running the app on the HoloLens. It doesn`t matter if I am using the Remote Player or ruining a builded app on the HoloLens. In both cases there are two not matching rendered images for both eyes. The HoloLens is calibrated. Other Apps from the microsoft store, or the "Homemenu" at the HoloLens have no mismatch of the images. But if I am running MRTK-example scenes on my HoloLens 2 there is also a dismatch between the rendered images for both eyes.
Does anyone had troubles with the same issue and can provide some ideas about a solution how the images can be matched correctly for both eyes?
It seems like something went wrong in your Unity project setting, it is recommended to double-check the XR Setting to troubleshoot. For XR SDK, please follow this link: Getting started with MRTK and XR SDK. For Legacy XR, have a look at Legacy XR
Besides, we always recommend the latest Unity LTS (Long Term Support) and MRTK as the best version so that we can avoid some known issue, and the current recommendation is to use Unity 2019.4.20f1 and Mixed Reality Toolkit v2.5.4.

Hololens 1 does not detect air tap or other gestures in MRTK scene

I am currently working on developing an application for the Hololens 1 using Unity and MRTK.
I have been unable to get the air tap or any other input working in my application. The ring pointer for airtap does not appear in the application even though it works in the Unity Play Mode Input Simulation and other applications on the device. I tried it with the MRTK examples and even those did not work on the device.
Also I had to add the Tracked Pose Driver from the Player Settings to get the camera working properly but have not figured out how to get the application to accept gesture input.
Also tried the solution listed here: Why is 'air tap' gesture not working on HoloLens1 in my Unity/MRTK app?
but that did not work.
Will appreciate any guidance to solve this problem.
I finally got my project working after a lot of trying.
It turned out that initially, I had unknowingly configured the project to use XR SDK in Unity 2019 and thus had to configure MRTK accordingly. Thank you to Kevleigh for helping me with the issue here: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/7850
While this did work for my example project, I couldn't get the main project to work with the same settings even after installing all the plugins.
Finally, I had to switch to Unity 2018 and I got the project working with MRTK 2.3 and the default configuration. So, while Unity 2019 did not work for me you can get it working with XR SDK as suggested in the above link.

Vuforia AR Camera working from the second attempt on Android

I have an Android application which I created using Unity and C#, it also uses Vuforia. I have an AR Camera, which shows a black screen when I have just installed the application and gave camera permission to it, but when I close the app and start it again, everything works fine. I did a lot of searches, so what I found and tried- to Switch automatic graphics to OpenGls2, to set minimization to none, etc. Upgrading Vuforia version will not work for me. Also ARCamera works for phones supporting ARCore and does not work for phones not having ARCore. So I guess, the issue is within the architecture of the phone. Any ideas on how to make it work?
It must be related to camera API. I don't know how Vuforia is trying to initialize the camera. Seems like it tries to initialize it before successful permission result on old Android versions. You can delay Vuforia initialization to be after the permission check. There is an option to set Vuforia delayed initialization, but it would be better to make a preload scene where you do check all permissions and maybe other setup and then load the scene where Vuforia is used.
Update: Please try to update xr plugins for Unity (they are packages now), update Unity itself to the latest version. Do not use unity beta. Se if there are some recommendations from Vuforia of which unity version is the latest supported. Youc also try to create a new unity project from scratch and then import the latest vuforia, then try camera on android, then if all good, import all the resources for your app.

Hololens Spectator View Android Spatial Failure

I need to connect an Android device to a Hololens for 'spectator' viewing as in the sample 'Build 2019 Demo' code. However when I launch the Android and Hololens builds and enter the Hololens IP address on the Android side, all I see is an 'ArUco' code. No video and no 3D content are visible on the android device.
I should add that I have painstakingly reviewed the sample project as compared to my project and cannot determine any relevant differences.
Naturally, I want to get past this screen-code, but I am also confused about where this ArUco code exists in the application flow as it isn't part of any scene (or flow)that I am aware of.
The ArUco code is appearing in order to localize the two devices. If everything is compiled correctly, the HoloLens will start using its camera to detect the ArUco code. Once its detected, the ArUco code will be dismissed and content will be positioned correctly across the two devices. It may be that you are missing the OpenCV native plugins required for ArUco marker detection. Instructions on how to build those plugins can be found here. You specifically need an x86 version of SpectatorView.OpenCV.dll for ArUco detection to work on a HoloLens 1 device.
The Build2019 sample uses Azure Spatial Anchors compared to ArUco markers for localization. If you want to use Azure Spatial Anchors, you need to go to Spectator View -> Edit Settings and Add a SpatialAnchorsCoordinateLocalizationInitializer to the prefab. You also need to declare in the SpatialLocalizationInitializationSettings a Prioritized Initializer that references this SpatialAnchorsCoordinateLocalizationInitializer. This will cause the SpatialAnchorsCoordinateLocalizationInitializer to be used compared to the default ArUco localization initializer.
If you have set up these settings, it may be that the SpatialAnchorsLocalizer isn't registering as available on your Android or HoloLens device. You need to add the SPATIALALIGNMENT_ASA preprocessor directive to your Android and WSA Player Settings to get the SpatialAnchorsLocalizer to declare itself as supported.