X-Wing Alliance VR mod

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Re: X-Wing Alliance VR mod

User avatar
ual002
Ensign
Galactic Empire
Posts: 430
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Thu May 16, 2019 6:01 pm

I had been putting of a VR headset, but this news right here is all I needed, I just hadn't played any real world flight sims in a while and I liked my track IR.

Any recommendations? I wanna go full ham if I'm gonna do this.
For the glory of his majesty Emperor Palpatine! Image Image

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu May 16, 2019 6:23 pm

I'm probably not the best person to recommend a VR headset -- my experience is limited to the PSVR and Google Cardboard. But anyway, PSVR is the cheapest and you can also use it for the PS4; but it also has the lowest resolution. Next up, I think, is the Oculus: it's more expensive; but has better graphics. I *believe* the top of the line is the Vive: the most expensive and the best quality. Someone else would have to fact-check these statements, though.

Now, here's the thing. Thanks to justagai, I was able to add native (but experimental) support for FreePIE in XWA. This means that the game can now read headtracking data directly from any source that is FreePIE-compatible. No more mouse-look mode. If your headset is compatible with FreePIE, you'll get the best experience. If not, you'll have to map headtracking data to mouse motion somehow. I believe some guys have been able to do this through Virtual Desktop and Oculus; but I don't know of anyone who has successfully done it with the Vive.

I plan to add native support for SteamVR too. By this, I mean that I want to read headtracking data from SteamVR and have XWA respond to it. But I'm not there yet. So, what I'm trying to say is this: if you buy a headset, you may not be able to apply headtracking to XWA directly yet. That may be a somewhat big disappointment if you just shelled out a few hundred dollars just to be able to play this game in VR. As part of your research effort, I would suggest checking for headsets that can map headtracking data to mouse motion or that can be read by FreePIE... Or wait a little bit to see if I can figure out how to talk to SteamVR.

User avatar
ual002
Ensign
Galactic Empire
Posts: 430
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Thu May 16, 2019 6:47 pm

Yea, several people in other circles are telling me Vive PRo for best resolution, but I believe that is tied to steam. So maybe I can just follow your progress here. If you start making SteamVR progress, I'll assume that means you're closer to proper Vive support. In the mean time, what sort of TrackIR support can FreePIE provide outside mouse tracking? Although a neat gimmick, mouse tracking solutions of the past didn't give me the immersion I was looking for.
For the glory of his majesty Emperor Palpatine! Image Image

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu May 16, 2019 9:44 pm

FreePIE provides absolute head rotation angles: yaw, pitch and roll. I read that directly and change the in-game camera to match your head's rotation (the game does not support roll, though -- maybe I can hack it in later somehow).

In other words FreePIE does not go through the mouse: you can look around even if mouse look is disabled in-game. In this way, the in-game rotation matches your own body's range of rotation too. No more fiddling with mouse sensitivity options, etc.

I'm not sure about TrackIR; but I guess TrackIR would be the input for FreePIE? I'm currently using an experimental build of Trinus PSVR to provide the input for FreePIE instead -- and so far it works great.

And yes, I'm trying to connect the game to the SteamVR tracking data. If you can wait a few more weeks, maybe this would be a better option.

User avatar
ual002
Ensign
Galactic Empire
Posts: 430
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Fri May 17, 2019 12:43 am

Im in no rush, and can test maybe with track IR if you get that working in the mean time.
For the glory of his majesty Emperor Palpatine! Image Image

Justagai
Cadet 1st Class
Posts: 206
Joined: Mon Dec 08, 2014 10:59 pm

Post by Justagai » Fri May 17, 2019 10:14 pm

I think the best bet with TrackIR would be to provide FreePIE scripts to hook the TrackIR data and then have the user download FreePIE to use the scripts. Getting a hold of the TrackIR SDK will require that you contact the developers in the first place unfortunately: https://www.naturalpoint.com/trackir/developers/

I think this would be a fair compromise and I hear there are scripts out there already that can do the job.

User avatar
Trevor
Cadet 1st Class
Posts: 165
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri May 17, 2019 11:04 pm

