Jump to content

Cannot connect to Direct Preview


Alex Jones
 Share

Recommended Posts

Hello, I am working in Unity 2020.3.11f1 using WaveXR SDK 4.1.1 to develop and app for the Vive Focus 3

I am having trouble setting up the Direct Preview feature, I have a working build of my application on the headset but no great way to debug it. I have followed the guide here, https://hub.vive.com/storage/docs/en-us/UnityXR/UnityXRDirectPreview.html, with but after I start the device APK I will just end up with a connection time out every time.

image.png.da630c7ed0ac9726b29a8d1916d83798.png

I am using this to get the device IP, I have also made a script in unity using Dns.GetHostEntry(Dns.GetHostName()).AddressList to print the IP of the device in the headset, this returned 192.168.1.145

image.thumb.png.1688be71b06403fa58171bb15f131c11.png

These are the settings for Direct Preview in the editor

image.thumb.png.8de054f6283a2fe59c3fa73d68fb17fc.png

And this is the output when starting the server, it does not change when I launch the device APK

Any help would be greatly appreciated!

  • Thanks 1
Link to comment
Share on other sites

13 hours ago, Alex Jones said:

Hello, I am working in Unity 2020.3.11f1 using WaveXR SDK 4.1.1 to develop and app for the Vive Focus 3

I am having trouble setting up the Direct Preview feature, I have a working build of my application on the headset but no great way to debug it. I have followed the guide here, https://hub.vive.com/storage/docs/en-us/UnityXR/UnityXRDirectPreview.html, with but after I start the device APK I will just end up with a connection time out every time.

image.png.da630c7ed0ac9726b29a8d1916d83798.png

I am using this to get the device IP, I have also made a script in unity using Dns.GetHostEntry(Dns.GetHostName()).AddressList to print the IP of the device in the headset, this returned 192.168.1.145

image.thumb.png.1688be71b06403fa58171bb15f131c11.png

These are the settings for Direct Preview in the editor

image.thumb.png.8de054f6283a2fe59c3fa73d68fb17fc.png

And this is the output when starting the server, it does not change when I launch the device APK

Any help would be greatly appreciated!

Just quick check, the IP is 192.168.1.145 ? the screenshot is showing 129.168.1.145. 

And another thing you can check is the XR Plug-in management section, be sure the desktop WaveXR is also selected. 

Thanks

image.png.52e8f93a2b4843707512b94b2cfdf37c.png

Link to comment
Share on other sites

I have fixed the IP address

image.thumb.png.25929ee14fd09ad21e4f4005a84a1f01.png

I also tried using the 192.168.1.255 IP that is also showing with "adb shell ip -f  inet addr show"

image.png.2599a293b87d225ed5f8fb99ea94da9e.png

WaveXR was not checked for windows so I went ahead and did that, and then saved and restarted unity for good measure.

image.png.21292546fd0d5fc8c00a1b2aeabb20d9.png

it is also checked for Android.

I stopped and started the device APK a few times to see if maybe it would connect randomly with no luck.
Stopping the APK and the server and restarting the server then the APK a few times also did not let me connect.
And I have also stopped the server and APK reinstalled the APK then started the server and the APK again several times.
 

image.png.eec51e763042411e3c2e649492b08738.png

I get this warning but I assume the folder then just gets made on the device?

image.png.f0299fc05b7689188e6a8369a3cab2de.pngimage.png.1f6ecb00377a6903e4a701e8524c2c28.png

I am also getting the log messages which is why I assume the folder gets made somewhere else.

Link to comment
Share on other sites

I hear you and this sort of feedback can help us immensely.

  1. There is a distinct active issue with 2020. I'm hoping that we can get a fix in the future, but the last beta didn't fix it as intended. I'll check on the status today.
  2. I have seen issues with directpreview that i have yet to overcome, but I am led to believe are being worked on. 
    • having a game preview window that doesn't have an even height/width divisible by two can cause no rendering
    • having a game preview window too large and/or too different from the aspect ratio of the target device may cause issues
    • Not having adb in your path will cause it to fail silently with only warnings in the console
    • not having your device connected over usb when running the "install apk" will cause the apk not to be installed
    • not running "install apk" after changing the configuration (with an active usb connection) will not change your device's configuration, as it pushes a configuration file at that step
    • Errors are not obvious to the developer, windows popping up and immediately closing with no visible output is a likely error
  3. The wave xr plugin installed on pc as well was a requirement that you got
  4. It seems that it is not connecting to the device, can you try a)pinging the device from your pc to make sure it's reachable and b) disabling your firewall
  5. The android manifest must also be configured to include entries like https://github.com/hardcoded2/VBS-Example/blob/master/Assets/Wave/XR/Platform/Android/AndroidManifest.xml
  6.  I've had more success* with VBS streaming in general, so I've started putting together a "known good" example here https://github.com/hardcoded2/VBS-Example, and hope to do a tutorial soon. I'm going to go over this again soon, but if you have issues with that buttons not being recognized try installing vive console  https://store.steampowered.com/app/1635730/VIVE_Console_for_SteamVR/ 
    • *--(More a personal note here....) Well more success, until I started manually mucking around with my windows registry to work around an unrelated issue from testing some alpha-level features. XRNodes rotation/position get updated but the buttons and axes are not being read regardless of input system
Link to comment
Share on other sites

Hello thank you for the reply! @Alex_HTC

I have tried all of your recommendations without any success.

Checked that ADB was in the path, pinged the device, I have made sure to reinstall the device APK every time I changed any settings, the device is plugged in while installing or else the command prompt will just say waiting for device.
There do not seem to be any windows instantly closing other then when I start and stop the APK, but there doesn't seem to be any error as the headset is launching the app.

I have set up VBS on my computer now. Is the idea to use steam VR in unity to get the player to show up in the headset? would that require me to add any steam VR components into my scenes?

Thank you again!

Link to comment
Share on other sites

We really do appreciate the feedback and interactions with devs!

You shouldn't need anything other than enabling the "OpenXR" plugin in your xr settings after importing the plugin.

The external depedencies are vive console and vive business streaming app.

As a quick point of reference on direct preview, one quick test is to connect the device over usb and run "adb shell cat /sdcard/DirectPreview/config.json" to print out information about the config file on your device. i do think you'd hit the 2020 issue before you'd run into this, but this may provide more information to send to our team

Link to comment
Share on other sites

This is the output when I run that command

image.png.4c4a66883d9778a7a40f021b4d292206.png

I managed to get the player to render in the headset using OpenXR plugin and VBS!
But I am lacking input so I hope to sort that out today.

Let me know if there is any other information I can give you to help with the direct preview problem.

Link to comment
Share on other sites

Hi Alex!

We are suffering a similar set of issues to what you've described with DirectPreview and Unity 2020 in general. I'll detail our discoveries below.

tl;dr: - We can't get any images to display in the headset, though data streams via DirectPreview to the editor. The headset just says "Connecting..." even as the editor is rendering images, it doesn't display them.
- Some of the control inputs are not sent to the editor, in particular thumbstick axis data, grip or trigger data (both button and axis), and the Y button for some reason.
- None of the control data seems to be picked up by the Action-Based Input System (may be unrelated).

We are using the following tools:
- Unity 2020.3.13f1
- WaveSDK 4.1.1 (Latest)
- Vive Focus 3 device

Issues from connection onward:
To get any connection between the headset and the editor via Direct Preview, this is the instruction set we have come up with, but it isn't perfect
1. Connect headset via USB (USB-C to USB-C cable is the only thing I've had success with, USB-C to USB-A doesn't seem to work)
2. Run the command (in cmd.exe or powershell) `adb tcp 5555` to start adb in network mode (You will need to add a version of ADB to the system PATH. Also note that Sidequest uses a different version of ADB to Unity, that may come up in the notes below)
3. Run the command `adb shell ip addr show wlan0` to find the headset's ip address (can skip this if you know it)
4. Run the command `adb connect <headset ip>` to connect adb to the headset via wireless.
5. Disconnect the USB Cable.
6. Set up the Direct Preview config panel in Unity for WiFi with the Headset IP in the IP Address bar, and have the settings set to "Others" instead of "Focus+" 
7. Install the Device APK via Unity Editor dropdown menu.
8. Run the DirectPreview streaming server via Unity dropdown menu. Note the IP that it's listening on, and make sure it's your device's LAN IP and not an adaptor.
9. Run the Device APK from the Unity Editor (using the library apk option just shows a black screen forever).
10. Run the scene, and hope that Unity doesn't crash entirely (it will like 1/3 of the time).

At this point, the Unity Editor is showing that we are receiving pose data from the headset, and if you have a Device-Based XR Rig, or the Wave Rig set up in your scene, you should be able to see the camera move with the headset.
No images will be show in the headset, it'll just show "Connecting..." as it does when waiting for input data.

I've tested this setup using the HTC Samples app in some Unity 2019.4 versions, and the only difference in this setup was that the images were shown in the headset.
That is with the exception of Unity 2019.4.31f1, where the first frame was shown and then no other images were displayed. Data was still being sent to the editor though.

Notes to this point:
- Installing the device apk from the unity portal will work (from memory) while the usb cable is attached, but running the apk will not.
- The SideQuest apk version is different to the one Unity uses (as of October 2021). What this means is that connecting via wifi using sidequest will not let you install or run the apk via unity editor. You have to use the command line, essentially.


Knowing this, it might be okay to try and build without being able to use the headset as the display (annoying, but possible).
However, some of the controller inputs are not sent to the editor over DirectPreview (no log is in the DP server, or Unity Editor, and the little controllers that the interaction manager spawns don't animate these inputs as they do in the built application).
These controls are:
- Trigger Press and Trigger Axis
- Grip Press and Grip Axis
- The Y Button on the left controller.

Futhermore, the Action-Based Input System doesn't seem to work properly at all with them.
You can listen for the data coming in via DirectPreview, and it will detect all but the above data.
However, binding these to an action doesn't seem to do anything. When you listen for that action and say, log something to the console when a button is pressed, nothing happens.
I'm fairly sure I have the scene Event System and such set up correctly.
Also setting up a Unity Action-Based XR Rig doesn't work in the build (there is a case where it does work in the editor if you use a script pasted in this post: Focus 3 development with Wave and Unity's XR Interaction Toolkit - Vive Wave SDK - Community Forum), but once it is built for android, it doesn't work. The controllers never work in either build or DirectPreview.

I'm attempting to set up a test scene using Business Streaming to see what else I can learn, and will post here if anything interesting happens.

Hope this information is useful!
Thanks

 

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...