Jump to content

[Tutorial] Focus3 OpenXR: Getting Started in Unity


Alex_HTC

Recommended Posts

1) Install a 2020 or later LTS version of unity
2) Get the openxr package by adding the Vive Scoped registry to your project 

a) Open the Package manager, by selecting "Window->Package Manager"

b) Select the gear icon, here circled in red
gear_icon_to_open_advanced_project_settings_inked.thumb.jpg.44927928936d772230d12745b1f55598.jpg
c) Fill in a new entry for VIVE in the "Package Manager Settings" and hit save
Name: Vive
URL: https://npm-registry.vive.com/
Scope(s): com.htc.upm
add_vive_to_scoped_registry.thumb.png.ca4f9f3ce133bedbbbf23df9c43ebd14.png

d) Switch back to the package manger tab and select the new entry "My Registries"
package_manager_my_registries.thumb.png.023c716ea0f7b1c6e9bbadb5e17a9e2c.png

e) Install the "Vive Open XR Plugin" by selecting "Vive Wave XR Plugin - OpenXR" entry, and selecting the "Install" button in the lower right of the panel
image.thumb.png.c2ec92ff8b04748470fafc87dd5c4753.png

2) Enable openxr plugin 
a) Enable both the old and new input systems in project settings (if not previously set to this), which will require unity to restart
image.thumb.png.bc739d1c2646a3da9601e57b6e273d47.png

b)Enable openxr support in "Project Settings->XR Plug-in Management"
image.png.b98b582d6be8e3dd7a9e0086e21ebfab.png
c) Enable Vive focus3 support in the openxr feature groups category
re_check_vivefocus3support.png.c98bc65bc802caf75587402053cf3562.png
c) Click the red x next to focus3 support and select "Fix all" or "fix" to each relevant item in the "OpenXR Project validation" window that pops up
image.thumb.png.b08f916dd574b649d11e4a015c0a6d5e.png
After - ensure that the "Vive focus 3 profile" is added:
image.thumb.png.572295ffdd30b52e44fd258a9f90efdf.png


3) Enjoy XR development using openxr 

a) A sample project using openxr is available on the "openxr" branch at this link: https://github.com/hardcoded2/HelloVR/tree/openxr
builds (zip files with apks inside) with the project built in
    * 2020 https://github.com/hardcoded2/HelloVR/suites/6113995207/artifacts/212516274 
    * 2021 https://github.com/hardcoded2/HelloVR/suites/6113995207/artifacts/212516275
    * 2022 https://github.com/hardcoded2/HelloVR/suites/6113995207/artifacts/212516276
b) A more advanced example showing how to use openxr with XR Interaction Toolkit 2.0+: https://github.com/hardcoded2/XR-Interaction-Toolkit-Examples/tree/wave_openxr_xr_origin/VR

Edited by MarcusN
Removing step 0 for beta information.
  • Like 2
Link to comment
Share on other sites

First of all, nice tutorial!

I was able to build for the Focus3, but i had the issue that the tracking of the left controller position and rotation seemed fine, but the tracking of the right controller had an strange offset and didn't work correctly (I used the OpenXR (1.3.1) and the Default Input Actions of the XR Interaction Toolkit(2.0.0)). The button inputs also seem to work correctly.

When i test my application in the unity Editor, the interaction profile of the oculus controllers are used and everything works fine.

Does the VIVE Focus3 Interaction Profile use a different tracking or am i missing something here?

Link to comment
Share on other sites

@martini Love the user name!

In general, side by side testing may be a little interesting inside the editor.
The reason: HTC uses the standard, open source openxr loader from https://github.com/KhronosGroup/OpenXR-SDK-Source. Not all vendors currently use the standard loader. The non-standard loaded into unity can cause some issues that require restarting unity to ensure that the other loader isn't resident in memory. (Unloading native libraries in unity editor was a WONTFIX since unity 2.x)
Perhaps try removing other vendors' packages and restarting unity for a baseline. Eliminating the other loader as a source of issues provides additional clarity.
To word it another way, the most consistent explanation would be that a mismatched/non-standard loader leads to misidentification of the (focus3?) controller.

