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

Darkblue
Cadet 2nd Class
Posts: 96
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Sun Dec 08, 2019 12:56 pm

Hi blue_max, this is a wonderful fix. I see that in VR you have solved a lot of the problems I found the hardest to solve so to make it work fine in 3DVision/pageflipping (target CMD, and HUD).

But this is only for VR. As a guy of no-VR but enthusiast of 3DVision (3D screen + glasses) I tested it with VR_Mode = None in VRparams.cfg, and when entering 3D mode, all depth glitches are back (I guess your fix for VR is bypassed).

I was wondering if maybe you could add a mode for 3D screens (3D Vision/pageflipping). AFAIK it should be something that uses your fixes, so generates one "image" (but only one, not both left and right) and send that "image" to the driver so 3dvision driver could generate both images (left and right). Maybe it would be enough bypassing the part of your code that generates the two images (left and right). It seems relatively easy (although I actually don't know for sure).

Another thing, it would be very convenient to add the Fullscreen option back to ddraw.cfg, otherwise you have to use Alt+Enter to trigger 3D mode and it crashes sometimes.

BTW, the bloom effect (VERY nice in engine glows) is only working in one eye in 3DVision, but maybe it will work fine with that modification.

Very nice work indeed!

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

Post by blue_max » Sun Dec 08, 2019 6:46 pm

Hey Darkblue, thanks for your comments!

Yes, if you disable VR mode, it will go back to the original rendering. I assume you tried setting VR_Mode = DirectSBS and that didn't work?

You're also saying that in 3Dvision you only need one image? How does 3Dvision generate both images then? From the depth buffer? Is there some documentation for this so that I can get an idea of what is needed to enable this mode?

Darkblue
Cadet 2nd Class
Posts: 96
Joined: Sun Mar 09, 2003 12:01 am

Post by Darkblue » Sun Dec 08, 2019 7:39 pm

Yes, I tried DirectSBS, and when in SBS (and 3DVision is NOT active) the HUD is perfectly rendered, no problems. But when I am still in SBS mode, I can activate 3DVision, then I get a full 3D image with each of the views (left and right), so I see 4 images, 2 + 2: for each one of these couples, the HUD is bad placed as always…(just the same I get when I launch with VRMode = None), so maybe the problem is how 3dvision drivers interpret the information.

There is some official documentation from NVIDIA (whitepapers) on 3DVision in Helixmod site, in this page: http://helixmod.blogspot.com/2014/01/le ... games.html

Also some info in 3DMigoto wiki https://github.com/bo3b/3Dmigoto/wiki and the School for shaderhackers: http://wiki.bo3b.net/index.php?title=Bo ... derhackers, although these are more focused in editing shaders to fix 3DStereo problems.

I have been using a mix of 3DMigoto and some memoryscanner techniques to fix XWA some years ago, and I got very impressive results but I failed trying to put the target CMD (the image of the targeted ship) in screen depth (2D)…so the HUD was always a problem. A very distracting problem. So the fix slept for some time until recently that I got new interest on it.

On the other hand, I think that in your fix the starfield is a bit too close (it does not seem to be at infinity) but still this is a minor problem, that I am sure could be easily fixed with some shader hacking later, if really needed. IIRC I had to push it to infinity when I fixed it, as the game, by default, places it in some place between screen plane and back plane (infinity).

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

Post by blue_max » Mon Dec 09, 2019 7:12 pm

I've taken a look at the documentation and it looks like the easiest way to add support for 3D vision would be to piggy-back on the DirectSBS code and add the following:

https://stackoverflow.com/questions/737 ... -3d-vision

In a nutshell:

"Render left eye image
Render right eye image
Create a texture able to contain them both PLUS an extra row (so the texture size would be 2 * width, height + 1)
Write this NV_STEREO_IMAGE_SIGNATURE value
Render this texture on the screen"

The DirectSBS mode already does all the above, except for the extra row with the NV_STEREO_IMAGE_SIGNATURE. I would probably not make a new texture of size Height + 1 -- I'd just overwrite the bottom row and adjust the contents accordingly.

However, there are a couple of problems:

1. This technology seems to be deprecated (?), so no new hardware is sold/made and I don't have the hardware to test this.
2. My video card does not support 3d vision anyway -- not even with an old nVidia driver.

If you have some basic coding skills and would like to try this, I can direct you to my github page and I can give you instructions on how to compile the code. I can also point you to the right places where you would need to touch the code to add support for 3D vision.

TheLastStarfighter
Recruit
Posts: 7
Joined: Thu Dec 26, 2019 4:59 pm

Post by TheLastStarfighter » Thu Dec 26, 2019 5:06 pm

Greetings Starfighters

Love the mod, hope you continue working on it, really adds alot to the game. I'm currently running STEAM VR with a Super 2060 RTX. I'm just curious if that fish eye effect is negatable at this juncture? I have a vive. Really big props though, if you can get this game working the way Jedi Knight does with VorpX, you'll be doing well. I can code a little bit and I would be more than happy to help contribute to your project. I'm not quite sure why DICE hasn't done this yet, then again someone green lighted all of these sequels...so.... yeah. Looks like Star Wars might be solely in the realm of fans and modders for the foreseeable future.

I'm not 100% sure but are things supposed to be in 3-D or not? I saw some talk about the 6dof and was wondering if there is a setting to enable this in the new update? I'm kind of getting what looks like a flat image outside.. in VorpX this is called Z-adaptive I believe. Theres also a Geometry 3-D setting in VorpX, is that something that would be achieveable in XWA?

Apologies if this has already been answered, I looked over the previous posts but I may have missed something.

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

Post by blue_max » Thu Dec 26, 2019 9:27 pm

Thanks for your comments, TheLastStarFighter.

The fish eye effect can be fixed; but I'm not quite sure how to do it. I think it has to do with the interaction between the in-game FOV & aspect ratio; the aspect ratio set by SteamVR and the aspect ratio set in vrparams.cfg (in a few words everything should match). I think Trevor nailed it in his latest post in this thread:

https://xwaupgrade.com/phpBB3/viewtopic ... 33#p162533

I also provided a set of coefficients to apply or substract the lens distortion effect. Look for the k1,k2 & k3 settings in vrparams.cfg and the "apply_lens_correction" setting. If you set these values to negative numbers, you'll get a pincushion effect that will compensate for the fish eye effect. You can also adjust these settings while flying using Ctrl+Alt+Arrows (Left/Right for k1 and Up/Down for k2). However, this is really just a hack and the right way to fix this is by setting the right FOV and aspect ratio.

From what I understand, our eyes cannot perceive depth from things beyond ~150 meters away. The disparity between our eyes is simply too small to notice it. That's why you'll see the cockpit in full 3D; but objects "out there" look a bit flat unless you're really close to them. I don't know enough about VorpX; but it *is* possible to selectively increase the disparity of the objects "out there". There are a few problems, though:

* The geometry breaks when crossing the limit between the cockpit and "out-there".
* When you fire lasers, they seem to come from "out of your nose", especially for small cockpits like the TIE-Fighter. Other things seem to shrink in size and "float in front of your nose" too. Which is kind of fun; but also a bit weird. If you want to see how it all looks, check these videos:

https://www.youtube.com/watch?v=zM4pbVS ... e=youtu.be
https://www.youtube.com/watch?v=BDfARGn ... e=youtu.be

* Some projection cameras for SteamVR are rotated or sheared, so I wouldn't know how to increase the disparity in these cases without introducing new artifacts or causing eye-strain. I have a PSVR, and in that case, it's just a matter of translating everything on the x-axis. For other camera models I'm guessing the "clean" way to do this would be to offset the Z component of everything "out-there"... Might as well try that later...

6dof should be enabled already, look for the "min/max_positional_track_x/y/z" and the "positional_x/y/z_multiplier" sections.

I do have plans to improve the VR experience in the future. This FOV thing is really annoying and I don't know yet how to fix it automatically. If you want to try and fix that, let me know and I'll point you in the right direction.

TheLastStarfighter
Recruit
Posts: 7
Joined: Thu Dec 26, 2019 4:59 pm

Post by TheLastStarfighter » Thu Dec 26, 2019 10:09 pm

A few more questions:

Would you say this mod works better in PSVR or Vive? I have both, I'm a bit of a super-fan.

Also is this mod capable of multiplayer with regular players? How is it that you were able to program this with just a PSVR ?

Yes I'd be happy to help with the FOV if I can.

In terms of PSVR: Astro-bot, Skyrim and Farpoint seem to have a good distance effect while the Battlefront and EVE Valkeryie 3-D is very meh. That being said, if you try Rogue Squadron for the Gamecube (the Dolphin VR) the 3-D stereoscopic effect is pretty good. Also I'm not sure if you've tried it or not but Subnautica seems to share that 'flatish' effect you are talking about. I'm not entirely sure what it is about how the gamecube games are programmed but a good number of them come out in perfect stereoscopic effect as if they were made specifically for VR.

Paper Mario TTYD
Rogue Squadron
Star Fox
Mega Man Command Mission
Battlion Wars

Same for PSP... the 3-D is really good... I'm wondering if something similar can be written for the X-Wing series.... like a graphics fork.

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

Post by blue_max » Fri Dec 27, 2019 3:46 am

TheLastStarfighter wrote:
Thu Dec 26, 2019 10:09 pm
Would you say this mod works better in PSVR or Vive?
PSVR. SteamVR/OpenVR forces you to call a blocking function that makes you drop frames, so you always get higher FPS with PSVR.
TheLastStarfighter wrote:
Thu Dec 26, 2019 10:09 pm
Also is this mod capable of multiplayer with regular players?
I've never tried this; but I don't see why it wouldn't work. If Jeremy's ddraw works, then I think this one should too.
TheLastStarfighter wrote:
Thu Dec 26, 2019 10:09 pm
How is it that you were able to program this with just a PSVR ?
That was a stroke of pure genius my friend! :P

Well, I had people with Vive/Pimax/Oculus help me test beta versions. It took several weeks of trial-and-error and a lot of head-banging to finally figure out how to do it properly.
TheLastStarfighter wrote:
Thu Dec 26, 2019 10:09 pm
Yes I'd be happy to help with the FOV if I can.
I just sent you a PM with basic instructions to get you started on this project.
TheLastStarfighter wrote:
Thu Dec 26, 2019 10:09 pm
In terms of PSVR: Astro-bot, Skyrim and Farpoint seem to have a good distance effect while the Battlefront and EVE Valkeryie 3-D is very meh.
Well, I think this goes back to my previous point: things beyond ~150m have no disparity and thus generate no stereoscopy. During a dogfight in XWA objects tend to be around this range. However, the 3D reconstruction is also an approximation. I tried a few different scales and if you get stereoscopy for distant objects then you mess up the cockpit (it looks too small or just plain broken). In the end, I decided to use a scale that made sense in-game: objects at 2km have a Z of 2,000 and so on. Anyway, I sent you a PM with compilation instructions and I can point you in the right direction later if you want to change the VR code and try things out.

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

Post by blue_max » Thu Jan 30, 2020 7:04 am

Alright, here's release 1.1.0 with enhanced 6dof support and a number of bug fixes:

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

boner
Cadet 4th Class
Posts: 15
Joined: Sat May 14, 2011 8:20 pm

Post by boner » Fri Jan 31, 2020 5:10 am

Hi, Works very well with freetrack (trackIR setup) with amazing plugins like Bloom effects.

i have a question about x-wing, is posible to change the model or something to see the body on the front, like on the a-wing?

you can see an expample of the problema i have with x-wing in the first minut of the video, and on the minut 2 how its Works with a-wing (the rest of the video is just a test of experimental clip and camera for freetrack, playing with gamepad :S)

https://youtu.be/Y-fbuGBMGDo

kind regards.

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

Post by blue_max » Fri Jan 31, 2020 7:04 am

Thanks for your comments, boner, and I'm glad you're enjoying the mod (although I suggest you tone down the bloom effect a little bit).

Darksaber added the nose to the X-Wing a while ago; but I don't know if he released that OPT to the public. However, if you keep leaning outside the cockpit, we can't help you with that ;)

@Darksaber: have you released the "X-Wing with nose" somewhere?

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

Post by Trevor » Fri Jan 31, 2020 8:43 pm

Agreed, you have wayyy too much bloom.

I would suggest disabling re-shade and just using bluemax's ddraw going forward.

ddraw has several advantages over reshade including selective bloom only allowing emissive sources to bloom.

Trev

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

Post by blue_max » Sun Feb 23, 2020 10:20 pm

Alright, here's the next release, the new shading model is included here with support for specular shading, materials and updated SSAO/SSDO shaders, plus a new Deferred shader option:

EDIT (link updated): https://www.dropbox.com/s/3dz5egxfboeg4 ... 1.zip?dl=0
Last edited by blue_max on Thu Mar 05, 2020 5:19 pm, edited 1 time in total.

<A2>Animal
Recruit
Posts: 1
Joined: Thu Mar 05, 2020 3:53 am

Post by <A2>Animal » Thu Mar 05, 2020 4:05 am

blue_max wrote:
Sun Feb 23, 2020 10:20 pm
Alright, here's the next release, the new shading model is included here with support for specular shading, materials and updated SSAO/SSDO shaders, plus a new Deferred shader option:

https://www.dropbox.com/s/4ag3p9io01k5q ... 1.zip?dl=0
blue max: Thanks a lot to you and your friend Justagai for doing this. LOVE!!!
I have tried to download your last update but he file is missing.
Are you working on a newer version? I can´t wait to see that new shading!!

KuMoNKo
Cadet 4th Class
Posts: 14
Joined: Sat Dec 14, 2019 9:36 pm

Post by KuMoNKo » Thu Mar 05, 2020 4:12 pm

<A2>Animal wrote:
Thu Mar 05, 2020 4:05 am
blue max: Thanks a lot to you and your friend Justagai for doing this. LOVE!!!
I have tried to download your last update but he file is missing.
Are you working on a newer version? I can´t wait to see that new shading!!
I think the latest version by blue_max is here: viewtopic.php?f=9&t=12418&start=25
It's the post at Feb 27, 2020 7:02 am
Regards

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

Post by blue_max » Thu Mar 05, 2020 5:20 pm

KuMoNKo wrote:
Thu Mar 05, 2020 4:12 pm
I think the latest version by blue_max is here: viewtopic.php?f=9&t=12418&start=25
Sorry, yes, I removed the old link to fix a problem in the cockpit look hook. I've updated the download link above.

vbodo78
Recruit
Posts: 6
Joined: Sun Jan 05, 2020 6:32 am

Post by vbodo78 » Wed Apr 01, 2020 3:57 am

@blue_max I've been following the VR mod for quite some time now, and done manual installs of the various releases and previews prior to your release of the installer. During one such install, I seem to have changed a setting for the HUD (mission messages, objectives, targeting computer) where now the HUD appears to be really small and the depth appears further away than the cockpit. What settings could I adjust to resize the HUD scale and aspect ratio, and set it to the correct distance?

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

Post by blue_max » Wed Apr 01, 2020 6:16 am

vbodo78 wrote:
Wed Apr 01, 2020 3:57 am
I seem to have changed a setting for the HUD (mission messages, objectives, targeting computer) where now the HUD appears to be really small
Sounds like you either pressed Ctrl+Z to zoom out the HUD, or you changed the actual depth of these elements. Can you post a picture to give me an idea?

The easiest way to fix this would be to backup your XWA installation folder and then erase VRParams.cfg and reinstall it using the installer we just published in this thread:

https://xwaupgrade.com/phpBB3/viewtopic.php?f=9&t=12455

If you want to try and reset it manually, the default settings to change the depth/size of the HUD are:

GUI_depth = 0.595
zoomed_out_on_startup = 0
3d_window_zoom_out_size = 1.000

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

Post by Trevor » Wed Apr 01, 2020 3:02 pm

A small note regarding HUD.
For VR there are 2 conceptual ways to view the HUD - as a HUD attached to your helmet or as a "hologram" in front of you.

In the first instance the HUD items can only be seen if they lay within your vision - no amount of movement will change that, so the HUD has a "zoom" to bring it into your vision.
In real life, HUD's like this also have their parallax set to infinity so that you can focus on a distant target AND the HUD at the same time without "double image".
You can of course keep the default setting in VRParams.cfg but you will see either 2 targets or 2 reticules when focusing up.

The second instance imagines the HUD as a hologram in front of you. The HUD can be large because you change your view to see round it and see text bigger etc.
As a physical object in the cockpit the distance should be close however you loose the advantage of parallax free target acquisition (see above)

Dynamic Cockpit allows fixed elements to be part of the dash (so you can lean in to read them better) while maintaining parallax free targeting on the remaining HUD (target information and reticule)

Trev

vbodo78
Recruit
Posts: 6
Joined: Sun Jan 05, 2020 6:32 am

Post by vbodo78 » Fri Apr 03, 2020 6:39 am

Thank you for your help, Trevor and blue_max.

I think I've figured it out. I had previously modified my xwingalliance.exe using xwahacker.exe, and had set my in-game resolution too high. I am running an Oculus Quest using Link and had the resolution set to 1920 x 1080. When I followed the SteamVR instructions in VR-README.txt and modified the 800 x 600 resolution to a 114.779 FOV, then set this to the in-game resolution, the HUD was back to a normal size.

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

Post by Trevor » Fri Apr 03, 2020 4:10 pm

What resolution are you using for Quest?

The quest has 1440 × 1600 per eye, so setting an ingame resolution of 640x711 should at least make the UI + HUD render at the right aspect ratio of 1:1.111 (1600/1440)

Blue, cant remember if I've asked this before, but would it be possible to inject these settings at runtime so we could allow users to "Select a device" and have them set up correctly?
I know you said modifying steamvr.settings is not possible since it loads first, but the aspect ratio, HUD resolution (read scale since real scale causes errors above 1.4), and FOV should all be possible to preconfigure on slot 0 (640x480)

Trev

p.s. disregard FOV since you already have a replacement for that :P

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

Post by blue_max » Fri Apr 03, 2020 4:44 pm

Trevor wrote:
Fri Apr 03, 2020 4:10 pm
I know you said modifying steamvr.settings is not possible since it loads first
Well, users can always modify the resolution using SteamVR directly :)
but the aspect ratio, HUD resolution (read scale since real scale causes errors above 1.4), and FOV should all be possible to preconfigure on slot 0 (640x480)
The aspect ratio and FOV are already configurable with hot keys. This information may have already been shared; but where does the game store the HUD scale?

User avatar
JeremyaFr
XWAU Member
Posts: 3921
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Fri Apr 03, 2020 6:09 pm

I think the HUD scale is stored here:

Code: Select all

// V0x006002B8
float s_XwaHudScale = 1.0f;

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

Post by Trevor » Fri Apr 03, 2020 9:23 pm

The aspect ratio and FOV are already configurable with hot keys.
Just checked VRParams.cfg and I think we are talking about different things.

Yes, you account for 3D aspect ratio, but I am talking about 2D (HUD and Text).
2D aspect ratio is calculated ingame by the ingame resolution (so 640x480 = 3:4, 1920x1080 = 16:9, 640x720 = 0.88:1)
Also, the "HUD Scale" used ingame breaks above 1.4 so while in theory 640x720 = 960x1080x1.5 in reality the text breaks and so using 640x720 is better (for VR not monitor - where monitors sharper/smaller text is better)
resolution using SteamVR directly
Again, I did not mean resolution here, but IPD (being a multiple of whatever expansion is used to fill your FOV - in my case "3" turns "TV screen" into" full envelop VR" therefor IPD = 6*3 =18 )

Trev

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

Post by keiranhalcyon7 » Fri Apr 03, 2020 10:15 pm

Trevor wrote:
Fri Apr 03, 2020 9:23 pm
Also, the "HUD Scale" used ingame breaks above 1.4
Actually it breaks at 1.5. It's fine at 1.49 when I play. Under the hood, there are actually only three text sizes, though, so there's no difference in text size between 1.4 and 1.49. The largest text size, which kicks in fully at 1.5+, is what's broken.

Post Reply