X-Wing Alliance VR mod

Here you can find help for how to best run and setup your XWA VR experience.
Post Reply

Re: X-Wing Alliance VR mod

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 09, 2020 6:23 am

keiranhalcyon7 wrote:
Tue Jun 09, 2020 6:05 am
If SteamVR has to block the GPU, I have to wonder how anything could be expected to get on with (useful) work while it's blocking.
The CPU is expected to start computing the next frame in advance. This is called the "running start algorithm". Actually, if I remember correctly, the CPU is expected to start computing frame N + 2 while the GPU is blocked. When the GPU is unblocked, SteamVR displays frame N while the GPU starts computing frame N + 1 and you have 11ms to do it. Also, the blocking call is expected to be executed about 2ms before the frame is presented, so that's all the "dead time" that SteamVR expects in each frame. (Of course, this doesn't happen in XWA because once the GPU is blocked, the CPU is also blocked.)

This makes more sense when you see the presentation by Valve. The point is that both the CPU and GPU are fully utilized and busy all the time in this scheme and the blocking call helps sync everything. It makes a lot of sense when you have a multithreaded renderer, but not for XWA at the moment.
Hmm... maybe a double buffer? Shunt one to ddraw, and capture any subsequent calls from the engine in the second...
Yes, this might work. Again, I need to check if XWA doesn't call other stuff in the meantime (which would cause random crashes). I think other calls, like Begin/EndScene would also have to be buffered, along with the data they use. BTW, I appreciate your suggestions. In the past it's stuff like this that has made me look in interesting directions and then new effects happen afterwards.

Anyway, I think I've got a fully metric 3D reconstruction now; but it's going to be a while before I rewrite all the VR code and effects to use it. Hopefully, that will fix the distortion that some users have been reporting.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Jun 09, 2020 8:15 am

:thumbs:

Like I said, you seem to know what you're doing.

Rogue 10
Cadet 4th Class
Posts: 15
Joined: Sat Jun 06, 2020 6:15 pm

Post by Rogue 10 » Tue Jun 09, 2020 7:08 pm

Just checking in. I messed around all day with this. So here are the User test results.
My main issue is, Either Steam VR, (or Oculus) will not let go of the Blue Max Mod.
So I am unable to revert XWA back to not using VR, while using Blue Max

It tried a whole bunch of attempts: Here are the highlights
-re run Blue Max Mod with the IR option off. ----This essentially turns the Screen blank. no Dice
-uninstall Steam VR. ----- After this, the game will boot, but the screen remains blank and the sound continues to come out of the VR unit.
--Deletion of entire XWA directory, Fresh install of XWA, 2.02 and XWAU and updated hooks-- This fixed it, got the game back... able to play on PC screen.
--On top of that fresh install, I reinstalled Blue MAx - And once again.. the screen goes blank.(feels like a hook somewhere on the Steam VR not letting go of wanting to play the game in VR mode)
Reinstalled Steam VR - Game came back to life, on both the PC screen (social Screen?) and the VR unit.

Some good news: At this point, I was bale to get the VR running better than ever before. I(STill not great, but not bad) - was running at 50% resolution in Steam VR, and never installed the cockpits of the banckgrounds.. Only had XWAU and the blue max patch. Saw a significant performance increase in this configuration.

At this point, I think Im going to try a few of the campaign maps in VR.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jun 09, 2020 7:59 pm

@Rogue 10: FTR you only need to do 2 things to disable SteamVR. In VRParams.cfg set "VR_Mode = None" and in CockpitLook.cfg set "tracker_type = None". That's it. No need to reinstall anything. The installers are a convenient way to modify settings and install files.

Looks like in your case maybe the XwingAlliance.exe or the SteamVR processes were not shutting down properly so the changes weren't being applied. Also, try running the game using XwingAlliance.exe directly (in case you were using the launcher previously).

Rogue 10
Cadet 4th Class
Posts: 15
Joined: Sat Jun 06, 2020 6:15 pm

Post by Rogue 10 » Wed Jun 10, 2020 1:53 am

