Page 3 of 7

Re: New High-Res Hyperspace Effect

Posted: Sat Dec 14, 2019 11:49 am
by Vince T
This looks really great! Amazing work!

Re: New High-Res Hyperspace Effect

Posted: Sat Dec 14, 2019 4:33 pm
by Bman
Well done guys.

Re: New High-Res Hyperspace Effect

Posted: Sat Dec 14, 2019 4:51 pm
by ual002
Fantastic.

Re: New High-Res Hyperspace Effect

Posted: Sat Dec 14, 2019 6:22 pm
by ual002
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.

Re: New High-Res Hyperspace Effect

Posted: Sat Dec 14, 2019 7:09 pm
by keiranhalcyon7
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

Re: New High-Res Hyperspace Effect

Posted: Sun Dec 15, 2019 6:26 am
by blue_max
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.

Re: New High-Res Hyperspace Effect

Posted: Sun Dec 15, 2019 7:13 am
by keiranhalcyon7
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.)

Re: New High-Res Hyperspace Effect

Posted: Sun Dec 15, 2019 4:51 pm
by ual002
Looks good sir. I'm very excited for the future.

Re: New High-Res Hyperspace Effect

Posted: Sun Dec 15, 2019 8:44 pm
by blue_max
@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

Re: New High-Res Hyperspace Effect

Posted: Sun Dec 15, 2019 10:35 pm
by keiranhalcyon7
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 6:32 am
by Rookie_One1
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

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 6:46 am
by blue_max
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...

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 6:55 am
by blue_max
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

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 6:56 am
by keiranhalcyon7
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?

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 6:58 am
by blue_max
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 7:03 am
by blue_max
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 7:17 am
by keiranhalcyon7
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).

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 7:23 am
by blue_max
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 7:25 am
by blue_max
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

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 11:24 am
by Trevor
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

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 4:25 pm
by keiranhalcyon7
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 7:39 pm
by Darksaber
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

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 8:15 pm
by JeremyaFr
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.

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 8:52 pm
by Darksaber
lol :D :D :D

Image

Re: New High-Res Hyperspace Effect

Posted: Tue Dec 17, 2019 9:18 pm
by JeremyaFr
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°