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

Through-mode smart texture filtering #18646

Merged
merged 10 commits into from
Jan 12, 2024
Merged

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Dec 30, 2023

Adds a new option, "Smart 2D texture filtering" to switch to nearest (pixel) filtering mode if we detect "pixel-mapped" graphics in RECT draws.

Helps #18460 (the issue with the idea), though we might want a compat flag to argue that it fixes it.

Things that get fixed when enabled:

Things I hoped would be fixed but are NOT:

Dubious results:

  • Soul Calibur character select turns unfiltered, which doesn't really look much better, though subjective

Untested:

Draft because there are some open questions:

  • Should this be a setting, or another texture filtering mode along with Auto etc? "Smart?". Combine with Auto max quality? A new setting
  • To fix dialog frames in FFI, which are mistakenly filtered causing color fringes, we need to accept 1-dimensional stretching, which isn't true pixel mapping but due to the nature of the situation, it acts like it in this case. (this seems ok, let's keep it)
  • Would like to remove the gstate_c global, maybe

Additional fixes since original PR:

  • Small 2D through-mode triangle draws now get checked. Helps multiple games, including some things the previous method missed in Ridge Racer menus

Possible future expansion:

  • Detect this for multiple through-mode triangles.
  • Detect if projection matrix/viewport params together set up something equivalent to through mode. Outrun has a good example of this, same with Wipeout Pure menus. Then we can use similar logic on top of that.

@hrydgard hrydgard added this to the v1.18.0 milestone Dec 30, 2023
@hrydgard
Copy link
Owner Author

Breaks BoF III due to DetectOffsetTexture not working correctly with unscaled coordinates.

@LunaMoo
Copy link
Collaborator

LunaMoo commented Dec 30, 2023

Due to "dubious results" and the fact it's never soo black and white with people's preferences, it probably shouldn't replace any of the existing filtering types, but it would be fine either as an option or as a new type of filtering combined with auto max.

Naming might be hard, but it could use tooltip for explanation or just use "smart" as you proposed, and be explained somewhere in the docs.

@hrydgard
Copy link
Owner Author

Yeah, probably the best. Just undecided if it should be separate, since it makes sense to combine it both with the old Auto and the newer Auto Max Quality..

@hrydgard hrydgard changed the title Through mode smart filtering Through-mode smart texture filtering Dec 30, 2023
@Narugakuruga
Copy link
Contributor

Narugakuruga commented Jan 1, 2024

We can add a single tick box ☑️.
If this is an extra feature, it can be chosen when auto and auto max quality is selected.
And the tick box is supposed to hide itself when linear and nearest is selected, because it's "forced texture filter"

@Narugakuruga
Copy link
Contributor

Also if this proves to be useful for some 3D games, then auto max quality will benefit from both mipmap generation and smart filtering.

@hrydgard hrydgard marked this pull request as ready for review January 11, 2024 13:48
@hrydgard
Copy link
Owner Author

This no longer breaks BOFIII (after #18653 ). Went ahead and added a new setting to play with.

It's quite nice now in Ridge Racer menus, and many other games too, if you prefer a sharper pixel-perfect look over sometimes-ugly bilinear.

We are not yet able to detect this in situations where games don't use through-mode for their UI, unfortunately.

@hrydgard hrydgard modified the milestones: v1.18.0, v1.17.0 Jan 12, 2024
@hrydgard
Copy link
Owner Author

I feel this is useful enough already that we can include it in 1.17, though plan to improve it further in 1.18.

@hrydgard hrydgard merged commit 971edc6 into master Jan 12, 2024
18 checks passed
@hrydgard hrydgard deleted the through-mode-smart-filtering branch January 12, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants