Giter VIP home page Giter VIP logo

simple-openvr-driver-tutorial's Introduction

Simple OpenVR Driver Tutorial

I created this driver as a demonstration for how to write some of the most common things a SteamVR/OpenVR driver would want to do. You will need to understand C++11 and some C++17 features at least to make the most use of this repo. It features:

Building

  • Clone the project and submodules
    • git clone --recursive https://github.com/terminal29/Simple-OpenVR-Driver-Tutorial.git
  • Build project with CMake
    • cd Simple-OpenVR-Driver-Tutorial && cmake .
  • Open project with Visual Studio and hit build
    • Driver folder structure and files will be copied to the output folder as example.

Installation

There are two ways to "install" your plugin:

  • Find your SteamVR driver directory, which should be at: C:\Program Files (x86)\Steam\steamapps\common\SteamVR\drivers and copy the example directory from the project's build directory into the SteamVR drivers directory. Your folder structure should look something like this:

Drivers folder structure or

  • Navigate to C:\Users\<Username>\AppData\Local\openvr and find the openvrpaths.vrpath file. Open this file with your text editor of choice, and under "external_drivers", add another entry with the location of the example folder. For example mine looks like this after adding the entry:
{
	"config" : 
	[
		"C:\\Program Files (x86)\\Steam\\config",
		"c:\\program files (x86)\\steam\\config"
	],
	"external_drivers" : 
	[
		"C:\\Users\\<Username>\\Documents\\Programming\\c++\\Simple-OpenVR-Driver-Tutorial\\build\\Debug\\example"
	],
	"jsonid" : "vrpathreg",
	"log" : 
	[
		"C:\\Program Files (x86)\\Steam\\logs",
		"c:\\program files (x86)\\steam\\logs"
	],
	"runtime" : 
	[
		"C:\\Program Files (x86)\\Steam\\steamapps\\common\\SteamVR"
	],
	"version" : 1
}

Debugging

Debugging SteamVR is not as simple as it seems because of the startup procedure it uses. The SteamVR ecosystem consists of a couple programs:

  • vrserver: the driver host
  • vrcompositor: the render engine
  • vrmonitor: the popup that displays status information
  • vrdashboard: the VR menu/overlay
  • vrstartup: a program to start everything up

To debug effectively in Visual Studio, you can use an extension called Microsoft Child Process Debugging Power Tool and enable debugging child processes, disable debugging for all other child processes, and add vrserver.exe as a child process to debug as below:

Child process debugging settings

Set the program the project should run in debug mode to vrstartup (Usually located C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrstartup.exe). Now we can start up SteamVR without needing to go through Steam, and can properly startup all the other programs vrserver needs.

Issues

I don't have an issue template, but if you find what you think is a bug, and can describe how to reproduce it, please leave an issue and/or pull request with the details.

License

MIT License

Copyright (c) 2020 Jacob Hilton (Terminal29)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

simple-openvr-driver-tutorial's People

Contributors

terminal29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple-openvr-driver-tutorial's Issues

Please help: Everything breaks on this->AddDevice

Hello!
I was trying to use CMAKE version, built with visual studio,
(second time i just used cmake)
and everything was fine until i ran steamvr.
it just crashes.
But...
When i comment out lines with this->addevice etc. in init functon,
driver runs just fine (cause it have nothing to do)
But when i uncomment just single operation, it's just unrealiable to launch svr with it.
i have tried using those headers and adding them to normal vcxproj dll project,
but same actions there.
(I am trying to add base stations, so i don't really need any input files,
but it is not connected with issue with orginal buil;d with cmakelists)
so then..
please share something, that could be helpful.
i have even tried manual initialization of class, but still nothing to do with it.
Thanks for possible help!

How to use physical HMD instead of null/virtual one

Is there a way to modify the existing code so this driver will function with my Oculus Rift as the "Active HMD" instead of creating a null/dummy one?

I'm trying to develop a driver that modifies my HMD's projection matrix.

Setting debug mode to "vrstartup"?

Hi, in the readme it states:

"Set the program the project should run in debug mode to vrstartup (Usually located C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin\win64\vrstartup.exe). Now we can start up SteamVR without needing to go through Steam, and can properly startup all the other programs vrserver needs."

I am confused, what does "the program" imply here? And what does "project" imply?
Should I configure this somewhere in Visual Studio? Sorry if it's stupid question, I never used Visual Studio before.

bindings problem

I didn't change any code. It shows in console.
No legacy bindings found for app steam.overlay.250820, controller type example_tracker. Trying generic.

SteamVR Device Error (209) due to incompatibility

Hello,

I try to create my own driver for my HMD and when I follow exactly the tutorial, an error occure, and says that the driver I use is not compatible with the actual version of SteamVR (1.5.16).
Have you any idea which part of the code are obsolete ?
vrmonitor logs:
image

vrserver logs:
image

Fake controller issue

Hi,

I got two errors when building the latest code:

'sin': is not a member of 'std'
'cos': is not a member of 'std'

I solved it by adding #include <cmath> to FakeController.cpp and FakeTracker.cpp.

I thought this might be a bug as I am using the latest SDK, but I did not want to make a new branch for two lines.

Any chance of Getting Dummy lighhouse?

Even if its object that will be once created and will just sit there and report to steamvr thats some basestation is connected and be visible with model in game please.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.