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, DTM, JeremyaFr

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

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

Post by blue_max » Mon Feb 10, 2020 1:36 am

keiranhalcyon7 wrote:
Mon Feb 10, 2020 12:41 am
what does apply_lens_correction = 0 do?
This setting applies a common lens correction algorithm to the images before displaying them. For DirectSBS this is necessary to fix the distortion. In SteamVR this is optional because SteamVR applies its own algorithm. It's an on/off switch; but the parameters themselves can be modified arbitrarily. For SteamVR, I sometimes use negative values to invert the distortion applied by SteamVR; but in my case, SteamVR looks good without this, so I usually leave it off.

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

Post by VanillaEssence » Wed Feb 12, 2020 12:24 am

Continuing on here from Youtube comments as VanillaEssence. I keep getting the "fishbowl effect no matter what I try. Would someone be willing to share their game files for the Steam version for SteamVR if that is not against the rules. I'd like to see if it is just a mistake I have made or just a bizarre seemingly unresolvable issue. thanks

Edit: I have uploaded a video to try to demonstrate whats happening: https://youtu.be/Qv8_Ss9NuJc
It seems I may also not have 6dof enabled, but I'm not really sure with this issue happening. Is that something I need to set up seperately? Thanks

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

Post by blue_max » Wed Feb 12, 2020 6:28 am

VanillaEssence wrote:
Wed Feb 12, 2020 12:24 am
Continuing on here from Youtube comments as VanillaEssence. I keep getting the "fishbowl effect no matter what I try. Would someone be willing to share their game files for the Steam version for SteamVR if that is not against the rules. I'd like to see if it is just a mistake I have made or just a bizarre seemingly unresolvable issue. thanks
Trevor has posted details on how he setup his system for SteamVR, look at some of the previous comments in this thread. If you've got release 1.1.0 (https://www.dropbox.com/s/g4s08oxgtpu67 ... 0.zip?dl=0), I also provided some sample config files for SteamVR inside the package. Look for VRParams.cfg.SteamVR and CockpitLook.cfg.SteamVR. However...
Edit: I have uploaded a video to try to demonstrate whats happening: https://youtu.be/Qv8_Ss9NuJc
To me, this looks like you've got "apply_lens_correction" set to 1 in VRParams.cfg. Before going any further, open VRParams.cfg and make sure "apply_lens_correction" is set to 0 in there. That's probably all you need to do to fix this.
It seems I may also not have 6dof enabled, but I'm not really sure with this issue happening. Is that something I need to set up seperately? Thanks
6dof was enabled in release 1.1.0 and you need to configure the positional tracking in CockpitLookHook.cfg. I provided some sample files for SteamVR in the install package.

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

Post by VanillaEssence » Wed Feb 12, 2020 7:37 am

Thank you I realised I didnt rename my example cfg files which was the problem. I've got everything working okay now exact that the cockpit is too large. I tried trevors hexedit fix but I didn't notice any effect from it. It's possible I did it incorrectly. It seems like I have the same issue as kennj with a small amount of warping happening when I move my head up and down, plus the cockpit of the xwing is very large. Using XWA hacker to change fov does not seem to have an effect of how large things feel. I realise there's probably something very obvious I'm missing here, so sorry for all the questions. Thanks!

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

Post by blue_max » Wed Feb 12, 2020 6:21 pm

VanillaEssence wrote:
Wed Feb 12, 2020 7:37 am
the cockpit of the xwing is very large.
To fix the size of the objects you need to change the IPD in steamvr.settings, like Trevor said:

Code: Select all

"ipdOffset" : 0.12,
The reason things look bigger is that there's a setting to increase the size of the screen so that you don't see black bars at the edges (this setting is also in VRParams.cfg). By changing the IPD you're essentially telling the system that your head is bigger to compensate for this effect.

Regardless of the above, changing the FOV should have some effect too.

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

Post by VanillaEssence » Thu Feb 13, 2020 3:14 am