The offset pose (position+rotation) of the controllers isn't an issue I've seen in this rom,
For background:
-Which version of the ROM? This can be found in Settings->General->about->System Version - for reference mine is currently 3.3.999.400
-What version of unity was being used
-What other packages/platforms were used
-Did this happen on device as well? Or only in editor? If only in editor, how were the controller positions fed into unity?

While based on the description it seems like a vendor dll conflict, but that requires some reading between the lines, which may not be correct.
If it is a new issue, any way to more precisely qualify and reproduce it help us get you positive outcomes more quickly.

Either way, always love hearing from our devs 🙂

Link to comment
Share on other sites

4 hours ago, korejan said:

@Alex_HTC Is the focus 3's oxr runtime compatible with the cross-vendor android oxr loader or are you guys providing vendor specific loaders? What's the situation on Vulkan context support?

 

@korejanWe use the cross-platform, open source loader. Oculus last I checked does not, which may lead to some unexpected behavior.

Vulkan support would be something we haven't made any announcements about that I am aware of. 

Link to comment
Share on other sites

1 hour ago, Alex_HTC said:

@korejanWe use the cross-platform, open source loader. Oculus last I checked does not, which may lead to some unexpected behavior.
 

Okay now things make sense, I was wondering why there are only downloads specifically for Unity/Unreal. That's good to hear.

Oculus has a vendor specific loader for their mobile sdk but not for desktop based oxr runtime. Android based headsets with dedicated OXR runtimes typically have or had vendor specific loaders as they existed before the cross-vendor android loader was standardized and released towards end of last year. That's been a bit of problem as it forces developers to make multiple binaries/APKs for different android based headsets.

Edited by korejan
Link to comment
Share on other sites

Does the vive openxr package work with Unity 2021.3 LTS? 
I have tried to open the "HelloVR-openxr" sample project in 2021.3.0f1 and the OpenXR Feature Groups + Interaction Profiles have no mention of the Focus 3.
image.thumb.png.cc53c84ce3952981c3f3482fa8fa6d55.png

  • Like 1
Link to comment
Share on other sites

@Alex_HTC Thanks for the quick reply!

I currently use the ROM Version: 3.3.999.418
Unity Version: 2021.2.14f1
The following packages are installed:

image.thumb.png.6d8c70e5c6576b9386fe5535876d6d06.png

The issue only happened on the device, not in the editor.

I also made a standalone build of the XR Interaction Toolkit Example on the Focus3 device and had the same tracking issue (Unity Version 2021.2.14f1, ROM Version: 3.3.999.418, Installed Packages:

image.png.4a803eb0b3e8a29433fb6247d421f224.png


In the editor the tracking also worked fine in this example.


I will test out removing different unneeded packages and see if the issue can be fixed.

Link to comment
Share on other sites

Hello Dear Dev-Team,

I experience the same issue. When I follow the steps above, also in the XR-Interaction Sample (https://github.com/hardcoded2/XR-Interaction-Toolkit-Examples/tree/wave_openxr_xr_origin) the tracking of the controller is super weird. I seems like position, rotation disorted.

I figured out, that when Iam using the "Tracked Pose Driver" Component from the old Input System the Tracking and Rotation works fine! I disabled the references in the "XR Controller" Component the Position Action and Rotation Action.

Any Ideas for the weird tracking behaviour?

Iam using:

- XR Interaction Toolkit 2.0.1

- XR Plugin Management 4.2.1
-> OpenXR, Vive Focus3 Support feature group

- OpenXR Plugin 1.3.1
-> Vive Focus3 Profile, Support, etc

- Vive Wave XR Plugin - OpenXR 0.8.0-preview.1

- Unity 2020.3.30f
-> Both Inputsystems are currently activated

 

Best whishes,

Jannik
 

Link to comment
Share on other sites

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
×
×
  • Create New...