New High-Res Hyperspace Effect

Need help editing the game? Check for help here!

Moderators: Darksaber, General_Trageton, Forceflow

Post Reply

Re: New High-Res Hyperspace Effect

User avatar
General_Trageton

Fleet Admiral (Administrator)
Posts: 12331
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by General_Trageton » Sat Dec 14, 2019 11:49 am

This looks really great! Amazing work!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's Modding HQ | Blue Phantom Chronicles WIki | My Steam Workshop

Bman
Lieutenant
Posts: 773
Joined: Mon Apr 05, 2004 11:01 pm

Post by Bman » Sat Dec 14, 2019 4:33 pm

Well done guys.
W-I-P: ISD-II, XQ-1 Platform1, (Imp) Escort Carrier, Misc, & TFTC.

User avatar
ual002
Lieutenant JG
Galactic Empire
Posts: 531
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sat Dec 14, 2019 4:51 pm

Fantastic.
For the glory of his majesty Emperor Palpatine! Image Image Image Image

User avatar
ual002
Lieutenant JG
Galactic Empire
Posts: 531
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sat Dec 14, 2019 6:22 pm

Throw up some youtube examples of the turret and everything at its current state. I haven't had the chance to boot up XWA in a while.
For the glory of his majesty Emperor Palpatine! Image Image Image Image

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

Post by keiranhalcyon7 » Sat Dec 14, 2019 7:09 pm

blue_max wrote:
Sat Dec 14, 2019 9:15 am
I forgot who requested this
That was me also; looks like you nailed it! :D

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

Post by blue_max » Sun Dec 15, 2019 6:26 am

ual002 wrote:
Sat Dec 14, 2019 6:22 pm
Throw up some youtube examples of the turret and everything at its current state. I haven't had the chance to boot up XWA in a while.
https://www.youtube.com/watch?v=XVnSaFf ... e=youtu.be

@keiranhalcyon7: I wouldn't say I "nailed it" a 100% since the perspective of the effect is a bit off. This can't be noticed unless the camera moves around; but that needs to be fixed. BTW, does anyone know where XWA stores the current camera matrix? Or the FOV/focal depth? I will probably need that information to fix the perspective of the effect.

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

Post by keiranhalcyon7 » Sun Dec 15, 2019 7:13 am

I think that's the wrong tunnel effect.

I noticed some rather heavy barrel distortion on shadertoy. XWA appears to have some as well, but it's more subtle. Could that be the difference? The distortion levels would need to be matched to look convincing. (FOV too, of course.)

User avatar
ual002
Lieutenant JG
Galactic Empire
Posts: 531
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sun Dec 15, 2019 4:51 pm

Looks good sir. I'm very excited for the future.
For the glory of his majesty Emperor Palpatine! Image Image Image Image

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

Post by blue_max » Sun Dec 15, 2019 8:44 pm

@ual002 Thanks!

@keiranhalcyon7: I double-checked and I think the tunnel is your code. It may look a bit different because I added bloom and maybe the speed is also not exactly the same.

AFAIK there's always some amount of barrel distortion to be expected from the pinhole camera model. In this case I fixed the problem by adjusting what would be the equivalent of the FOV (which also changes how much distortion we see near the edges of the screeen); but I honestly don't understand the values that I ended up using, and I don't like the fact that right now it's trial-and-error. Maybe it's a combination of FOV, HUD scale, in-game aspect ratio and screen aspect ratio?

Does anyone know what the HUD scale is used for? I thought it was only relevant when rendering the HUD, not the 3D content. Also, would anyone know where the game stores HUD scale and FOV? I'm about to publish a preview so I can share this puzzle with you guys :P

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

Post by keiranhalcyon7 » Sun Dec 15, 2019 10:35 pm

Easy way to check: Is that the tunnel with the Perlin noise or the Simplex noise? It looks like the Perlin noise to me.

FOV is a user parameter, so it needs to be read from the game state. The address is 0x91AB6C (four byte integer). I think its meaning is something like "distance of rendered image plane to camera, in pixels", if that makes sense.

HUD scale, as you thought, is only used for the 2d HUD elements. It's a scale factor for the bitmaps, and it's used in an if/else tree to pick between three pre-rendered font sizes.

Rookie_One1
Lieutenant Commander
Rebel Alliance
Posts: 1401
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » Tue Dec 17, 2019 6:32 am