Made both those changes..
Went back and confirmed the changes were present in both config files.
Relaunched game, and then the game automatically launched Steam VR.
Tried to X out of steam VR, but then it says if you close steam, it will close xwing Alliance too. Then hit OK and both close.
This was using XWA Quick start icon..
When I tried to launch directly off the App, it did nothing.

I believe this is a known issue with Steam. very frustrating, as I see no solution.

Rogue 10
Cadet 4th Class
Posts: 15
Joined: Sat Jun 06, 2020 6:15 pm

Post by Rogue 10 » Wed Jun 10, 2020 6:28 pm

blue_max wrote:
Mon Jun 08, 2020 6:56 pm
Thanks for trying out the VR mod, Rogue 10. The biggest performance problem with SteamVR is a blocking call to WaitGetPoses() that won't return control to ddraw until the images have been presented to the headset. The idea is that your renderer should be multi-threaded so that you can continue to process the next frame while you wait for this call to return. Problem is, XWA is not a multi-threaded renderer and doing the conversion might be extremely difficult.

You don't have to take my word for it, though. If you install the DirectSBS version, you'll see the same VR content; but without SteamVR. You'll see a big improvement in performance. If your headset has an option to display Side-by-Side content directly, then you might be able to use this option. I have no trouble sustaining 45-60fps in DirectSBS mode.

Unfortunately, for SteamVR, the only way to go for now is to reduce the resolution of the headset, and use lower settings for the effects. I run at 50% resolution, and while it isn't great, it's also not that bad, and I've been able to play full missions in SteamVR with only minor bumps in performance.

The thing that confuses me are your statements about the Concourse: this is where the performance should be at its maximum since it isn't rendering much (it's rendering only 2 triangles). Except when loading missions, I have no trouble getting 60fps here, so maybe there's something else on your side that's causing problems? Are you using the latest hook_time.dll? If you have a "60fps" hook, try disabling that.
How do I install the DirectSBS version?
Should I just modify VR Params again, and re-set VR Mode to "DirectSBS" ? Is there anything elese I need to load, or does it work on its own?
What should CockpitLook.cfg set "tracker_type = ??? FreePie?
Aslo, how do you edit a dll?

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Wed Jun 10, 2020 9:33 pm

You don't edit the dll.
I just modify VR Params again, and re-set VR Mode to "DirectSBS" ?
Yes that's it, save the file then start XWA
CockpitLook.cfg set "tracker_type = ??? FreePie?
set it to "None"

Trev

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Jun 10, 2020 9:57 pm

Thanks Trevor. You can also set "tracker_type=FreePIE" in CockpitLook.cfg; but you'll need to install and configure FreePIE or the head tracking won't work.

If you just want to test DirectSBS, set it to "tracker_type=None" as Trevor said.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu Jun 11, 2020 4:39 pm

I just implemented a different algorithm to do the 3D reconstruction for VR. This time, I'm making sure I get a metric reconstruction that matches the dimensions of the objects in the OPT files, and I'm removing the shear introduced by XWA's camera. I think these two points should remove all the distortion experienced by some users once and for all. A few effects are slightly broken at the moment because of this change; but if anyone's interested in testing this version, please PM me and I'll send you a download link.

I'm also trying to make ddraw auto-compute all the settings. So users should be able to just put on their headsets and go. No more fussing manually with the FOV, scale, etc.

User avatar
m0rgg
XWAU Member
Posts: 266
Joined: Wed Apr 01, 2020 10:33 pm

Post by m0rgg » Thu Jun 11, 2020 4:54 pm

blue_max wrote:
Thu Jun 11, 2020 4:39 pm
I just implemented a different algorithm to do the 3D reconstruction for VR. This time, I'm making sure I get a metric reconstruction that matches the dimensions of the objects in the OPT files, and I'm removing the shear introduced by XWA's camera. I think these two points should remove all the distortion experienced by some users once and for all. A few effects are slightly broken at the moment because of this change; but if anyone's interested in testing this version, please PM me and I'll send you a download link.

I'm also trying to make ddraw auto-compute all the settings. So users should be able to just put on their headsets and go. No more fussing manually with the FOV, scale, etc.
That's great news blue_max! As you know I tried some time ago but failed miserably.
Maybe I can help testing it if you push it to github or give me the compiled DLL.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu Jun 11, 2020 5:37 pm

