Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: mid_gen on April 30, 2015, 04:23:15 am

Title: Oculus Rift support
Post by: mid_gen on April 30, 2015, 04:23:15 am
Hey all, new to the forum!

So I'm a pro game coder, with a DK2 sitting on my desk at home, and I'm scratching my head thinking of what to do next for a personal project.....*thought processes go here*....hacking Rift support into FSO might be fun!

Has anyone looked into it in anger before? Any experimental branches lurking?
Title: Re: Oculus Rift support
Post by: The E on April 30, 2015, 04:35:49 am
There are no experimental branches I am aware of, so you're definitely free to try your hand at it. Be aware however that there's going to be a rather substantial rewrite of our renderer in the near future (currently developed by Swifty in his personal git repository here (https://github.com/SamuelCho/Freespace-Open-Swifty/tree/shader_transform_deferred)), so I would suggest that you base your work off of that, instead of what's in the master branch of the main FSO repository.
Title: Re: Oculus Rift support
Post by: mid_gen on April 30, 2015, 06:59:08 am
Cool thanks, I've forked Swifty's repo, should have some decent time over the weekend to have a look. The OVR SDK looks pretty straightforward-ish, I'll just have to start hacking around and see what happens :)
Title: Re: Oculus Rift support
Post by: fk0 on April 30, 2015, 09:30:02 am
Just to let know, tridef is adding supporto to the oc to their software that now run with many games, but unfortunately only dx9 and dx11 are supported.
Time ago i played using iz3d and i was able to get an interesting stereoscopic view, but that software hasn't been update anymore and is no more compatible with the actual video drivers.
Title: Re: Oculus Rift support
Post by: Swifty on April 30, 2015, 11:49:46 am
You're welcome to try adding Oculus Rift support but FYI, the renderer is still in flux, especially as I'm going to be replacing OpenGL with the Core profile. I mean, the simplest implementation you can go with right now, is probably go through game_render_frame twice, one for each eye framebuffer. It's going to run like ass though which is why I put off adding Oculus Rift support myself until the renderer is in a good state where rendering the scene twice from different perspectives isn't such a chore anymore.
Title: Re: Oculus Rift support
Post by: Swifty on April 30, 2015, 12:01:40 pm
And one more thing, my branch isn't forked off of the SCP official git repository. This is because my git repo predates the official SCP one by several years as I used it for my own personal source control while SCP was still on SVN. So I highly recommend you don't make any changes right now until I can start migrating stuff to a branch that is properly forked off of the official SCP git repo. You'll only be able to make pull requests on my repo and not the official SCP git repo until after I migrate everything.
Title: Re: Oculus Rift support
Post by: Goober5000 on April 30, 2015, 11:27:16 pm
And to add another cautionary note, there have been at least two previous threads on HLP about adding Oculus Rift support to FSO.  (One of them might have been Swifty, but at least one was a new guy who wasn't part of the SCP.)  I suggest coordinating amongst yourselves so you don't duplicate each other's hard work.
Title: Re: Oculus Rift support
Post by: Echelon9 on May 01, 2015, 01:16:16 am
You're probably aware of this, but Valve has recently commenced moves to provide a common open source API and runtime (OpenVR) that would sit between games and hardware specific implementations of virtual reality kit.

Doesn't appear to yet support Occulus Rift, but I'd wager support will get there pretty soon.

This shim layer could greatly simplify support for a range of VR headsets. See https://github.com/ValveSoftware/openvr
Title: Re: Oculus Rift support
Post by: Swifty on May 01, 2015, 02:10:05 am
I think whichever SDK you target is pretty trivial. The biggest hurdle is rendering to two framebuffers for a single scene for both eyes which is something all VR platforms are expecting. I don't think there's much inertia in changing the VR platform you target.

And to add another cautionary note, there have been at least two previous threads on HLP about adding Oculus Rift support to FSO.  (One of them might have been Swifty, but at least one was a new guy who wasn't part of the SCP.)  I suggest coordinating amongst yourselves so you don't duplicate each other's hard work.

Yeah, I keep writing that I'm going to get around to putting in Oculus Rift support but I feel the rendering code isn't ready for it which is I put it off until I get OpenGL Core Profile working. Anyone else is more than welcome to jump the gun but it's a matter of how worth it is it going to be to get Freespace in VR when the performance is likely going to be crap. Just people shouldn't be surprised if I end up rewriting portions of the implementation in order to get it working with whatever improvements I make to the graphics code. That's all I'm going to ask.
Title: Re: Oculus Rift support
Post by: mid_gen on May 01, 2015, 03:33:25 am
Hey, thanks for the info. The implementation from the OVR SDK is pretty straightforward, you just need to pass it the two framebuffers (or one), and it gives you positional the tracking information.

My OpenGL is pretty rusty so this is mainly a learning/refresher project for me, so don't expect huge swathes of code changes anytime soon :) I'll crack on with trying to beat the stereoscopic rendering into submission first, it's gonna take me a while to learn my way around the codebase.
Title: Re: Oculus Rift support
Post by: Thilus on May 01, 2015, 04:54:05 pm
I'm no coder, I just wanted to leave a cheerleading reply to the brave souls who are attacking this problem. Every Rifter I know asks about FSO support, and HMD ownership is going to skyrocket in the next year, it'll make a lot of people pretty thrilled if this ever happens!
Title: Re: Oculus Rift support
Post by: mid_gen on May 04, 2015, 04:29:36 am
Don't thank me yet, no guarantee anything will work! As well as learning the FSO rendering code and Oculus SDK, I'm dragging my limited C++ and OpenGL from years old memory banks so it's a little slow at the moment :)

Got the FSO build going, got the SDK hooked in and talking to the HMD, next step is to wrap the FSO rendering in the Oculus timing calls and try chucking a single image at the HMD, see what happens.
Title: Re: Oculus Rift support
Post by: Thoemse on May 09, 2015, 06:37:54 am
Thanky ou for trying to do this. I hope so badly ou succeed!
Title: Re: Oculus Rift support
Post by: mid_gen on May 13, 2015, 03:31:07 am
Been a busy couple of weeks but making progress slowly.

Even assuming I can get it functioning, there's going to need to be a pretty extensive rework of the UI to make something playable! Cross that bridge when we come to it though :)
Title: Re: Oculus Rift support
Post by: ShinAli on October 14, 2015, 03:19:51 pm
I've spent a couple of hours a long time ago messing with getting the SDK in FSO and managed to get tracking by co-opting the TrackIR feature that was already in. I can probably dig it up if you want it.

I'd keep looking into it but I'm a game programmer by trade that's also working on another game in my off time.
Title: Re: Oculus Rift support
Post by: chief1983 on October 15, 2015, 10:31:27 am
That would be excellent.  I can't say we'll get it integrated before we move to SDL2 but seeing a working draft done with our existing code could only accelerate the process.
Title: Re: Oculus Rift support
Post by: Echelon9 on October 22, 2015, 02:55:04 am
Thanks ShinAli, we'd certainly appreciate it.