still it's looking good, better than what we had originally in-game
blue_max wrote:
Tue Dec 10, 2019 12:53 am
Could you please elaborate a little bit on this point? I'm using the YT-1300 Corellian Transport from Prologue Mission 2 to test this, and I noticed that the "horizon" is rotated by 90 degrees with respect to the cockpit. Is that what you mean here? If I understand correctly, the turret is the one on top of the YT-1300; but I could be wrong (Is it on the side? Or the bottom?)
Just check how the gun turret is attached to the rest of the ship, technically speaking, when you look at it on how it's installed, from outside versus from inside, the "bottom" of the turret when looking from inside should be pointing toward the front of the ship....at least on the YT-1300 and the YT-2000

That said I don't know enough about OPTing to modify the turret arcs so that it point correctly, someone else will have to do it
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

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

Post by blue_max » Tue Dec 17, 2019 6:46 am

Thanks Rookie_One1! Here's another short clip with a small surprise:

https://www.youtube.com/watch?v=2tUNBIn ... e=youtu.be

@keiranhalcyon7: This is the tunnel with 3D simplex noise and twirl; but I did have to adjust the speed a little bit. It has your fix to avoid the seams too. Thanks for the information! Is the FOV a float value? I've seen xwahacker say things like "83.26" for the FOV. I'll have to check and see what makes sense. In the meantime, I need to write a small tutorial on how to adjust the effect...

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

Post by blue_max » Tue Dec 17, 2019 6:55 am

To fix the hyperspace effect I had to add two parameters: "y_center" and "FOV_scale". The first one moves the effect vertically so it can be aligned with the crosshairs, and the second one is a general "scale". I've also added a debug mode to adjust these values. This is how you they can be adjusted:

Start with y_center. This is what it looks like with y_center set to 0, the center of the effect doesn't match the crosshairs:
hyper_y_center_before.jpg
With a little trial-and-error it can be adjusted vertically with y_center to look like this:
hyper_y_center_after.jpg
You do not have the required permissions to view the files attached to this post.

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

Post by keiranhalcyon7 » Tue Dec 17, 2019 6:56 am

Rookie_One1 wrote:
Tue Dec 17, 2019 6:32 am
Just check how the gun turret is attached to the rest of the ship, technically speaking, when you look at it on how it's installed, from outside versus from inside, the "bottom" of the turret when looking from inside should be pointing toward the front of the ship....at least on the YT-1300 and the YT-2000

That said I don't know enough about OPTing to modify the turret arcs so that it point correctly, someone else will have to do it
To clarify, when you're in a turret on the Corellian transports, the turret mounting is "above" you. In the exterior model, the turret mounting is to the aft. But if you fire "up", you're firing to starboard, not aft.
blue_max wrote:
Tue Dec 17, 2019 6:46 am
@keiranhalcyon7: This is the tunnel with 3D simplex noise and twirl; but I did have to adjust the speed a little bit. It has your fix to avoid the seams too. Thanks for the information! Is the FOV a float value? I've seen xwahacker say things like "83.26" for the FOV. I'll have to check and see what makes sense. In the meantime, I need to write a small tutorial on how to adjust the effect...
The value is an int, such that, I think,

Code: Select all

resolution_height/2/fov_var = tan(real_vertical_fov_radians/2)
In that video, is that mouse look, vr, or other?
Last edited by keiranhalcyon7 on Tue Dec 17, 2019 7:17 am, edited 2 times in total.

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

Post by blue_max » Tue Dec 17, 2019 6:58 am

Next, enable mouse look and move the camera towards the edge of the screen -- any edge. This is what it looks like with "FOV_scale" set to 1.0:
hyper_fov_scale_before.jpg
Again, after a little trial-and-error, the effect matches the crosshairs:
hyper_fov_scale_after.jpg
I hope this is just a temporary thing while I figure out how to adjust these parameters automatically.
You do not have the required permissions to view the files attached to this post.

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

Post by blue_max » Tue Dec 17, 2019 7:03 am

keiranhalcyon7 wrote:
Tue Dec 17, 2019 6:56 am
The value is an int, such that, I think, resolution_height/2/fov_var = tan(real_vertical_fov_radians/2)
Thanks! I'll see if I can make sense of all this with this bit of information.

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

Post by keiranhalcyon7 » Tue Dec 17, 2019 7:17 am

blue_max wrote:
Tue Dec 17, 2019 7:03 am
keiranhalcyon7 wrote:
Tue Dec 17, 2019 6:56 am
The value is an int, such that, I think,

Code: Select all

resolution_height/2/fov_var = tan(real_vertical_fov_radians/2)
Thanks! I'll see if I can make sense of all this with this bit of information.
I'll note that this is different from the formula that reimar used in xwahacker. There, the factor of 1/2 is omitted on the left, resulting in degree values in the 80s, which I've always thought seemed high. With the factor of 1/2, the degree values for the TG resolutions are around 50, which seems more reasonable to me (and also jives with my understanding of the underlying geometry).

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

Post by blue_max » Tue Dec 17, 2019 7:23 am

And here it is, the preview of this effect:

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

To install it, you'll need the VR mod, version 1.0.9 from here:

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

and just overwrite the files from the first ZIP file on top of it. The installer also includes a tweaked version of the cockpit look hook (it is now possible to look around while in hyperspace). Oh, and I've added yet another config file for this effect.

This isn't fully-tested yet and I just noticed one bug a few minutes ago. Also, the effect won't work in any VR mode; but it does work on the regular mode.

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

Post by blue_max » Tue Dec 17, 2019 7:25 am

keiranhalcyon7 wrote:
Tue Dec 17, 2019 7:17 am
I'll note that this is different from the formula that reimar used in xwahacker. There, the factor of 1/2 is omitted on the left, resulting in degree values in the 80s,
Good to know! You just saved me a couple of hours of wondering just what was going on :P

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

Post by Trevor » Tue Dec 17, 2019 11:24 am

keiranhalcyon7 Tue Dec 17, 2019 07:17 wrote: xwahacker. There, the factor of 1/2 is omitted on the left, resulting in degree values in the 80s, which I've always thought seemed high. With the factor of 1/2, the degree values for the TG resolutions are around 50, which seems more reasonable to me
Why does 80 sound high for FOV?

Default FOV for Anim8or is 60, GoldenEye is 75 and the FOV for the Occulus is 110
If you could play XWA in another headset there is even one with an FOV of 180 (ok, that's horizontal FOV which XWA uses vertical which brings that headset back down to the 110 mark)

Trev

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

Post by keiranhalcyon7 » Tue Dec 17, 2019 4:25 pm

I look at the game, and I don't "buy" that I'm getting nearly 90 degrees of vertical fov. Also, the math makes more sense, as I indicated above.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10478
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Dec 17, 2019 7:39 pm

Not tried it yet but it looks great, I'm going to wait for someone to figure out the HUD and Crosshair for 1920x1080 cheers though
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1897
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Dec 17, 2019 8:15 pm

Hello,

Here is the involved variables in the game. I've included a bunch of values that can be used.

In function L0050A7E0:

Code: Select all

int s_XwaFlightScreenWidth (0x0091AD34) = GetSystemMetrics( SM_CXSCREEN );
int s_XwaFlightScreenHeight (0x0091AD3C) = GetSystemMetrics( SM_CYSCREEN );
int s_XwaFlightSurfaceWidth (0x006002B0) = GetSystemMetrics( SM_CXSCREEN );
int s_XwaFlightSurfaceHeight (0x006002B4) = GetSystemMetrics( SM_CYSCREEN );
int s_V0x05FFDB4 = GetSystemMetrics( SM_CXSCREEN );
In function L0050FCB0:

Code: Select all

float s_XwaHudScale (0x006002B8) = (float)GetSystemMetrics( SM_CYSCREEN ) / 600.0f;
int s_V0x091AB6C = (int)( (float)GetSystemMetrics( SM_CYSCREEN ) * 1.0666f + 0.5f );
int s_V0x07B33CC = s_V0x091AB6C / 2;
float s_V0x07D4B78 = s_XwaHudScale * 1.25f;
Replace GetSystemMetrics( SM_CXSCREEN ) and GetSystemMetrics( SM_CYSCREEN ) by the width and height that you want to use.

User avatar
Darksaber

Fleet Admiral (Administrator)
Posts: 10478
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Tue Dec 17, 2019 8:52 pm

lol :D :D :D

Image
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1897
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Dec 17, 2019 9:18 pm

For 1920x1080:

HUD scale:
value: 1080 / 600.0f = 1.8

FOV:
value: 1080 * 1.0666f + 0.5f = 1152
angle: atan(1080 / 1152) * 2 / pi * 180 = 86.3°

Post Reply