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

[ FF7 ] Add options to filter internal textures like the other PC releases. #754

Open
zaphod77 opened this issue Nov 17, 2024 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@zaphod77
Copy link
Contributor

zaphod77 commented Nov 17, 2024

Summary

Original steam release allows you to apply bilinear filtering to the world map and battle textures. This is impossible in FFNX as near as I can tell.

Basic example

enable_bilinear option exists, but only seems to affect the field models, as per the original pull request (moving trains in the trainyard, for example). The main low definition field images are still shown using nearest neighbor, and the battle textures are blocky still.

Motivation

Provide feature parity with the steam version. currently even with no mods, we need to use FFNX to get proper controller support for xinput controllers, which causes loss of the bilinear filter option that the original game has.

@zaphod77 zaphod77 added the enhancement New feature or request label Nov 17, 2024
@julianxhokaxhiu julianxhokaxhiu changed the title Add field and battle texture filtering options. [ FF7 ] Add field and battle texture filtering options. Nov 17, 2024
@julianxhokaxhiu julianxhokaxhiu added the help wanted Extra attention is needed label Nov 17, 2024
@zaphod77
Copy link
Contributor Author

zaphod77 commented Dec 9, 2024

Okay i figured out what's going on.

the code is deliberately disabling filtering for all internal textures.

if (!internalState.bDoTextureFiltering || !internalState.bIsExternalTexture) flags |= BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT;

This is wrong for the stock battle textures, which were in fact bilinear filtered even in the 98 release.

remove the check for is it an external textures results in OG battle textures being filtered, and the og menu and field begin not filtered. This is exactly what the 98 release did. the windows store version definitely also filters the field textures, and appears to maybe filter the menu text too, though it's not that blurry. icons, including field icons seem unfiltered.

The steam version filters the battle textures when linear filtering is ON and original graphics mode is off. it doesn't seem to filter anything else. if you disable linear filter, or enable original graphics mode, the battle textures become point sampled just like current FFNX does.

So need to add

filter_internal_textures

option, which should default to true, and check it in line 709. this replicates the default behavior of all supported pc releases. ffnx already seems to shut down filtering of internal textures even without this check, except for the battle textures.

@zaphod77 zaphod77 changed the title [ FF7 ] Add field and battle texture filtering options. [ FF7 ] Add options to filter internal textures like the other PC releases. Dec 9, 2024
@zaphod77
Copy link
Contributor Author

zaphod77 commented Dec 9, 2024

so i tried it on ff8 as well, and the code is disabling it for most textures on ff8 anyway, because

// Texture filtering mostly does not work well in FF8

so currently my change only seems to affect final fantasy 7's battle textures. it may also affect the world map textures, if they aren't already filtered, but that's almost certainly the correct result too.

for anyone who wants to test this, simply delete

|| !internalState.bIsExternalTexture

from that line i permalinked, and use a vanilla ff7. If it isn't done by someone else soon, i'll write a pull request. when filtering works in ff8 properly, it should apply there as well.

@zaphod77
Copy link
Contributor Author

zaphod77 commented Dec 10, 2024

so turns out the one line fix seems to makes everything the original cd release filtered get filtered. this includes the prologue background and the main menu background. it truly seems the "don't filter internal textures" rule is flat out incorrect.

That said, it breaks the submarine minigame, and seems to break the menu UNLESS anisotropoic filtering is on. so it seems those spots do need to force no filter. i've yet to find any other original textures that aren't ok to filter.

Holy heck, this new code i have in to replicate the original 98 releases filtering choices is horrible, but it actually works.

After removing the check in renderer.cpp for !bIsExternalTexture, filtering needs to be disabled on the following textures when they are internal only.

  1. mode==MODE_SUBMARINE (to fix the thin lines on resolutions above the original)
  2. mode==MODE_COASTER (to fix the thin lines on resolutions above the original)
  3. menu/btl_win_ (to fix the thin lines on the pointer finger when anisotropic filtering is off at high res)
  4. menu/usfont_ (to fix the thin lines on the text when anisotropic filtering is off)
  5. menu/jafont_ (same, for when jp font support is in)
  6. flevel/hand (fix the red and green arrows when anisotropic is off)

Just disabling filtering in mode_menu prevents the buster sword texture from being filtered, which the original cd release does, so i do have to check for btl_win_ and usfont_

Bike and snowboard minigame are fine, the thin horizontal line on the track was always there. I haven't found any other issues. Field textures remain unfiltered when doing this, like they were in original cd release. skybox in snowboard game also remains unfiltered, but that's correct. battle square seems fine. chocobo racing looks fine.

I should probably add the filter_internal_textures option too.

@zaphod77
Copy link
Contributor Author

Here it is. it's a config option that defaults to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants