5dof support for TrackIR and improved 6dof for VR

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

Moderator: JeremyaFr

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

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

Post by Trevor » Wed Jan 08, 2020 11:40 pm

Not unless someone models the inside of such a ship and you have a room big enough to walk around in.

However, I was going to joke about XWA now having a FPS segment except for the lack of interiors and controlling range.

That would be a fun project actually, could link up some keybinds to move the camera around (a bit like the lean functions currently) however there would be no collision detection or height offset retention (going up or down stairs).

Also, such a project would be well out with the bounds of ddraw and really aught to be its own hook and a whole new system for motion control, view culling (FPS games usually use a system called portals so that only the rooms you can "see" are drawn rather than "all in line of sight") and interaction would be required, whilst maintaining the existing system once back in the cockpit.

Haha, you've got be thinking now about XWB "X-Wing Battlefront" hahaha. Ive totally blown "camera move to see parts of ship" into full AI Combat Flight and Ground.

Trev

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Thu Jan 09, 2020 12:01 am

TheLastStarfighter wrote:
Wed Jan 08, 2020 10:45 pm
This is amazing work. Is it possible to play in a capital ship or at least watch it from a vantage point somewhere inside?
Technically, yes. Currently there are some caveats.

1. It is slow and boring.
2. Your shield cap is huge, but your shield regen is awful.
3. There are currently no (apart from the Vigo and a couple of GT's TBP ships AFAIK) that have bridge models. (I have three ships upcoming and one that needs updated that will, maybe more)
4. None of the capital ships are configured for anything other than auto-fire currently.
4a. All turrets currently can be linked forward to be devastating to a single target and can be exploited and ruin gameplay by making it too easy. Turrets never run out of charge.
5. Capital ships do not currently allow the player to be able to control any turrets like the YT series craft.

All of these issues may be resolvable with a couple hooks, and it could be quite enjoyable if a mission was scripted and played correctly akin to Family Mission 2, gunnery training. This was never an area explored much in the base game.

So at the moment it would not be an enjoyable experience, but I am tinkering around with some larger ships in this capacity and there might be some content coming depending what findings are.

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

Post by keiranhalcyon7 » Thu Jan 09, 2020 5:22 am

Trevor wrote:
Wed Jan 08, 2020 11:40 pm
Also, such a project would be well out with the bounds of ddraw and really ought to be its own hook
Other than the drawing of two stereoscopic images for vr, I think it would not only be feasible, but desirable to encapsulate 6dof into its own hook.

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

Post by blue_max » Thu Jan 09, 2020 6:44 pm

keiranhalcyon7 wrote:
Thu Jan 09, 2020 5:22 am
I think it would not only be feasible, but desirable to encapsulate 6dof into its own hook.
I've moved the positional tracking + yaw/pitch to the Cockpit Look Hook, so this should work with other ddraw versions. Only the Cockpit Roll remains as a hack inside the VR ddraw.

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

Post by blue_max » Wed Jan 15, 2020 2:29 am


User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Thu Jan 16, 2020 9:04 pm

BEAUTIFUL!!!!!!!!!!!!!!!!!!!!! :gold:

Honosuseri
Recruit
Posts: 2
Joined: Mon Jan 20, 2020 10:05 pm

Post by Honosuseri » Wed Jan 22, 2020 10:32 pm

Just wanted to thank you for all your efforts on this VR mod and 6DOF (ditto for all the other mods/modders too of course). You know it's an excellent game and mod, when it's 20+ years old and the new VR mod has my friends more excited to try this than modern games built for VR!

I've really enjoyed trying this out and if you need any help testing/bug hunting do let me know. Thanks again! :D

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

Post by blue_max » Thu Jan 23, 2020 12:30 am

Thanks for your comments, Honosuseri! Just a warning, though: the enhanced 6dof hook above won't work in VR yet because it needs some modifications to ddraw that I haven't published. It will work with TrackIR, though.

I really need to publish the next iteration of ddraw; but I was trying to squeeze the Active Cockpit in it. I guess I can disable AC and just publish what I have right now.

Honosuseri
Recruit
Posts: 2
Joined: Mon Jan 20, 2020 10:05 pm

Post by Honosuseri » Thu Jan 23, 2020 1:39 am

You're welcome and there's no rush. Do what you think is best and release it when you're ready. It would be great if there was ultimately a VR pack with everything needed (the game and craft pack 1.6 aside obviously). So less tech savvy people could enjoy the game as I do now with minimal fuss.

I sadly don't have TrackIR to test that. The Rift S headset ultimately made more financial sense over having 3 monitors and TrackIR...it's more immersive too.

EDIT

I have tried that cockpitlook-1.0.0 hook in VR with xwa_vr_ddraw_d3d11_v1.0.10 see below...
https://www.youtube.com/watch?v=hZ6g50AG__U&t=36s

MamiyaOtaru
Cadet 4th Class
Posts: 18
Joined: Mon Nov 04, 2019 4:17 am

Post by MamiyaOtaru » Thu Jan 23, 2020 11:07 am

trackir pitch and yaw and x/y/z translation working fine and with latest github ddraw. No head roll though. Does that only work with VR?

Wallace
Recruit
Posts: 2
Joined: Wed Jan 22, 2020 12:25 pm

Post by Wallace » Thu Jan 23, 2020 1:15 pm

Does it work in multiplayer?

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

Post by blue_max » Thu Jan 23, 2020 9:04 pm

Cockpit roll is still a hack that I do in ddraw, so you'll need to run the game in VR mode to see that. Sorry, it just looks ugly on regular modes.

The VR mod installer already has the latest version of the CockpitLook hook included. The hook, however, can be used with TrackIR without the VR part, so that's why I also release it as a standalone hook.

I don't know if this works in multiplayer. If you try guys try multiplayer and it crashes, please send me the dump file/crash report and I'll see what I can do.

kennj7132
Cadet 4th Class
Posts: 13
Joined: Mon Jan 27, 2020 10:56 pm

Post by kennj7132 » Tue Jan 28, 2020 7:48 am

Can someone tell what settings they have used for rift s? Fov etc? Only just discovered this whole xwa upgrade community a few days ago and then I found this vr mod, my life will be complete when I get it working perfectly. Cheers

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

Post by blue_max » Tue Jan 28, 2020 6:33 pm

kennj7132 wrote:
Tue Jan 28, 2020 7:48 am
Can someone tell what settings they have used for rift s? Fov etc?
I believe Trevor is probably the leading authority in this area. He shared the following over in the Hyperspace Effect thread a while ago:

"
I would like to share the, as of 1.0.10, most correct settings for Oculus Rift

VRParams

Code: Select all

VR_Mode = SteamVR

;fill the whole view in 3d and 2d (where 2d is like looking at a cinema screen and 3d envelops you
3d_window_size = 3
3d_window_zoom_out_size = 2
; Set the following to 1 to start the HUD in zoomed-out mode:
zoomed_out_on_startup = 1

concourse_window_scale = 20.000

3d_aspect_ratio = 0.800
concourse_aspect_ratio = 1.334

;scale position to match screen scale (if doesn't match your movements are either too slow or too fast)
roll_multiplier = -1.000 ; oculus seems to be inverted
positional_x_multiplier = 3.000
positional_y_multiplier = 3.000
positional_z_multiplier = 3.000
steamvr.vrsettings (program files\steam\config\)

Code: Select all

   "steamvr" : {
      "ipdOffset" : 0.12,
this is the offset in meters from 0.063 default.
we multiply this by 3 to match the screen and position scales

xwingalliance.exe
using xwahacker set res1 to 640x720, Hud Scale 1.0 (don't worry, ddraw renders at desktop resolution, this only sets the "Aspect" ratio to match the oculus (960x1080))
then using a hex editor
at offset 10f432 set the first and second bytes to B4 00 (read as 0x00B4 (180) in little endian) This sets the FOV to 110. (its actually 122 which is derived from (3/2.7)*110 since fullscreen immersion requires a little extra room)

Start and enjoy full vr immersion with correct FOV and 3D feel

Trev
"

kennj7132
Cadet 4th Class
Posts: 13
Joined: Mon Jan 27, 2020 10:56 pm

Post by kennj7132 » Wed Jan 29, 2020 6:25 pm

Wow thanks, not sure if I can figure out the hex editor bit but the rest I should be OK with.
I am on rift s and I am guessing these settings are for a cv1 so I will post my setup here if I get it right. Had it working a lot better last night, still distorted and using the 6dof leaning back and forward seems to move the whole cockpit, again may fix with correct fov setting etc

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

Post by blue_max » Wed Jan 29, 2020 6:40 pm

kennj7132 wrote:
Wed Jan 29, 2020 6:25 pm
I am guessing these settings are for a cv1
That is my recollection as well; but I may be wrong. Feel free to share the details once you figure this out!
using the 6dof leaning back and forward seems to move the whole cockpit
That's probably because I haven't released the 6dof patch for VR yet, so what you're experiencing is probably the positional tracking not working at all. I'll release the new version today, it's almost ready.

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

Post by Trevor » Wed Jan 29, 2020 9:17 pm

kennj7132 wrote:
Wed Jan 29, 2020 6:25 pm
I am guessing these settings are for a cv1
Actually its for the DK2, however the Rift FOV is the same across Dk2 - S.

The Hex part is actually really important, if you cannot do it you will not get the correct "touchable" feel in XWA as you will feel like you are looking through binoculars (everything is too big)

Perhaps this can be made into a patch? (110 degree FOV)

Trev

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

Post by keiranhalcyon7 » Thu Jan 30, 2020 4:55 am

Trevor wrote:
Wed Jan 29, 2020 9:17 pm
kennj7132 wrote:
Wed Jan 29, 2020 6:25 pm
I am guessing these settings are for a cv1
Actually its for the DK2, however the Rift FOV is the same across Dk2 - S.
According to Wikipedia, those three models have different resolutions, with two different aspect ratios:
  • DK2: 960×1080, AR = 8:9
  • CV1: 1080×1200, AR = 9:10
  • S: 1280×1440, AR = 8:9
The CV1 may benefit from a slightly different setting, but the ARs are pretty close, so it may not matter much.
The Hex part is actually really important, if you cannot do it you will not get the correct "touchable" feel in XWA as you will feel like you are looking through binoculars (everything is too big)

Perhaps this can be made into a patch? (110 degree FOV)
You could add this to patcher.xml:

Code: Select all

  <Patch Name ="Set FOV for Oculus Rift (DK2, S) (slot 0, 640x480)">
    <Item Offset="10f432" From="0002" To="B400" />
  </Patch>
-OR-

You could set FOV to 151.9 in xwahacker, which has the same effect. That gives an actual vertical FOV of 127 degrees, horizontal of 121.

I'm not sure what you mean when you talk about 110.

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

Post by Trevor » Thu Jan 30, 2020 9:16 pm

I thought xwa hacker was broken and was a) only half the FOV and b) doesn't allow values above 120...

That's why I had to hex edit, however... can you explain
keiranhalcyon7 wrote:
Thu Jan 30, 2020 4:55 am

You could set FOV to 151.9 in xwahacker, which has the same effect. That gives an actual vertical FOV of 127 degrees, horizontal of 121.

I'm not sure what you mean when you talk about 110.
I calculated that B4 = 121 degrees vertical, am I wrong?

The reason, as I mention in the original post, I use 121 rather than straight 110 is because the edge of the screen is beyond the 110 visible within the rift.
The edge of the screen is "overscanned" to prevent clipping at the edge of the screen for both near-clip frustum clipping (now fixed in new VR with moving camera) and roll.

Trev

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

Post by keiranhalcyon7 » Fri Jan 31, 2020 3:47 am

Re: 110 degrees: Ah, I see.

The correct FOV calculation is FOV = 2*atan((WIDTH or HEIGHT) / 2 / VALUE), with a radians/degrees conversion added if necessary (doing math in a calculator, I just use degrees mode; if you're writing code, you'll likely have to do it explicitly by multiplying or dividing angle values by 180/pi). Noting again that 0xB4 is 180 in decimal, we have:

Code: Select all

Horizontal: 2*atan(640/2/180) = 121.28
Vertical:   2*atan(720/2/180) = 126.87
I'll note that if it seems odd that the vertical FOV is higher than the horizontal FOV, that's just because, unlike monitor aspect ratios, the VR aspect ratios are less than 1 - their heights are greater than their widths.

Xwahacker bases its FOV calculation on the height, and has a bug - it's missing the division by 2 inside the atan(). So to calculate what you need to enter, the formula is:

Code: Select all

2*atan(720/180) = 151.93
You can also do this conversion without knowledge of the actual height:

Code: Select all

2*atan(2*tan(INTENDED_VERTICAL_FOV/2)) = XWAHACKER_FOV
2*atan(2*tan(127/2)) = 152.00
I did not have any trouble entering a value this high, and I verified with a basic hex editor (XVI, in case anyone wants a recommendation) that this results in B4 00 being written to that address.
Last edited by keiranhalcyon7 on Sat Feb 01, 2020 9:56 pm, edited 1 time in total.

kennj7132
Cadet 4th Class
Posts: 13
Joined: Mon Jan 27, 2020 10:56 pm

Post by kennj7132 » Fri Jan 31, 2020 7:16 am

Thanks for all the info gents but could someone just give me a quick guide for best results on my rift-s? Just setting fovs and anyway to avoid the hex editor. I have a top pc so want it to look as good as it possibly can.

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

Post by keiranhalcyon7 » Fri Jan 31, 2020 8:02 am

Based on the prior info from Trev & blue_max, you could try any of these, set using only xwahacker (or set them all, using different slots, and toggle between them in game to test):

Code: Select all

 640 x  720, FOV 151.93, Hud Scale 1.0
 960 × 1080, FOV 151.93, Hud Scale 1.49
1280 × 1440, FOV 151.93, Hud Scale 2.0
These all should look roughly the same; the main difference will be in the text*. Use whichever one is most readable for you.

(*At least, in standard mode. There may be differences in the way the HUD is handled in VR mode that I'm not aware of.)

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

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

Also note, the reason I use 640x720 over 960x1080 is because the HUD and text is easier to read.

ddraw renders at native monitor resolution not at this value, so this sole job is to set aspect ratio and onscreen sprite sizes.

Trev

kennj7132
Cadet 4th Class
Posts: 13
Joined: Mon Jan 27, 2020 10:56 pm

Post by kennj7132 » Sat Feb 01, 2020 10:40 am

Getting there, followed all this and its night and day better but still not right. Using the lowest set tin ngs as Trevor suggested I can read the hud but now everything moves the opposite direction it should, I lean forwards the cockpit moves away from me, I lean left and it thinks I'm leaning right so still difficult to tell what else is not quite right. Is that an easy fix?

Edit. Sorted that by just copying the text onto the config directly as suggested in the read me.

So close to perfect, I still have stretching on the cockpit though.

My guess is this is the hex bit? Where is the patch.Xml to add the code to?

This is so incredible to play this game again all these years later like this. Thank you so much for this, amazing.

If you have missed this guys vr xwing effort it's a real treat with the movie voice overs in, should be great when finished.

http://saltyhash.org/2019/12/13/project ... st-update/

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

Post by keiranhalcyon7 » Sat Feb 01, 2020 10:00 pm

You can ignore the hex bit, if you're seeing the FOV in xwahacker as I described above.

I suspect the cockpit stretching is due to Trevor's "overscan". Providing a screenshot would be helpful. You could try reducing FOV in xwahacker incrementally to see if it improves things.

Post Reply