-
Notifications
You must be signed in to change notification settings - Fork 67
[ZH] Adjust field of view based on aspect ratio #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[ZH] Adjust field of view based on aspect ratio #518
Conversation
Can I ask why do you get less horizontal FOV on 9:16 compared to 4:3? |
Is the PR only for Zero Hour? Because I see changes in Generals too. |
7651a21
to
cb3225e
Compare
This is done on purpose. The same horizontal FOV will allow seeing almost the entire map in portrait mode. I'm sure this is not an ideal fix for portrait modes, but it should be good enough until a better solution is implemented. One possible solution is to change the angle of the camera towards the terrain for portrait screens.
This PR depends on #460, so the current branch contains one commit from that PR, which includes changes for both Generals and Zero Hour. After merging #460, this PR will have changes for Zero Hour only. |
Out of curiosity, how does it look on 1:1? |
I've made the spreadsheet with original and FOV values and also made the folder with screenshots for different aspect ratios. |
If you are playing on your phone maybe you need this :D |
cb3225e
to
c52e1e8
Compare
c52e1e8
to
74e96ed
Compare
The game doesn't support wide screens well because it has static horizontal field of view (FOV) and static maximum camera height. This means that for every resolution, the camera shows the same horizontal amount of terrain, but the vertical field of view becomes narrower for wider resolutions. So on wide screens, we get a center crop of what is visible on 4:3 resolutions (screenshots below).
To support wider screens, we need to have constant vertical FOV and calculate horizontal FOV based on the screen aspect ratio.
Changes
W3DView::adjustFovToAspectRatio
which is called every time when display resolution changes;adjustFovToAspectRatio
changes camera FOV differently based on aspect ratio:Screenshots
1600 x 1200 - 4:3 (original)
1600 x 900 - 16:9 (original)
1600 x 900 - 16:9 (new logic)
3200 x 900 - 32:9 (new logic)
900 x 1600 - 9:16 (new logic)
Fixes #78
Depends on #460 to make wide resolutions selectable