Thanks missed that in the post. I've set ipdOffset" : 0.111 which seems to be about the right size for the cockpit to me, I guess I'll need to disable this setting when playing other games. The game is pretty playable now and it's an amazing feat you've managed to pull off. However, I'm having an issue of a fairly small amount of warping in the cockpit when I move my head. On my monitor the game looks great and I can't notice any warping but in the headset the cockpit moves slightly when I move my head. For example when I move my head up and down the front xwing console appears to get longer and shorter and say if I look at the left pedal to the right pedal one pedal seems to move closer while the other moves further away. I've only noticed this in the cockpit but I imagine it's happening to everything in the game. Is this expected behaviour as a result of this being a mod or is there something else I have set up incorrectly. I'm using Trevor's settings (I think I've done it correclt but for an HTC Vive if that makes any difference. I feel like I'm so close to having an awesome experience but the warping is just slightly too uncomfortable for me to play. Any assistance would be greatly appreciated :) Thank you.

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

Post by blue_max » Thu Feb 13, 2020 6:32 am

You should not see the warping you're reporting. Trevor doesn't seem to see the warping and I don't either. I think the warping can be fixed with the right FOV setting.

Unfortunately, this is an area I that have very little experience with. If you tried Trevor's settings and that didn't work, then I would suggest that you try different values to see if that changes your experience. Lower down the FOV and see if that helps, if not, go the other way...

The other thing I can do is add another setting in VRParams to stretch the image vertically; but you'll have to wait a little bit for that.

Or maybe I could also try to overwrite the offset in XWA where the FOV is stored and see if that takes effect immediately? I need to search the forum to find where the FOV is located...

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

Post by keiranhalcyon7 » Thu Feb 13, 2020 7:33 am

There are a few variables related to FOV:

0x91AB6C = raw FOV dist (dword int), copy of one of the six values hard-coded with the resolution slots, which are what xwahacker edits
0x8B94CC = FOV dist (float), same value as above
0x8B94BC = cached FOV dist / 512.0 (float), seems to be used for some sprite processing

They seem to respond fine to dynamic changes, so you could probably make hotkeys to increase/decrease the FOV in-flight.
Last edited by keiranhalcyon7 on Fri Feb 14, 2020 12:25 am, edited 1 time in total.

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

Post by VanillaEssence » Thu Feb 13, 2020 8:47 am

Has anyone else tried this mod out with an HTC Vive?

I realised I didnt update my "positional_x_multiplier" settings, so I did to match Trevor's which made the experience more comfortable. It also seems to have have the warping effect less noticeable, however it is still present. The wider FOV seems worse than around 110 or so. I'd like to play around more with the fov settings but its starting to make me feel a little sick. I believe the warping is occurring on both axes.

Update: I just tried to record a video through the lens and realised the video didn't have the problem. I then tried playing with one eye closed and I'm not 100% sure but it seems to fix the issue. So thing is going wrong somewhere either with my eyes or with the 3d right? It's possible that playing with one eye just makes the issue less noticeable but I do think there issue is not there when only seeing one image

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

Post by blue_max » Thu Feb 13, 2020 10:32 pm

Thank you keiranhalcyon7, I can add shortcut keys to change the FOV in real time.

@VanillaEssence: It should be possible to play without seeing this warping issue. I believe it's either the aspect ratio or FOV or a combination of these things. I believe others have been able to play using the Vive; but the warping issue hasn't been reported until recently. BTW: you're not getting a blurry/double image, right? The problem nos is just that the image is warped when looking up and down, correct?

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

Post by VanillaEssence » Fri Feb 14, 2020 12:12 am

I don’t believe it’s a blurry or double image but the warping only appears to be visible with both eyes open. The image is warped when looking any direction not just up and down. Thank you for all your help

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

Post by blue_max » Fri Feb 14, 2020 5:41 pm

VanillaEssence wrote:
Fri Feb 14, 2020 12:12 am
I don’t believe it’s a blurry or double image but the warping only appears to be visible with both eyes open. The image is warped when looking any direction not just up and down. Thank you for all your help
If the SteamVR camera matrices are not used properly, then you get blurry/double images. I just wanted to double-check that this *wasn't* the case here. I'm going to try and add keys to adjust the FOV in real time to see if that makes it easier to debug/fix this issue.

User avatar
Trevor
Ensign
Posts: 301
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Fri Feb 14, 2020 11:25 pm

Clearly Steam ipd is a problem and since it mostly fixed VanillaEssence, I wonder if that is also the problem for kennj7132.

I wonder if you can change that value (assume steam is installed in its default location) before steam loads, and reset on exit?

Changing FOV as part of the ini will be far better than hex editing (or using XWAH) but you will need to be able to select the slot.

Trev

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

Post by blue_max » Fri Feb 14, 2020 11:44 pm

Trevor wrote:
Fri Feb 14, 2020 11:25 pm
I wonder if you can change that value (assume steam is installed in its default location) before steam loads, and reset on exit?
The user may run SteamVR before running XWA, I have no control over that. I haven't seen anything in the API that lets me set the IPD either.
Changing FOV as part of the ini will be far better than hex editing (or using XWAH) but you will need to be able to select the slot.
OK, that sounds good; but what do you mean by "slot" here?

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

Post by keiranhalcyon7 » Fri Feb 14, 2020 11:57 pm

blue_max wrote:
Fri Feb 14, 2020 11:44 pm
Trevor wrote:
Fri Feb 14, 2020 11:25 pm
Changing FOV as part of the ini will be far better than hex editing (or using XWAH) but you will need to be able to select the slot.
OK, that sounds good; but what do you mean by "slot" here?
Trevor - by altering the variables I listed, blue_max can alter the FOV completely independently of the active resolution slot.

Actually, with the modern state of hook development, the slots themselves could be wholely circumvented and replaced with "just use these values from this text file".

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

Post by blue_max » Sat Feb 15, 2020 12:30 am

keiranhalcyon7 wrote:
Fri Feb 14, 2020 11:57 pm
Trevor - by altering the variables I listed, blue_max can alter the FOV completely independently of the active resolution slot.
Oh, the resolution slot? Yeah, I agree with keiranhalcyon here, I just assumed that the FOV would apply regardless of the resolution selected.

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

Post by VanillaEssence » Sat Feb 15, 2020 2:05 am

I did try adjusting the IPD on my headset with the game running using the little knob but it didn’t resolve the issue. I don’t know how to change it outside of steam vr running. Obviously I should say I don’t have this issue on other games.

Edit: I was wrong about this only occurring with one eye open, that just reduced how obvious the distortion was. I'm still playing around with my settings trying to find the sweet spot. Adding VR to games not designed for it is much more complicated than I thought

I think the issue does lie somewhere with the FOV and with 3d_aspect_ratio. Changing these seems to improve it but I'm not able to experiment very much without feeling sick.

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

Post by blue_max » Sat Feb 15, 2020 5:53 am

Well, the good news is that I was able to change the FOV in real time using keiranhalcyon7's offsets. Now I'm going to see if I can repro the issue on my end, and maybe figure out a way to fix this...

@keiranhalcyon7: The FOV distance units are probably in pixels, right? Fun stuff, this here thing...

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

Post by keiranhalcyon7 » Sat Feb 15, 2020 8:14 am

Yep. Pixels. So if you wanted to display the FOVs in degrees in an overlay, you'd have to do some math, using the display width/height and some basic trig.

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

Post by blue_max » Sun Feb 16, 2020 1:12 am

keiranhalcyon7 wrote:
Sat Feb 15, 2020 8:14 am
Yep. Pixels.
Pixels! I'm not that worried about the angle itself; but measuring distance in pixels is a bit weird. If the FOV was specified in millimeters that would help me make a perfect metric reconstruction; but pixels... that's just weird. I mean, how big is a pixel anyway? :P

Anyway, not a showstopper, I'm just going to add another free parameter ("pixel-to-mm-conv-factor" or something like that). This information is very valuable nonetheless, so thanks again, keiranhalcyon7!

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