I believe some guys have been able to do this through Virtual Desktop and Oculus; but
Ah, I forgot to correct you on this.
Virtual Desktop does NOT provide mouse movement (though Virtual space does with the caveat of being stretched and in a fixed place in space (just like looking at a monitor)

When I have been testing the VR I have simply been using the mouse to look round.

the oculus would need its own api loaded to be able to use native head tracking.

Trev

User avatar
ual002
Ensign
Galactic Empire
Posts: 430
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sat May 18, 2019 4:42 am

In the point of natural point and track IR they are really stingy with their code as i understand it.
For the glory of his majesty Emperor Palpatine! Image Image

Fek'LeyrTarg
Cadet 1st Class
Posts: 223
Joined: Mon Mar 03, 2008 12:01 am

Post by Fek'LeyrTarg » Sat May 18, 2019 1:55 pm

But there's also OpenTrack, which supports both Freetrack and TrackIR protocols:
https://github.com/opentrack/opentrack/releases

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sat May 18, 2019 8:39 pm

I'm in the process of adding SteamVR support now. I can display some of the images through SteamVR (only the Concourse so far) and I can read the sensor tracking data; but I'm going to need to figure out how to convert the pose matrix returned by SteamVR into the correct yaw/pitch needed by this game (if someone knows how to convert OpenVR pose matrices into yaw/pitch, please let me know as that will save me some amount of trial-and-error here).

So, my guess is that once this is done, both Oculus and Vive headsets would be supported through SteamVR. PSVR users can either use Trinus PSVR or iVRy.

I'm currently experimenting with the the GOG version through SteamVR: Fun!

User avatar
Trevor
Cadet 1st Class
Posts: 165
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sun May 19, 2019 12:31 pm

Awesome I cannot wait to test the new version

Trev

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon May 20, 2019 5:49 pm

I was able to add support for SteamVR over the weekend; but the result is... well... crappy. OpenVR forces us to use of a blocking function that causes a severe drop in the framerate (it goes down to maybe 15fps). The problem is that OpenVR was designed for modern games where the game logic and rendering is performed in different threads. For XWA, this is all done in a single thread. After reading a lot of sources, I think I can solve this problem by creating a dedicated sub-renderer system that runs in a different thread.

Besides that, the lens distortion is handled by SteamVR and the end result is... also kind of crappy. The cockpits look more like paper cutouts than actual 3D. I think SteamVR is probably over-compensating for the lens distortion. I've got some ideas on how to fix that; but again... it was kind of disappointing.

Oh, and I'm experiencing gimbal lock quite literally when looking around using SteamVR. The matrix-to-Euler conversion formulas that I'm using have the side effect of locking your head forward. It's like there was this magnet at the center of the screen and if you look close to it, your head snaps to the center. This is totally my fault and can be fixed with better math, though.

Sadly, I can't just ignore SteamVR because my understanding is that Vive users have no option (?) I've read that as soon as Vive headsets are turned on, SteamVR runs (?) So, anyway, this is going to take a bit longer than I expected. I could probably release the FreePIE support in the meantime, though, since that hook is independent of SteamVR and it works really well.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu May 23, 2019 6:42 am

I think I was able to solve most of the performance problems with SteamVR and added proper tracking. The performance is not as good as direct SBS; but it's playable. Here's a sample screenshot:
2019-05-22-PM_11_21_19.jpg
You do not have the required permissions to view the files attached to this post.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu May 30, 2019 2:38 am

I've got an experimental build that supports SteamVR: it will work; but I'm not sure it will look good. In particular, I fear it may cause some eye strain. So, before issuing a formal release, I'd like some volunteers to help me test this on other headsets (looks good to me on a PSVR; but I'm aware it may not look good on other hardware).

Please contact me if you're interested in testing this experimental build.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Jun 17, 2019 5:40 am


User avatar
ffaaway
Cadet 2nd Class
Rebel Alliance
Posts: 92
Joined: Mon May 05, 2003 11:01 pm

Post by ffaaway » Mon Jun 17, 2019 2:41 pm

blue_max wrote:
Mon Jun 17, 2019 5:40 am
Coming soon in the next release:

https://www.youtube.com/watch?v=wUD9ADy ... e=youtu.be
LOL WUT!? you got it working, incredible!!! Insanity!!! Inconceivable!!!
X-Wing pilot since 1993 and still kickin'

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Jun 17, 2019 5:34 pm

It's a bit hacky and it's not perfect; but yeah, 6dof works. I'll release it soon.

I think I can do something similar with TrackIR now. I would probably have to disable roll, though, unless people don't care about seeing gaps in the corners of the screen.

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1656
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Mon Jun 17, 2019 10:55 pm

I personally would rather give up 6dof for aesthetics in this case. It's cool that it works. But it's entirely immersion breaking, and I don't like the result.

