Adding a better widescreen support in UT 469

Discussions about UT99
Post Reply
Masterkent
Novice
Posts: 18
Joined: Mon Dec 12, 2022 3:19 pm

Adding a better widescreen support in UT 469

Post by Masterkent »

There are at least 3 issues related to playing UT using widescreen monitors with aspect ratio 16:10, 16:9, 21:9, and others which are wider than 4:3.

1) We have to calculate full horizontal FOV for every distinct aspect ratio instead of using the same FOV value for any screen resolution in case if we want to keep the preferred vertical field of view.

2) Changing horizontal FOV to a higher value in order to make it matching the desirable vertical FOV (or the desirable horizontal FOV of the largest inner 4:3 area inside the full viewport) makes our weapons wrongly positioned on the screen and looking bigger than they should be (this issue is not relevant if we hide our weapons completely).

3) The position of weapon's muzzle flash is calculated in a way that makes it obviously wrong in case if either aspect ratio differs from 4:3 or the full horizontal FOV differs from 90 degrees (again, this issue is not relevant if we hide our weapons completely). The size of muzzle flash doesn't scale well depending on FOV either.

There are third-party mods that attempt to solve these issues (FoxWSFix is a well-known example), but I think that an Oldunreal patch for UT could provide a better solution. It was told that fixing FOV-related issues would consume too much time of the Oldunreal dev team, so it's not planned for UT 469d yet. However, I think that we could accelerate the progress on this matter.

My suggested resolution consists of 2 parts:

1) adding new exec function SetNarrowFOV in Engine.PlayerPawn, which would transform 4:3 horizontal FOV to the full horizontal FOV according to the current screen resolution, so, for example, executing console command "SetNarrowFOV 90" would set the standard vertical FOV in case of any widescreen resolution. If the current resolution is 1920x1080, "SetNarrowFOV 90" is equivalent to "FOV 106.260201".

2) adding two globalconfig variables WeaponFOVFix and WeaponFOVScaling in Engine.PlayerPawn, modifying Engine.Inventory.CalcDrawOffset for fixing weapon's draw offset, and modifying Engine.Weapon.RenderOverlays for fixing the position and size of the muzzle flash.

WeaponFOVFix holds an integer value which is one of: 0, 1, 2. It determines the method (mode) of fixing the position of our weapon and its muzzle flash.

0 means that no fix is applied at all, things are drawn as in UT 436. It may be useful for those people who are not happy with the suggested fixes and prefer the original look instead.

1 means that the weapon is drawn like in UT 436, except that 4:3 horizontal FOV is used instead of full horizontal FOV for calculating the resulting weapon position. For instance, if the current resolution is 1920x1080 and the viewport's FOVAngle is set to 106.260201, the weapon will be positioned as if FOVAngle were 90 while using the original UT 436 method. It's nearly what FoxWSFix would do.

2 means that the weapon is placed at its default position (as when using FOV 90 on 4:3) or possibly shifted from such a position closer to the viewport, depending on viewport's FOVAngle and WeaponFOVScaling. The value of WeaponFOVScaling must be 0, 1, or any floating point number between 0 and 1, and it determines how much the weapon is moved towards the viewport from the default position when FOV value becomes higher than normal for the given aspect ratio. When WeaponFOVScaling is 0, the weapon is placed at the default position like in Unreal 1 (its disadvantage is that we can see a gap between the weapon and the nearest screen border when FOV is high); when, WeaponFOVScaling is 1, the weapon is placed close enough to the viewport, so that the odds of appearing of a visible gap between the weapon and the nearest screen border are minimal.

Modes 1 and 2 additionally imply adjustments of position and size of the muzzle flash depending on FOV and making the vertical offset of the muzzle flash independent of the aspect ratio.

Currently, the recommended value of WeaponFOVFix is 2, and the recommended value of WeaponFOVScaling is 0.67.

Note that if you set your 4:3 FOV to 90, you won't notice any influence of changing between modes 1 and 2 or changing WeaponFOVScaling most of the time. This is because the weapon is placed at its default position when using normal FOV. However, you will be able to see the difference when FOV is temporarily changed - e.g. by a VaccumZone or a PressureZone.

In case if you set your main FOV to a value that is higher than the normal one for the current aspect ratio, the difference between modes 1 and 2 becomes visible under regular conditions.

Here are the suggested changes in the code relative to UT 469c:

Engine.Inventory
Engine.Weapon
Engine.PlayerPawn

I also attached a modified Engine.u for UT 469c to this message, so people could test it and possibly give a valuable feedback (it's only for offline game and for testing purposes, hence you should keep a copy of the original Engine.u). The implementation in this Engine.u slightly differs from the code listed above: it defines WeaponFOVFix and WeaponFOVScaling in class Engine.PlayerConfig instead of Engine.PlayerPawn, because I couldn't add these vars in PlayerPawn and keep the modified Engine.u compatible with Engine.dll and Engine.so (this shouldn't be a trouble for OU devs who can recompile Engine.dll and Engine.so).

Therefore, currently, for testing purposes, you can use console commands like "set PlayerConfig WeaponFOVFix 1" or "set PlayerConfig WeaponFOVScaling 0" in order to tweak new settings and check how they affect the look of weapons and muzzle flash.
Attachments
UT469c_Test_WeaponFOVFix_2023-05-23.7z
(310.21 KiB) Downloaded 31 times
Last edited by Masterkent on Fri Jun 02, 2023 12:02 pm, edited 7 times in total.
User avatar
Shrimp
Adept
Posts: 273
Joined: Wed Oct 10, 2018 11:15 am
Location: Australia
Contact:

Re: Adding a better widescreen support in UT 469

Post by Shrimp »

As an ultrawide user, I think this looks pretty great.

I gave it a _very_ brief play with the default WeaponFOVScaling and just messed around with the WeaponFOVFix mode.

Mode 2:
Shot00091.jpg
Mode 0/standard:
Shot00092.jpg
ShrimpWorks
Unreal Archive - preserving over 25 years of user-created content for the Unreal series!
Masterkent
Novice
Posts: 18
Joined: Mon Dec 12, 2022 3:19 pm

Re: Adding a better widescreen support in UT 469

Post by Masterkent »

Some notes about the code.

The current implementation of the fix introduces a new optional parameter Canvas in function Engine.Inventory.CalcDrawOffset.

It's used to pass Canvas in the function, so that CalcDrawOffset could determine aspect ratio of the screen by means of accessing Canvas.SizeX, Canvas.SizeY. As a consequence, the draw offset of any weapon that overrides Engine.Weapon.RenderOverlays without passing Canvas will be determined using the Unreal 1 method (as if WeaponFOVFix were 2 and WeaponFOVScaling were 0).

There are 2 possible alternatives to using Canvas.SizeX and Canvas.SizeY:

1) PlayerPawn(Owner).Player.Console.FrameX, PlayerPawn(Owner).Player.Console.FrameY

- this seems unreliable, because FrameX and FrameY are non-const variables whose value potentially may be changed in custom console classes, so they won't reflect the actual dimensions of the viewport;

2) Parsing the result of ConsoleCommand("GetCurrentRes") which returns the actual screen dimensions in the form <WIDTH>x<HEIGHT> (e.g., 1920x1080)

- this seems to be a bit performance expensive method.

Ideally, there should exist a fast built-in method that would let us retrieve the current screen metrics in context of PlayerPawn or Viewport. If such a feature will be added, we can get rid of using Canvas in CalcDrawOffset and make weapon position adjustments more consistent.   
Auto merged new post submitted 2 minutes later
The fix for muzzle flash also has some limitations. The position of muzzle flash might be perfectly adjusted if weapons defined their 3d offset in the space instead of 2d offset on the screen. Unfortunately, it's not possible to reliably determine how far and in what direction the muzzle flash should be moved when the weapon is shifted by some known vector in 3d space.