m0rgg wrote:
Thu Jun 11, 2020 4:54 pm
That's great news blue_max! As you know I tried some time ago but failed miserably.
Maybe I can help testing it if you push it to github or give me the compiled DLL.
I just pushed the code into the MetricVR branch, and sent you a compiled version of the DLL. Look in your PMs.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Thu Jun 11, 2020 5:43 pm

I don't have a VR rig, but I'm curious what this shear is. I don't suppose, for the release, you could add a hotkey to toggle the shear removal in non-VR play?

Also, congratulations on your imminent 1000th post. :D

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu Jun 11, 2020 5:57 pm

The shear modifies the y coordinates with respect to the depth of a point. It's something like this:

y2D = Y3D / Z3D - Z3D * Ycenter / FOVfactor

It causes things to "tilt up" the farther they are from you. This shear destroys 90 degree angles in the Y-Z plane so I'm guessing that was causing some distortion in VR. I'll try to post some pictures later. However, to be honest, I barely notice any visual difference. I only caught this when I dumped the contents of the screen to an OBJ and compared that to the original OPTs.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Thu Jun 11, 2020 7:07 pm

Is it always "up", or is it "away from the camera x-z plane"?

The whole notion of it isn't quite settling in my brain. Like, if I fire some lasers straight ahead, they don't curve the farther away they get. This isn't TLJ.

I guess Ycenter and FOVfactor are constants of the camera geometry?

User avatar
m0rgg
XWAU Member
Posts: 266
Joined: Wed Apr 01, 2020 10:33 pm

Post by m0rgg » Thu Jun 11, 2020 10:52 pm

blue_max wrote:
Thu Jun 11, 2020 5:37 pm
m0rgg wrote:
Thu Jun 11, 2020 4:54 pm
That's great news blue_max! As you know I tried some time ago but failed miserably.
Maybe I can help testing it if you push it to github or give me the compiled DLL.
I just pushed the code into the MetricVR branch, and sent you a compiled version of the DLL. Look in your PMs.
I just tested, and the distortion seems to be gone! \o/

There is some lag/stutter in the headtracking, but not sure if it's due to my previous tests that messed something up.
If I move slowly, the geometry seems to be absolutely correct.
I will try to test with a clean install and report back, but that will be tomorrow!

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Thu Jun 11, 2020 11:48 pm

m0rgg wrote:
Thu Jun 11, 2020 10:52 pm
I just tested, and the distortion seems to be gone! \o/
Thanks for testing this, m0rgg, and I'm happy the distortion is (apparently) gone. Please keep me posted if you notice any more distortion. For the performance, is that happening when flying? There's some stutter to be expected if the screen is busy; but you should be able to do ~30fps consistently otherwise (I just checked yesterday).

@keiran: Yes, the FOV and ycenter and constants related to the current in-game resolution. As for your other questions, it's a bit hard to explain with words, so please allow me to post some pictures later. The gist is this: the shear is small (maybe about 7 degrees) and both the world and the camera are distorted in the same direction, so maybe these two distortions cancel each other out (?) This is linear distortion, and it's very hard to notice. Probably only apparent when you have off-axis cameras that can move in any direction (as is the case of some VR headsets).

ptisinge
Cadet 4th Class
Posts: 10
Joined: Tue Jun 02, 2020 5:08 am

Post by ptisinge » Fri Jun 12, 2020 12:08 am

I'll also be happy to do some testing on that Blue_max if you want.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jun 12, 2020 3:30 am

ptisinge wrote:
Fri Jun 12, 2020 12:08 am
I'll also be happy to do some testing on that Blue_max if you want.
Thanks! I just sent you a PM with instructions

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri Jun 12, 2020 1:27 pm

I never got a PM, can you send me the dll too please

Trev

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jun 12, 2020 4:01 pm

Trevor wrote:
Fri Jun 12, 2020 1:27 pm
I never got a PM, can you send me the dll too please
Of course! Check your PMs.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri Jun 12, 2020 5:46 pm

Thanks, so first problem that I didn't notice before now.... all my VR Params are wrong...
I updated the effects installer and used "Ignore" but its still overwritten all my settings...