I do applaud your efforts though, if there was any way in the future to avoid the visual glitches, then I'd be all for 6dof

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 18, 2019 5:41 am

Head roll doesn't look that bad inside the HMD and it helps avoid some dizziness; but I see your point, Driftwood: it's very easy to break immersion by leaning. I've added some limits to try and prevent this; but 6dof will be optional and configurable by the users. On the other hand, I see value in leaning forward: it doesn't break immersion and helps make things readable in VR. But no worries, I'm trying to make all these details configurable and optional.

User avatar
Driftwood
Lieutenant Commander
XWAU Member
Posts: 1656
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Tue Jun 18, 2019 6:15 am

Well keep up the good work. Leaning forward makes sense, I'd just keep trying to figure out ways to keep from breaking immersion.

Maybe I'm being overly picky. I'm just glad track ir is now an option.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 18, 2019 5:53 pm

It's always good to hear the opinions of others. Makes me realize that other people might want this to be optional, for instance. Of course, if someone can figure out the Hook for the full 6dof cockpit camera, most of these problems would go away.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jun 19, 2019 6:25 am

Alright, here's version 0.9.9 with support for SteamVR and 6dof. I can't test the positional tracking very well myself; so I'm interested to see if it works OK. All the extra axes can be disabled, inverted or reduced using multipliers.

https://www.dropbox.com/s/ggk82izidae07 ... 9.zip?dl=0

I'm especially interested in learning what happens when people lean to the sides and turn their heads in the same direction. That is, what happens if people try to lean close to the sides of the cockpit. I can't test that very well and I don't know if it will zoom properly or not.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10257
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Wed Jun 19, 2019 6:42 am

Moving this topic to XWA Hook Editing forum
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
Trevor
Cadet 1st Class
Posts: 165
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Thu Jun 20, 2019 6:59 pm

Just tested the new version and 6dof works great on rift (by the way, change your readme to say DK2 as well as CV1)

However... I have found a bug that has only been made apparent by 6dof...

My settings make the 3d window 2.5x so it covers the entire field of view whilst the HUD remains tight in the center, this looks great and hides the missing geometry, however... I had to change the lateral movement to 2.5x too, which made the HUD look like it was moving toward me too fast, also... I had to make the IPD 2.5x to match else the cockpit "looked" 4m wide instead of <2m
So... the bug is that not being able to disable frustum clipping (and using a zoom workaround) is detrimental to the scaling of everything.

I was going to try one further test to see if in the mean time you could simply multiply the HUD distance by 3dzoom distance.

That said, I use an infinite HUD anyway.

Oh, one further bug, in the tech room the 3d models don't respect the concourse aspect ratio - consequently they appear stretched vertically since they think they are rendering on a 960x1080 surface when they are rendering on a 640x480 surface.

Trev

EDIT
OK, confirmed, if you use the 3dzoom as a multiplier then everything works as expected even without disabling frustum culling.
eg, IPD = 6.5*2.5=16.25 (IPD * zoom)

One thing I tend to do is start the game about 25cm further back than I intend to play it so that I "move forward" so my center is in the center of the "chair" instead of the back of it (when I look down, steam has a circle to indicate your "floor" and CenterPoint)

This is absolutely AMAZING!!!

Also, I disabled limits (by making my limits 100m) and have no problem of "escaping" the cocpit - even during heavy dogfights.

blue_max
Cadet 1st Class
XWAU Member
Posts: 240
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jun 21, 2019 4:36 am

Hey Trevor, thanks for testing this version! I'll add DK2 to the readme.

I don't think there's much I can do at the moment regarding frustum clipping. You can place the HUD at any depth you want, though. It looks like you solved the scale issues you were having; do you still want me to add a new setting like "multiply_HUD_distance_by_3d_size"? Also, are we talking about the whole HUD or just the aiming reticle?

I've got an alternate fix for aiming reticle now: I added a toggleable setting to disable motion tracking for just that element so it "floats" around the cockpit allowing you to aim properly no matter how much you lean. But placing it at infinity also works too.

The objects in the Tech Library are rendered with the same aspect ratio as the 3D window -- you're right, that's probably going to cause stretching. I'll fix that, thanks for reporting the bug.

How are you setting the IPD? In the SteamVR version, the vrparams IPD is ignored.

It would be great if you posted a video! I can't really test the positional tracking on my end, so I would love to see how it looks on your rig.

Post Reply