bjornblissing / osgoculusviewer

An OsgViewer with support for the Oculus Rift
Other
106 stars 67 forks source link

An OpenVR version of this viewer. #81

Closed ChrisDenham closed 8 years ago

ChrisDenham commented 8 years ago

Just thought some might be interested in work I've been doing adapting this viewer to integrate via OpenVR API intead of Oculus SDK

https://github.com/ChrisDenham/osgopenvrviewer

My objective is to try and generalize the viewer to support any VR devices that have OpenVR compatibility. Though admittedly, so far, I've only tested it with Oculus DK2 headset, but fingers crossed...

bjornblissing commented 8 years ago

@ChrisDenham Great!

This is something I have considered doing myself, but not had the time to try. (I have also wanted to try the OSVR HMD).

JeffBail commented 8 years ago

I looked into OpenVR at the Boston VR hackathon a couple weeks ago but I've found that even the "empty grid entry room" of SteamVR runs terribly and the "field of cubes" example I built was even worse. One of the other hackers said it was because I was on Windows 7 which he said really doesn't work well with OpenVR. Which version of Windows have you been developing on?

I tried OSVR at the same hackathon and from what I can tell the DK2 integration is lagging behind. It looks to me like perhaps it has not yet been updated to OVR 0.8 (and I don't really want to downgrade my machine). I don't have the OSVR HMD.

The good news is that I'll have access to the new HTC Vive Pre at the Boston VR Devs hackathon this weekend! I'll try and get a build of your branch together so we can test it on the latest and greatest from HTC! Hopefully I can borrow a Windows 10 system from a fellow hacker for the testing.

ChrisDenham commented 8 years ago

I'm developing on Windows 8.1. It seemed smooth to me for release build. I'm fairly sure that the latest steamvr depends on OVR 0.8 for oculus support (well, at least it stopped working when I removed "C:\Windows\SysWOW64\LibOVRRT32_0_8.dll")

Have you got the latest steamvr installed? How did the "hellovr_opengl" example perform for you?

BTW. I found that some mismatches between openvr and steamvr versions caused crashes for me.

Also, maybe worth mentioning, I've been developing with OSG 3.2.1 and I've not got round to updating and testing on later OSG versions yet.

Also also, I'm using Visual Studio 2013.

ChrisDenham commented 8 years ago

@JeffBail by the way, I'll be keen to know how you get on with the HTC Vive, so please let me know if there's anything I can help with to complete the test. It'll be great to escape being tied to only one HMD manufacturer.

JeffBail commented 8 years ago

I'm on OVR 0.8. Our last Boston VR Devs hack was on December 12th and I was up to date on Steam and OpenVR as of then. I did try "hellovr_opengl" but it performed just as poorly as the "empty grid" initial SteamVR scene. I tried reducing the example down to just a couple of cubes and it didn't help. I updated SteamVR just now and the entry scene is still really slow. I thought it might have something to do with DWM but I tried with and without Aero enabled and there was no difference. Hopefully I can get someone with a Windows 8 or Windows 10 machine to help me do some testing.

If you're available for questions during our hack on Sunday please follow me on twitter @BailVR and let me know what your handle is so I can send you a DM or two.

ChrisDenham commented 8 years ago

Sorry Jeff, I'm a bit of a social media luddite (i.e. no twitter or facebook). If you post questions on the issue tracker on https://github.com/ChrisDenham/osgopenvrviewer, I'll do my best to answer.

BTW. One oddity I noticed with the hellovr_opengl example was that it was doing the distortion correction twice, once for the mirror texture and again within the compositor for the HMD. So it might be worth commenting out the call to RenderDistortion and see if that affects performance on your machine.

JeffBail commented 8 years ago

One thing that might help is a room model. Just something simple that will allow me to test room-scale navigation. Some simple furniture and windows would help to make sure that the scale, field of view, etc are configured properly. Can either of you suggest something simple, free & compatible with OSG?

ChrisDenham commented 8 years ago

I'll see if I can grab the export of the kitchen design I've been experimenting with and upload it somewhere for you. (Later today)

ChrisDenham commented 8 years ago

Not sure how well this design I exported from our full application to 3DS will work for you as it seems to have excluded the light, but it may give you an idea of scale, fov etc. Note that I think the world units are in millimetres, so you probably need to set worldUnitsPerMetre to 1000 Anyway, here's a download for a zip file containing the 3DS file and referenced textures: https://drive.google.com/file/d/0B-yr4il3qqZVWVotWW1zRnZIam8/view?usp=sharing

JeffBail commented 8 years ago

It might just be because I'm not at TOT OSG yet but do you have any ideas on this error: 1>viewerexample.cpp(30): error C2440: 'initializing' : cannot convert from 'osgGA::Event ' to 'osgGA::GUIEventAdapter '

JeffBail commented 8 years ago

I threw in a dynamic_cast and got it to compile, I'll see if it actually runs.

ChrisDenham commented 8 years ago

Oh. That's odd. I'll check tomorrow, but yeah, the dynamic cast looks like it would be necessary, but pretty sure it compiled for me. Though admittedy I only got around to testing it with OSG 3.2.1

By the way, we should probably use the osgopenvrviewer issue tracker for problems with that. I don't want to hijack this project with irrelevant issues.

JeffBail commented 8 years ago

I have a cow on the Vive!! Pretty happy to get this hello world working but the head tracking is definitely broken; it's almost like some of the axes are reversed or transposed or something. Only a few hours left here at the hack but I'll work on it. I'll push my diffs at the end of the day.

JeffBail commented 8 years ago

I fixed orientation tracking by commenting out the cameraManipulator->setHomePosition. Not much time left here but moving on to positional tracking!

JeffBail commented 8 years ago

I got positional working by changing the preMult in OpenVRUpdateSlaveCallback::updateSlave to just a regular setTrans. I'm fighting off the sim sickness and moving on to hand tracking! First I'll check the Vive Pre and make sure it works there too (been testing on the VDK1's because there's more availability).

ChrisDenham commented 8 years ago

I wonder if the changes you needed to make will break it for the oculus? I hoped that openvr would make an HMD neutral interface.

JeffBail commented 8 years ago

The Vive Pre also works! I retested the DK2 and it seems fine. I submitted a pull request, give it a test and let me know if it's still working for you. Unfortunately I didn't get too far with hand tracking; I could only test by copying onto a USB drive and waiting in line to get on a Vive. Maybe next time.

bjornblissing commented 8 years ago

@ChrisDenham @JeffBail This discussion should probably be moved to an issue at the osgopenvrviewer repository instead.