Adding a better widescreen support in UT 469
Posted: Sun May 21, 2023 4:31 pm
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.
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.