5dof support for TrackIR and improved 6dof for VR

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

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Re: 5dof support for TrackIR and improved 6dof for VR

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Sun Feb 16, 2020 12:45 pm

@Trevor

I appreciate that this is a WIP, I totally understand that, but the mods instructions mention nothing of having to use XWAHacker or anything about correcting the aspect ratio / screen resolution in order to get the mod working. Out of the box, as in the following the provided instructions, results in very bad image warping and that will make users feel sick. I'm happy to tinker in order to get things working but I need to know how to go about doing that in order to dial in some settings. The Index has per eye resolution of 1440x1600, aspect ratio of 9:10, the exact FOV is not disclosed but sits somewhere between 120 - 130. What do I now need to do with this information in order to get this mod to display in my HMD correctly? This information is completely missing from any documentation and is really needed if people are to use or even test the mod. Some other troubleshooting steps I.e what to do if you see black bars on the top and bottom of your screen or the image is stretched would not go amiss either.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Feb 16, 2020 7:25 pm

cylonsurfer wrote:
Sun Feb 16, 2020 12:45 pm
the mods instructions mention nothing of having to use XWAHacker or anything about correcting the aspect ratio / screen resolution
They do, look at the "*** SteamVR Lens Distortion Correction and FOV ***" section in VRParams.cfg. The TL;DR section doesn't mention this; but that's just to get things started (people have complained in the past that my instructions were too long and difficult to follow, they have also requested setup videos and things like that).
in order to get the mod working. Out of the box, as in the following the provided instructions, results in very bad image warping
This only happens for some users. I've never experienced image warping (or at least, nothing as bad as decribed here). I could point you to videos published by users from last year were they were playing with the Vive without trouble. This problem started happening recently and it may have been a firmware/software update, or something else. BTW, did you mention what headset you're using?
I need to know how to go about doing that in order to dial in some settings.
Me too! I only have a PSVR. Things look good to me and I don't own any other headset. Yet, I've been able to fix a number of issues reported by users over the past year, basically coding blind and relying on users to tell me if the fixes I've done actually work. Even now, I'm coding some hotkeys that will enable users to adjust the FOV and stereoscopy in real-time without using xwahacker and without having to do any math. I haven't been able to reproduce the issue and I don't think anyone has posted a video of the problem yet (?) For me, things look good. So, again, I'm coding blind for a problem that I've never seen. If you could volunteer a video or at least a few screenshots, that would help.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Feb 16, 2020 7:34 pm

keiranhalcyon7 wrote:
Sun Feb 16, 2020 8:25 am
Oh, I see! Well... the game was not designed with VR in mind
Yeah, I know; but this game has objects and distances measured in kms/miles (I think), so I thought the focal length would be in the same units. But yeah, looks like the devs made a few optimizations and "baked-in" the conversion factor into the focal length. I can see how that made sense for them too.

@Trevor: I believe what you're talking about is the focal distance, not the focal length. Yet, I must admit that I'm a little rusty on these details too, so it may be the other way around! :P The projection matrices can be computed from the FOV (in radians) or using the focal length. In the end, I think we end up with the same numbers anyway. When I was coding the Active Cockpit I noticed that the center of rotation for the cockpit camera is not the origin, so I thought the focal length would tell me that. However, I can't use that information because my units are in meters, so a distance measured in pixels isn't very useful.

I guess the right way to fix this would be to calibrate the in-game camera using OpenCV or something like that; but that sounds like overkill.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Sun Feb 16, 2020 9:58 pm

cylonsurfer wrote:
Sun Feb 16, 2020 10:14 am
... on a Valve Index?
Ah, Valve Index. It looks like this is a relatively new HMD, that explains why we didn't have problems before.

User avatar
keiranhalcyon7
Ensign
Posts: 380
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Feb 16, 2020 10:27 pm

cylonsurfer wrote:
Sun Feb 16, 2020 10:14 am
Setting a FOV of 150.95 @ 1440 x 1600 in XWAHacker and 3d_aspect_ratio to 1.5095 in VRParams results in an image which doesn't warp when looking left / right but warps a lot while looking up / down
Again: 150.95 is a semi-nonsense value that corrects for a bug in xwahacker. The corresponding actual FOV value is 125.22 degrees. So I'm surprised that setting 3d_aspect_ratio to 1.5095 resulted in any benefit whatsoever.

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

Post by Trevor » Mon Feb 17, 2020 12:26 am

Also, I would like to point out that 1440/1600 = 0.9 and not 1.5095

you should therefor set 3d_aspect_ratio = 0.9 and force an internal res slot to 640x712 (remember this only fixes HUD and text aspect, it does not force resolution)

Trev

User avatar
keiranhalcyon7
Ensign
Posts: 380
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Mon Feb 17, 2020 12:42 am

Oh yeah, that reminded me of the other comment I wanted to make:
Trevor wrote:
Sun Feb 16, 2020 12:22 pm
I also confirmed that there is a visible difference between 640x720x1 and 960x1080x1.49 as the text does in fact break at 1.49 whereas it renders clearly using the former.
Really? That's surprising. Do you mind posting a screenshot of both of those settings?

VanillaEssence
Cadet 4th Class
Posts: 10
Joined: Tue Feb 11, 2020 1:13 am

Post by VanillaEssence » Mon Feb 17, 2020 4:35 am

Cylonsurfer I think you are being unfairly harsh, especially since these guys are being extremely generous in offering support for this mod.

I don’t have access to my pc right now but here’s a video I have saved from a few days ago that kind of shows the warping effect. It’s not a very good example but maybe it’s useful to you guys. You can kinda see it best when I look down at the pedals. It’s more dramatic in the headset but you might be able to see it from this video.

https://youtu.be/mcW6kt36IHk

VanillaEssence
Cadet 4th Class
Posts: 10
Joined: Tue Feb 11, 2020 1:13 am

Post by VanillaEssence » Mon Feb 17, 2020 4:35 am

Cylonsurfer I think you are being unfairly harsh, especially since these guys are being extremely generous in offering support for this mod.

I don’t have access to my pc right now but here’s a video I have saved from a few days ago that kind of shows the warping effect. It’s not a very good example but maybe it’s useful to you guys. You can kinda see it best when I look down at the pedals. It’s more dramatic in the headset but you might be able to see it from this video.

https://youtu.be/mcW6kt36IHk

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Feb 17, 2020 6:38 am

Thanks for posting the video above, VanillaEssence. I've seen it several times; but I'm afraid I'm not sure I understood what distortion you're talking about. I mean, sure, there's some lens distortion around the edges; but that's probably because you're filming the visor's screen -- I don't think you're referring to that. Is there perhaps a SteamVR setting to adjust the strength of the lens correction? If you modified the IPD, then maybe you also need to adjust that? Just guessing here...

Do you think you could perhaps post another video of the screen itself? The screen will display the contents of the left eye, so that may help too.

VanillaEssence
Cadet 4th Class
Posts: 10
Joined: Tue Feb 11, 2020 1:13 am

Post by VanillaEssence » Mon Feb 17, 2020 7:00 am

Sorry it wasn't clear. Here's a recording of the screen: https://youtu.be/l7Pj3qtN2MA . It's still not that obvious from the recording but you should be able to the cockpit is stretching when I move the headset. For example when I move the headset up and down you can see the screens in the cockpit deform and get longer then shorter. This happens no matter what direction I move the headset and is really obvious when one is actually wearing the headset. I'm unaware of any steamvr setting for lens correction and I didn't modify any ipd settings except for the ipd_offset. The Vive has an adjustment knob on the headset which I tried changing while running the game but it did not affect the distortion.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Feb 17, 2020 9:06 am

Thanks VanillaEssence. Yes, I think I can see the distortion you're talking about now: objects stretch when they reach the edges in any direction. I think this is caused by the FOV/focal length.

Don't move anything on your headset/SteamVR anymore. I'm about to publish a new version where you'll be able to adjust the game's FOV in real time using the keyboard. Hopefully, that'll solve the problem.

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Mon Feb 17, 2020 5:50 pm

Ok, so I set a res of 640x712 in XWAHacker with a FOV of 0.9, in VRParams I set 3d_aspect_ratio = 0.9 and 3d_window_size = 1.0. This results in 0 warping, everything looks great other than game is rendered in a small square in my Index. If I raise 3d_window_size above 1.0 the scale goes wrong (i.e feels far too zoomed in) and the warping returns - any ideas?

I tired making a video for you but the warping effect isn't as obvious on a 2d display as it is when wearing the HMD. Much like the video linked to in the post above.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Feb 17, 2020 7:06 pm

Alright, this is a preview of the next release that I've been talking about:

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

@cylonsurfer, @VanillaEssence: In this build, you can adjust the FOV, aspect ratio, scale and stereoscopy using the following keys:

Ctrl + Right/Left: Adjust aspect ratio
Ctrl + Up/Down: Adjust global scale
Ctrl+Shift+Alt + Up/Down: Adjust stereoscopy strength
Ctrl+Shift+Alt + Right/Left: Adjust FOV

The settings are saved automatically. The FOV you set this way will override your FOV from xwahacker. Also bear in mind that this "FOV" is measured in pixels, so it's quite different from the value you'll see in xwahacker anyway. If you want to reset the FOV, just delete teh FOVParams.cfg file.

What I would do is adjust the aspect ratio first. Then adjust the scale so that you don't see black bars on the top and bottom. I usually play with a scale of 2 - 2.5. Once that's done, change the FOV until you remove the distortion you guys have seen. Finally, things might end up looking flat by this point. If so, try adjusting the strength of the stereoscopy -- be careful with your eyes since you might end up with objects really "close to your nose".

I put this together in a bit of a hurry, just so you guys could test it and see if this approach can remove the distortion you've reported. There may be bugs, so feel free to report them.

@cylonsurfer: I usually play with a scale of 2 - 2.5. If it feels too zoomed in, then you can either adjust the FOV again to push things back, or increase the strength of the stereoscopy using the keys above.

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

Post by Trevor » Mon Feb 17, 2020 8:15 pm

VanillaEssence wrote:
Mon Feb 17, 2020 7:00 am
It's still not that obvious from the recording but you should be able to the cockpit is stretching when I move the headset. For example when I move the headset up and down you can see the screens in the cockpit deform and get longer then shorter.
Yeah... hmm... sorry, I cant see whats wrong... It looks fine to me.
cylonsurfer wrote:
Mon Feb 17, 2020 5:50 pm
Ok, so I set a res of 640x712 in XWAHacker with a FOV of 0.9, in VRParams I set 3d_aspect_ratio = 0.9 and 3d_window_size = 1.0. This results in 0 warping, everything looks great other than game is rendered in a small square in my Index. If I raise 3d_window_size above 1.0 the scale goes wrong (i.e feels far too zoomed in) and the warping returns - any ideas?
Ok, let me take each 1 by one...
I set a res of 640x712 in XWAHacker - Yes, this is good
with a FOV of 0.9, - No, FOV is NOT aspect....., FOV is Field of View, i.e., if you look forward, what angle from center can you see in your headset? If you can see half-way between front and right you have an FOV of aprox 90. if you can see all the way to the right, you have a FOV of aprox 180.
in VRParams I set 3d_aspect_ratio = 0.9 - yes, 1440/1600 = 0.9
and 3d_window_size = 1.0. - This should be increased until you have No borders - the final number you get (for me its 3) is the multiplier for IPD and movement.


Thanks for the update Blue

Trev

P.S.
Blue, what is focal_length = 252.000000
FOV is very different to focal_length…
Last edited by Trevor on Mon Feb 17, 2020 9:01 pm, edited 1 time in total.

User avatar
keiranhalcyon7
Ensign
Posts: 380
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Mon Feb 17, 2020 8:59 pm

Trevor wrote:
Mon Feb 17, 2020 8:15 pm
FOV is Field of View, i.e., if you look forward, what angle from center can you see in your headset? If you can see half-way between front and right you have an FOV of aprox 90.
Except note that xwahacker's FOV field is vertical, and is bugged. (Ugh, I should just clone reimar's code, fix it, and send him a pull request.)
if you can see all the way to the right, you have a FOV of aprox 180.
(But note that FOVs >= 180 are impossible in XWA's projection model.)

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Mon Feb 17, 2020 9:44 pm

@blue_max sorry to say this but the new release doesn't seem able to fix the image warping. I've spent about 30 mintutes messing with the hot keys and while I can get eveything looking better overall things are still not right. If I look down it feels like the camera is moving back at the same time and the image is being squashed, if I'm looking at the end point of the cockpits geometry and look left the end is kinda twisting to the right and vice versa - like square becoming a parallelogram, i.e you look left and the right corner moves out, look right and the left corner moves out. The "zoom" options seems to exaggerate this "warping". I can get it looking better as I say, but it appears impossible to dial any setting in that is perfect or even close to it sadly.

@Trevor, the Index's FOV is not officially published, all I know is that it sits somewhere between 120 and 130, no idea on how that is measured, verticle / horizontal FOV etc.

I tried 640x712 @ 120FOV in XWAHacker with 0.9 in VRParams and still got the warping as soon as I zoomed the image in, pretty much the same result with 130FOV in XWAHacker.
Last edited by cylonsurfer on Mon Feb 17, 2020 9:59 pm, edited 2 times in total.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Feb 17, 2020 9:51 pm

Trevor wrote:
Mon Feb 17, 2020 8:15 pm
Blue, what is focal_length = 252.000000
FOV is very different to focal_length…
Yeah, I know. I probably should rename that file in the final release. I used "FOV" because that's what the variable was called above; but it's actually the focal length, in pixels. So 252 would be 252 pixels from the center of the screen.

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Mon Feb 17, 2020 9:57 pm

Just had another mess, it seems that the warping effect is linked to 3d_window_size. If 3d_window_size is left at 1.0 Everything looks fine, no warping, it's just that the image is too small and sits in the center of your HMD. The minute you add any 'Zoom' to make the image fill your HMD bam, the squsihy effect starts, it's like it messes up the distortion profile or something.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Mon Feb 17, 2020 10:03 pm

cylonsurfer wrote:
Mon Feb 17, 2020 9:57 pm
Just had another mess, it seems that the warping effect is linked to 3d_window_size. If 3d_window_size is left at 1.0 Everything looks fine, no warping, it's just that the image is too small and sits in the center of your HMD. The minute you add any 'Zoom' to make the image fill your HMD bam, the squsihy effect starts, it's like it messes up the distortion profile or something.
There's a chance that this might be a bug in my SteamVR code then. In order to stretch the image, I have to scale it somewhere... maybe I'm not scaling it at the right point in the pipeline? I'm going to double-check that part; but I'm going to need some help (and patience) to test the possible fixes.

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Mon Feb 17, 2020 10:10 pm

No problem mate, I'm happy to test this for you while you work it out. I know how these things are, I'm in a similar spot with one of my mods. It doesn't work as it should with WMR HMDs and I don't have one to test with, so I appreciate how hard it is to try and do this kinda thing blind.

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

Post by TheLastStarfighter » Tue Feb 18, 2020 2:51 am

My friend and I tried everything to get the multiplayer working today... I think its dead. Doesn't work for either Steam version or GOG. Seperate issue, I know but man I honestly don't know how you do what you do. To work with 20 year old code and make it work for VR still baffles my mind.

Maybe you can get the website mods to post the download links on the front page instead of having to rifle through the forums to find it.

VanillaEssence
Cadet 4th Class
Posts: 10
Joined: Tue Feb 11, 2020 1:13 am

Post by VanillaEssence » Tue Feb 18, 2020 3:08 am

Thanks. New update is cool and those new hotkeys are extremely useful. Sorry to say that I was still unable to stop the warping. Even with 3d_aspect_ratio set to 1 there was still warping. I guess this has something to do with the Vive's lenses and how SteamVR corrects for the Vive in particular. Sorry I can't be of any more help than just reporting errors.

blue_max
Lieutenant JG
XWAU Member
Posts: 650
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Feb 18, 2020 5:25 am

TheLastStarfighter wrote:
Tue Feb 18, 2020 2:51 am
My friend and I tried everything to get the multiplayer working today... I think its dead.
MP is definitely not dead; but I'm not sure how to help you. Maybe Justagai may know more in this area.

@cylonsurfer: Thanks for your support! I'll try to come up with other possible fixes soon.

@VanillaEssence: No problem, even that information is useful. At least now I know I should look elsewhere.

cylonsurfer
Cadet 4th Class
Posts: 14
Joined: Sun Feb 09, 2020 3:37 pm

Post by cylonsurfer » Tue Feb 18, 2020 3:50 pm

I just tested with my Rift S instead of my Index, same issue with the warping regrettably. Are you using the newest versions of OpenVR with your code? One other thing I noticed it that the warping does not appear when using positional tracking, i.e if I move left, right, back, forward, up or down - it only occurs when rotating my head... which is a little odd as I'd expect incorrect distortion to warp the image in every direction I moved, not just rotation.

Post Reply