BastiaanOlij / TestOpenVR

Testing OpenVR extensions to Godot
MIT License
3 stars 2 forks source link

I'd like to help out! #1

Open ssj71 opened 7 years ago

ssj71 commented 7 years ago

Hi Bastiaan:

Sorry I couldn't find any other way to contact you. My company is looking at making a game accessory and would like to develop a launch title that works on the htc vive and also on android/iOS mobile VR headsets. I'd really like to develop the game using Godot since I'm a big advocate of open source software.

I am hoping there are some tasks that I can assist in and we can get this working. I unfortunately have little experience in any game engines, only a prototyped game on the vive using the worldviz vizard 5 game engine, which is not portable to mobile (nor open source). Though I do have extensive c programming experience (embedded) and a fair bit of c++ too. I thought the easiest path would be to get a godot game working with the vive then try to move it over to the mobile targets. I have a vive for development. If you can just give me some direction while I'm doing my research into openVR what godot needs I hope it will be beneficial for everyone. I'm usually on IRC from around 4-12UTC. In the meantime I'll be looking through your code in this repo and your OpenVR branch of the godot codebase.

Thanks, _Spencer

ssj71 commented 7 years ago

ha, I just saw the roadmap in the readme, would you mind if I added each one as a separate issue here and we can maybe discuss them a bit? Or would they belong better in the upstream project tracker?

BastiaanOlij commented 7 years ago

Hey Spencer,

I'm doing my openvr project for fun, I'd really like to make the jump to PSVR one day. The Godot team themselves have VR on their longer term plans, whether they will adopt what I've done so far or build their own version, time will tell. I originally started the project with the idea to embed some measure of cross platform support but gave up on that fairly quickly due to the differences in platforms. I figured it would be far easier to embed the specifics for each platform inside a scene and just load up the correct one depending on what you deploy your game on. It also means not having to deal with design choices for which you first need to gain some experience. You'll see that in my prototype project that is how it is set up, the main scene has what you see, and then there is an openvr scene that contains all the HMD and controllor logic. That could be swapped out with a scene for say mobile.

Last night was a pretty large milestone for me as the correct rendering of the two eyes was the bit that really stopped us from going forward.

OpenVR as a platform allows you to deploy to Windows and potentially Linux and Mac OS X in the near future and target Vive/Oculus and OSVR headsets.

Mobile is a different beast and in many ways simpler (and in some ways harder). Just before the Godot 3 branch got merged in we had added all the basic changes to make a cardboard type iOS VR solution and we were one change short of having the same on Android (I don't have a capable android phone).

The changes to the device orientation info (accelerometer, gyro and magnetometer) have now been updated to Godot 3 and accepted into the master branch but there are still issues preventing building an actual iOS build on Godot 3 and I suspect that will stay like that for a little while longer as the desktop versions have priority.

There is also another PR of mine that the openvr project also uses (check out the stereo_camera branch) that adds the needed changes to Godot to render the eyes correctly, both for openvr and mobile (and any other stereo scopic solution). This has not yet been updated to Godot 3 but I plan to do so soon.

With those two changes combined and the ability to deploy Godot 3 to iOS we're a lot closer to building a VR mobile game. For Android there is one more change needed (implementing the TYPE_GYROSCOPE events for device orientation) and the same would apply.

So yeah, the biggest hurdle at this moment is actually Godot 3 not compiling for iOS and Android just yet:)

On 3 February 2017 at 11:44, ssj71 notifications@github.com wrote:

ha, I just saw the roadmap in the readme, would you mind if I added each one as a separate issue here and we can maybe discuss them a bit? Or would they belong better in the upstream project tracker?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BastiaanOlij/TestOpenVR/issues/1#issuecomment-277132118, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2vaXKjkm-JvBSjp1aiJmoATtwteCTDks5rYnhygaJpZM4L10db .

-- Kindest regards,

Bastiaan Olij

ssj71 commented 7 years ago

So yeah, the biggest hurdle at this moment is actually Godot 3 not compiling for iOS and Android just yet:)

that is a rather large hurdle right now. That and Godot 3 won't have a stable api for some months still. Its so close to being ready (I could deal with an alpha) but I doubt I'll convince anyone in management to wait a few months for Godot 3 to be even to alpha. :( They want an android or iOS VR game prototyped in the next month. I'll talk to them and see what I can work out. Probably the answer will be to just use unity. Worst comes to worst I'll do our prototype in unity and see if I can port to godot3 before release.

It sounds like the VR part is actually already fairly workable, very nice work. Its too bad the timing of the major changes, but I understand that sort of stuff needs to be done. If I am able to get an android phone that I can test with (which I should), I'll see if I can add the gyroscope sensor.

Would it be a waste of time or take extremely long to backport the changes for VR to godot 2.1 and perhaps try to create the game that way? If that's feasible I might be able to use godot after all.

Thank you so much for your feedback!

BastiaanOlij commented 7 years ago

Hey @ssj71,

It's actually the accelerometer/gyro/magnetometer changes for iOS that are the only things that ended up in Godot 3 and not in Godot 2 so if you want to focus on Android adding gravity vector support would be the thing you need to do. Android already does accelerometer, gyro, magnetometer but didn't extract the gravity vector which is what you really need for VR (you can do it yourself with alot of math but why do it if the OS already supplies it for you).

With those vectors you can determine orientation of the device so that the movement of the device steers the camera. Actually for VR both android and iOS have support for giving you a final transform for this and it may be interesting to add that to both platforms as well. I've got some code however that converts the 9DOF sensor data into orientation though its a bit simplistic, it does work.

The other thing you need is the stereo_camera project. My openVR project uses this as well. Both of those are still based on an older Godot 2.2 version but in theory you can build a patch to apply to the latest Godot 2.1 branch and it should work just fine.

BastiaanOlij commented 7 years ago

Btw, you can find some more about the changes needed to Android here: https://github.com/godotengine/godot/issues/7503

ssj71 commented 7 years ago

I'm finally working on this a little more. Where do I copy the openVR lib and bin directories to? I assume somewhere in the godot source tree and then build godot (openvr branch of course)?

EDIT: NVM. Figured it out. Added it to the readme in case somebody else would ask the same (see PR).

BastiaanOlij commented 7 years ago

Cool thanks! That readme was written in a hurry :)

This thursday I finally got all the controller logic working properly so this is enough now to create a steamvr game that works with the vive.

I'm also playing around with Trinus VR and VRidge, both offer SteamVR support and turn your cardboard/gearvr headset into an HMD for your PC. Not as good as hooking up a vive or rift but still. Trinus even has a PSVR version that allows you to hook up your PSVR to your PC though it hasn't worked on my laptop yet.

Obviously non of that will help you for a pure mobile VR app. I really need to get back into compiling the latest Godot 3 for iOS and see if all the work I did a few weeks ago paid off. I still have to write a lens distortion shader but shouldn't be too much more work to get it all running.