Post by keiranhalcyon7 » Sun Feb 16, 2020 5:23 am

What? The screen resolution is measured in pixels, so so is the FOV distance. What do mm have to do with anything?

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

Post by blue_max » Sun Feb 16, 2020 7:26 am

keiranhalcyon7 wrote:
Sun Feb 16, 2020 5:23 am
What? The screen resolution is measured in pixels, so so is the FOV distance. What do mm have to do with anything?
In real life, the focal length is usually measured in mm, while FOV is an angle. In this case "FOV distance" seems to be the distance between the image plane and the center of projection, or, in other words, it's actually the focal length.

This doesn't matter for the game, obviously; but it matters in VR because we're supposed to project from metric 3D space into 2D space using fixed projection matrices. These matrices encode a focal length too. This focal length is probably the distance between the retinas in your eyes to the lenses (or similar). That's why -- at least for VR -- it makes no sense to measure the focal length in pixels. If the focal length in the VR projection matrices doesn't match the actual focal length used by the game, then we get artifacts.

Anyway, as I said before, not a showstopper. I was just hoping that the focal length would be in mms so that things would make sense.

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

Post by keiranhalcyon7 » Sun Feb 16, 2020 8:25 am

Oh, I see! Well... the game was not designed with VR in mind - all they were worrying about was an image size, measured in pixels, and perf on the hardware of the day. So in that context, storing the focal length in pixels made the most sense.

Maybe the correct conversion factor is just the pixels per mm of the headset's displays?

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

Post by cylonsurfer » Sun Feb 16, 2020 10:14 am

This still results in the image warping. I create mods myself but I'd never expect my users to jump through all these hoops in order to use my content. How is an end user meant to use this mod and not feel sick? The image warps all over the place and looks very bad. Can someone please let me know what settings are required to use this mod on a Valve Index?

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, additionally the image is stretched horizontially so circles (planets etc) looks squashed and there are visible bars on top / bottom of the screen. If I lower 3d_aspect_ration I can get rid of the streched look but then the image wraping on all axis reappears :kopfwand:

User avatar
Trevor
Ensign
Posts: 301
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Sun Feb 16, 2020 12:22 pm

Ok, so first, the "circles are squished" is only fixed by :
* 3d_aspect_ratio which for Oculus DK2 was 0.8 (technically 0.8888 but the extra digits actually still squished the image) - this fixes "3D" things like planets and hulls
* Internal Resolution of game (eg, 640x720 (matching ratio (0.8888)) - This fixed HUD elements and on-screen text ^1

These 2 attributes MUST match (the concourse_aspect_ratio is separate and allows for the "cinema screen" during concourse only - and should be 1.333 as the image is 640x480)

^1 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.
This still results in the image warping.
Please can someone show a screenshot of this... How can we help if you all keep saying its broken but not showing where yet when we try we have no problem.
My screenshot -to me- looks fine and doesn't warp, therefor without more information I cannot suggest anything else other than my own settings.
I create mods myself but I'd never expect my users to jump through all these hoops in order to use my content. How is an end user meant to use this mod and not feel sick?
This project is still a WIP. Also as Blue stated, there are unfortunately some settings that are unable to be touched at runtime at this time.
As for feeling sick... that isn't really our fault...

In real life, the focal length is usually measured in mm, while FOV is an angle. In this case "FOV distance" seems to be the distance between the image plane and the center of projection, or, in other words, it's actually the focal length.
I thought focal length was the distance to an object in focus (with z values outside that blurring)
Anyway, I was looking at DirectX and the Perspective matrix needs radians so they probably had to do the maths same as us.
It could be that in early 2D the fov was essentially the resolution of the near plane (eg, near plane 200x150, far plane 640x480) and with a fixed z depth you essentially get a 45 degree pyramid (giving 90 degrees fov)
Although honestly it seems more work to keep the old code than to simply replace it with a radian value.

Trev

Post Reply