Ill set back up then test

OHHHH, Ive just found out why SteamVR want to use a higher resolution than the Rift display.
Its not supersampling, but its overscan (the same as what I was doing in VRPArams.)

Also, something has changed very drasticly… I have not yet used the new ddraw but steam is way out of whack...



ok, got my VR set back up to the way it was before (except the main non-VR window is stretched in width)
copied new ddraw and main window is still stretched however as instructed I removed focallegnth.cfg and it Looks good. Opening focallegnth reveals a VFOV of 106.89 which is probably right, certainly there is no distortion and everything looks right with my test opt.

I have confirmed my other settings remain the same as before (compared against commented out settings)
positional_x_multiplier = 1.666
positional_y_multiplier = 1.666
positional_z_multiplier = 1.666
stereoscopy_multiplier = 0.333
3d_window_size = 3.000
3d_aspect_ratio = 0.888
concourse_aspect_ratio = 1.333

Also, I tested using xwahacker and changing my res to 960x1080 Hudscale 1.5 and it works, text is very clear with font hook.

Trev

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Fri Jun 12, 2020 9:53 pm

Trevor wrote:
Fri Jun 12, 2020 5:46 pm
Thanks, so first problem that I didn't notice before now.... all my VR Params are wrong...
The various depth settings in VRParams need to be fixed because ddraw is using a different scale now. For instance, my HUD_depth was 1.700 before and I now have to set it to 7.0 to place it at a reasonable depth. However, once I fix the code, you should be able to use the old settings again. Unless you're talking about something else, of course. In which case feel free to elaborate.
Also, something has changed very drasticly… I have not yet used the new ddraw but steam is way out of whack...
So, was this related to ddraw or not?
ok, got my VR set back up to the way it was before (except the main non-VR window is stretched in width)
I'll fix that.
Certainly there is no distortion and everything looks right with my test opt.
That's the main thing I wanted to fix in this version, thanks for confirming that.

User avatar
Trevor
Lieutenant JG
Posts: 541
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sat Jun 13, 2020 12:30 am

blue_max wrote:
Fri Jun 12, 2020 9:53 pm
Unless you're talking about something else, of course. In which case feel free to elaborate.
This was the effects installer not ddraw.

I updated the effects a week or 2 ago (whenever that update landed) and chose "Ignore/NoVr" or something to that effect however the installer went and changed ALL my files (VRParams, Bloom, etc)
The various depth settings in VRParams need to be fixed because ddraw is using a different scale now.
Ah, I did not notice any depth issues, probably because I use 65535
That's the main thing I wanted to fix in this version, thanks for confirming that.
And to confirm the multipliers are still required and work as expected with new metrics. (Again, measured in real life with a tape measure and walking)

Trev

ptisinge
Cadet 4th Class
Posts: 10
Joined: Tue Jun 02, 2020 5:08 am

Post by ptisinge » Sun Jun 14, 2020 4:13 am

Woohoo! You did it!

I just tested it and no more distortion. I used the parameter value you suggested for the dc file (110 for the fov) and this seemed to work great. The cockpit felt like it was scaled right and with no distortion at all. I had some severe performance issues and would need to adjust hud parameters, but the distortion issue is clearly fixed (and this is a huge difference, not a small detail)

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Jun 15, 2020 6:20 pm

Thanks for testing this WIP version, ptisinge. I'm glad that it has finally fixed the distortion problem. The increased FOV forces XWA to render more things, so that probably explains the drop in performance. However, in my case, it didn't cause a massive drop. You can try lower FOVs like 90 or 80 perhaps, to see how much that affects the performance. I'm also running at 50% resolution in SteamVR, so maybe that helped too.

Yes, the HUD has to be fixed in the code so that the depth remains the same (this is currently broken).

I'm currently fixing the all shaders to use this metric reconstruction. One thing I didn't like very much was that the current POV on many cockpits made things stretch out quite a bit on the sides. I'm adding a new feature where individual POVs can be adjusted on a per-craft basis to reduce this effect.

Another thing that I noticed is that things have a much greater sense of depth. Objects now seem to be floating in space, and the ISDs feel massive when flying close to them.

I'll post another preview soon.

Post Reply