The current implementation doesn't try to guess where the muzzle flash should be moved to and doesn't compensate the weapon's shift relative to the default position at all. This is why muzzle flash may look misaligned when using WeaponFOVFix == 1 and a FOV that noticeably differs from normal for the given aspect ratio. On the other hand, when using WeaponFOVFix == 2, the increased distance between the weapon and its muzzle flash shouldn't look silly.

In case if some custom weapon draws its muzzle flash independently of the implementation in Engine.Weapon.RenderOverlays, that muzzle flash will not be altered by the given fixes.    
Auto merged new post submitted 2 hours 11 minutes later
I updated the implementation, so it now uses Console.FrameX/FrameY instead of Canvas.SizeX/SizeY. This solution is temporary; the final implementation should probably use a more reliable method of retrieving the screen width and height.

This change only affects custom non-weapon inventory classes that somehow use CalcDrawOffset and customs weapons which override RenderOverlays where the overriding function replaces the call to CalcDrawOffset. There should be no any difference for the standard UT weapons.
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: Adding a better widescreen support in UT 469

Post by Buggie »

If you not sure what best, possible good idea make it configurable, so user can try different options, if something goes wrong.
At least for beta-test stage.

Also very good idea make this thing switchable, since we already know, not all absolutely good change goes good. Some changes really proper and good, but break some mods, which rely on bad behavior.
So ability return back is usually good thing.
Masterkent
Novice
Posts: 18
Joined: Mon Dec 12, 2022 3:19 pm

Re: Adding a better widescreen support in UT 469

Post by Masterkent »

Added mode 3 for config var WeaponFOVFix: it makes most of your weapons looking the same with any viewport's FOV. Custom weapons that draw themselves independently of the implementation provided in Engine.Weapon.RenderOverlays will be drawn as if using mode 2 (obviously, there should be some fallback, and I think that mode 2 is the best candidate for it) or in their own way if they don't rely on Inventory.CalcDrawOffset.

EDIT: mode 3 is removed from the proposal due to the issue with lighting. It's interesting though as the concept.
User avatar
fudgonaut
Adept
Posts: 363
Joined: Sat Oct 05, 2013 7:20 am
Personal rank: Easy Target
Location: "The Butthole of the World"
Contact:

Re: Adding a better widescreen support in UT 469

Post by fudgonaut »

Thanks for your work on this!

As an ultrawide user I would love to see something like this incoporated as a User-friendly option in a subsequent 469 patch. Monitors with wider aspect ratios are only going to become more common as time goes on....
Masterkent
Novice
Posts: 18
Joined: Mon Dec 12, 2022 3:19 pm

Re: Adding a better widescreen support in UT 469

Post by Masterkent »

The hand on ChainSaw doesn't look good when the weapon is centered or placed on the left:
ChainSaw - center.jpg
ChainSaw - left hand.jpg
This seems to be a flaw in the design of this weapon, and I haven't found a good way to cope with it yet. In B227, I decided to add a client-side option that makes ChainSaw displayed on the right side, disregarding the general weapon handedness. I'm not sure if such a solution may be acceptable in UT 469.   
Auto merged new post submitted 41 minutes later
Right-handed ChainSaw mode also looks bad when a very high aspect ratio is used - for example, 32:9 (such displays really exist).
Buggie
Godlike
Posts: 2698
Joined: Sat Mar 21, 2020 5:32 am

Re: Adding a better widescreen support in UT 469

Post by Buggie »

What about redemeer?

Also what about some custom weapons, which can suffer from same problem?
Masterkent
Novice
Posts: 18
Joined: Mon Dec 12, 2022 3:19 pm

Re: Adding a better widescreen support in UT 469

Post by Masterkent »

Redeemer looks fine for me, but other people potentially may have undesirable clipping due to using a different game renderer and OS video driver, although if such troubles with Redeemer happen with the mode 2, this would imply that the renderer or the driver is messed up.

What makes ChainSaw different from "normal" weapons is that it relies on clipping by the right or the left border of the screen, and if that clipping doesn't take place at some max distance from the center, then the weapon becomes cut by the clipping plane of the viewport.

I don't see any generic cure for such weapons. Maybe they will always look ugly with high w/h aspect ratio and large FOV.
Post Reply