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.
This project consists of a C++ part (control and driver) and a Java part. Building spvr
spvr control and driver
If you prefer building it yourself you need: You can checkout the complete spvr repo by usinggit 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.
Figure 1: example cmake configuration
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.
Figure 2: modified link to vrcompositor.exe
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
- Complete source code (check out recursively)
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.