SPVR

SmartPhoneVR

View project on GitHub

What is SPVR?

SmartPhoneVR is a project to allow you to use your Android smartphone / mobile phone as a cheap HMD. You can already find Google Cardboard games, which run directly on your device. SPVR is used to play games on your computer, which use the OpenVR / SteamVR API. That is, almost all games or applications, that can be used with the HTC Vive and offer a seated experience.

Warning!

I did this for fun! I plan to continue working on it, but it will never provide a "true VR experience". Do not expect anything... I want to make sure, that you don't expect anything close to an real HMD! Simulation sickness is real, e.g., rotating your head will make you dizzy. The image quality is low (i.e., artifacts and low resolution), like when you forgot your glasses. On the other side, the 3D experience works, which is kinda cool.

Show me an example

How does it work?

The Android app reads out your phone's sensor data and forwards them over network (currently udp) to the Control instance on your PC, which further directs it to the driver instance in the game / application.

How can I run SPVR?

For the windows part, you can either use the provided binary or build it yourself. You need to copy the dll to PathTo/steamapps/common/SteamVR/drivers/spvr/bin/win32/driver_spvr.dll.

For android you can download the provided apk or build it yourself.

At first spvr.control and the android app should be started and connected by entering the computer's IP in the app. If spvr.control is not started, SteamVR / vrcompositor will not detect any HMD! If you start SteamVR / vrcompositor before spvr.control it will not work! Then the vrcompositor has to be started in debug mode: vrcompositor.exe -keepalive -debug. This will not work if you do not have a graphics card with DirectX 11 support! In this case you cannot use SPVR! Now you can start TrinusVR or Moondlight for streaming, after which the game can be started.

Building spvr

This project consists of a C++ part (control and driver) and a Java part.

spvr control and driver

If you prefer building it yourself you need:
  • CMake
  • Visual Studio, tested with 2013 and 2015
  • Boost, tested with 1.60
  • glm
You can checkout the complete spvr repo by using
git clone https://github.com/burrito82/spvr.git --recursive,
which contains the source code to spvr.control and spvr.android.

Copy the glm header directory into spvr/control_repo/driver/.

Then you need to generate project files for Visual Studio by using CMake, see Figure 1.

cmake configuration
example
Figure 1: example cmake configuration

After compiling spvr.driver and spvr.control, the resulting driver_spvr.dll needs to be copied into PathTo/steamapps/common/SteamVR/drivers/spvr/bin/win32/driver_spvr.dll, or .../win64/..., respectively. You can also activate the COPY_AFTER_BUILD flag in the drivers CMake config, which will automatically copy the dll to the given location. You just need to set the correct COPY_AFTER_BUILD_BUILD_TYPE to Debug, Release, or RelWithDebInfo, whatever you plan to build.

spvr android

Checkout spvr.android, if you haven't cloned the spvr repo, by using
git clone https://github.com/burrito82/spvr.android.git
It should be easy to build and run the app.

To run spvr

  • Steam + SteamVR
  • TrinusVR - the demo is sufficient to test if you can handle it, but is restricted to 15 minutes of continuous experience
  • Moonlight - an alternative to TrinusVR, if you have a newer NVidia graphics card. The main drawback to TrinusVR is, that there is currently not distortion computation, e.g., it doesn't look like correct 3D or just feel weird.

You can now start the spvr.control (allow network access) and run the SteamVR compositor with PathTo/steamapps/common/SteamVR/bin/win32/vrcompositor.exe -keepalive -debug, for example by creating a link to it and changing it, see Figure 2.

modified vrcompositor
link
Figure 2: modified link to vrcompositor.exe

After building and running the android app, you can set the IP to the address of your computer. spvr.control should now print the received sensor data. The compositor's rendering should move with your mobile phone.

After you established a connection with spvr and the compositor seems to work fine, you can start TrinusVR to transfer the rendered image back to your phone.

Development and Contribution

Contribution would be great! The current state is not great, there is actually some undefined behavior, e.g., multiple writers on shared memory. The android part is not implemented as a service, but instead sends sensor data from the main thread, which android, by default, usually probihits. Much stuff is hard-coded. On the other side, it works and development is fun!

Issues are deactivated on the submodules-only repo, please post them to the according subproject on gitlab (preferred), i.e., android, control, and driver, or, alternatively, on github: android, control, and driver.

Source Code

Frequently Asked Questions

How can I run Half Life 2?

You first need the beta of Half Life 2 (Properties -> Beta -> "beta - Beta updates"). You can then start SteamVR, which will open a new compositor instance, which you need to shut down. Then you start the compositor again in debug mode (see above). Now you can start the game, in which you activate the VR mode.

It is so slow...

You can use USB tethering to create a direct network connection over USB. Don't forget to set the new IP address.

...?

...