Skip to content
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

Automatically adjust field of view for widescreen aspect ratios #1322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Dec 28, 2021

Inspired by assaultcube/AC#424.

The FOV value is now always interpreted as being a 4:3 horizontal FOV value. It will be automatically scaled for different aspect ratios (which results in a horizontal FOV of ~106.26 degrees on 16:9, for example).

This provides a better out of the box experience for most players, since 16:9 is the norm for gaming nowadays (or even wider on mobile).

Default FOV values were changed to be less extreme at wider aspect ratios.

Preview

/firstpersonfov 90 is used on both screenshots. Aspect ratio is 16:9.

Before

20211228220454

After

20211228220457

Copy link
Member

@qreeves qreeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I have pointed out an issue with the code, I don't know if this is generally a good idea.

Most people who change FOV are attempting to set specific values and this change results in behaviour which is fairly hidden from the user. Most people would probably be left wondering why the values they set aren't properly reflected.

That being said, it should be noted that FOV is already aspect-corrected in Cube 2 and family on the Y-axis, rather than the X-axis as is being done here. I don't know if this was ported to AC but I do know the change was done in the last decade or so, which is after AC forked from Cube 1.

I think if this were to be merged, it'd need to be an optional component, rather than a forced default, but I invite further discussion on the issue.

src/game/game.cpp Outdated Show resolved Hide resolved
The FOV value is now always interpreted as being a 4:3 horizontal FOV
value. It will be automatically scaled for different aspect ratios
(which results in a horizontal FOV of ~106.26 degrees on 16:9,
for example).

This provides a better out of the box experience for most players,
since 16:9 is the norm for gaming nowadays (or even wider on mobile).

Default FOV values were changed to be less extreme at wider aspect ratios.

// automatic FOV adjustment for wide screens
// (horizontal FOV value is always specified for 4:3, but scaled for different aspect ratios)
return atan(tan(resultfov * M_PI / 360.0f) * 0.75f * aspect) * 360.0f / M_PI;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a change that drastically changes the expected behavior of the FOV math, this should be behind an additional variable that enables/disables this. Gate it behind "fovaltaspectcorrect" variable and I think it'll be good to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants