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

VideoCommon: add graphics mod feature to change texture properties #11235

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

iwubcode
Copy link
Contributor

@iwubcode iwubcode commented Oct 30, 2022

Leverages #11225 . An alternative or replacement for #8645 .

This allows users to set different texture filtering or wrap modes on individual texture targets (or groups). This may be preferable with some textures (or some custom textures).

Before (game's default filtering)

S3HJ08_2022-10-30_14-48-39

After (custom filtering using nearest-neighbor for some textures in the scene)

S3HJ08_2022-10-30_14-48-35

Example for Sengoku Basara 3: Utage

{
	"meta":
	{
		"title": "Texture filtering nearest mod example",
		"author": "iwubcode"
	},
	"groups":
	[
		{
			"name": "Textures",
			"targets": [
				{
					"type": "load_texture",
					"texture_filename": "tex1_256x256_m_da9f840c609474ec_14"
				},
				{
					"type": "load_texture",
					"texture_filename": "tex1_256x256_m_eda20a745e1f12f9_14"
				},
				{
					"type": "load_texture",
					"texture_filename": "tex1_256x256_m_d2ad2572373eee36_14"
				},
				{
					"type": "load_texture",
					"texture_filename": "tex1_256x256_m_950117d9448bb77b_14"
				},
				{
					"type": "load_texture",
					"texture_filename": "tex1_1024x512_m_8cfb7d28ee78826b_14"
				},
				{
					"type": "load_texture",
					"texture_filename": "tex1_512x512_m_d4da6b04161e7ebc_14"
				}
			]

		}
	],
	"features":
	[
		{
			"group": "Textures",
			"action": "set_texture_properties",
			"action_data": {
				"min_filter": "near",
				"mag_filter": "near",
				"mipmap_filter": "near"
			}
		}
	]
}

@iwubcode iwubcode force-pushed the graphics-mod-change-texture-filtering branch from ce9dabf to 985af2d Compare October 30, 2022 20:37
@AdmiralCurtiss
Copy link
Contributor

I still think we should have a global option for this as well, but allowing this to be overridden per-texture is a great idea and probably quite useful.

@iwubcode iwubcode force-pushed the graphics-mod-change-texture-filtering branch from 985af2d to 3df1489 Compare November 6, 2022 19:08
@Phantop
Copy link

Phantop commented Nov 8, 2022

Is it possible to apply a texture filter to all textures when a specific game ID is loaded under this PR? That seems like a useful way to do this on a per-game basis without having to list potentially thousands of textures.

@iwubcode
Copy link
Contributor Author

iwubcode commented Nov 8, 2022

Is it possible to apply a texture filter to all textures when a specific game ID is loaded under this PR? That seems like a useful way to do this on a per-game basis without having to list potentially thousands of textures.

No, wildcarding is not currently possible but it's something I'll consider in the future. It was avoided initially due to performance concerns. Also considering providing a tool for graphics mod creation. A wildcard feature doesn't necessarily fit there either but I will give it more thought.

@Avasam
Copy link
Contributor

Avasam commented Mar 23, 2023

Oh this is gonna be nice for games that mix in pixel art, 2D sprites, etc.

Expanding on the wildcard idea: Some games have "in-game arcades" (retro 2D console emulators like the Atari/NES/SNES/etc) that render each emulated frame as a texture. Being able to mark those specific generated textures as nearest-neighbour upscaled would be valuable.

Edit with an example (ignore the surrounding textures also changing, I just set the Texture Filtering option in Dolphin):

16x Anisotropic Force Nearest

Retro 16x Anisotropic

Retro Force Nearest

@Avasam
Copy link
Contributor

Avasam commented Dec 31, 2023

I can't test atm since I can't find a build due to conflicts. I'll update the demo below to not affect the text "Loading" once I can. For now I'm just forcing Nearest globally.

This mod should improve Pitfall's (GPH and RPF) animated pixel art in the loading screen:

{
	"meta": {
		"title": "Sharp load animation",
		"description": "Renders the load animation pixel art using Force Nearest",
		"author": "Avasam"
	},
	"groups": [
		{
			"name": "Textures",
			"targets": [
				{
					"type": "load_texture",
					"prettyname": "harry_run_01",
					"texture_filename": "tex1_32x32_9c34e129c32715d3_ed33768f2818534e_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_02",
					"texture_filename": "tex1_32x32_6d066cd3588eb33c_52636a5d5e5975f6_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_03",
					"texture_filename": "tex1_32x32_62ef270bc4a9afc1_2e23e74471c73050_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_04",
					"texture_filename": "tex1_32x32_cb59516e19d109f8_52636a5d5e5975f6_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_05",
					"texture_filename": "tex1_32x32_4130408174cebbef_2e23e74471c73050_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_06",
					"texture_filename": "tex1_32x32_6a7ec037e869872b_5dbb709af0585d96_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_07",
					"texture_filename": "tex1_32x32_309f3e07cfda7b75_7076d4a00c05131b_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_08",
					"texture_filename": "tex1_32x32_a0a28397e56a66e6_ed33768f2818534e_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_09",
					"texture_filename": "tex1_32x32_744700800b16808b_2e23e74471c73050_9"
				},
				{
					"type": "load_texture",
					"prettyname": "harry_run_10",
					"texture_filename": "tex1_32x32_7241b51e0ae58f08_2e23e74471c73050_9"
				}
			]
		}
	],
	"features": [
		{
			"group": "Textures",
			"action": "set_texture_properties",
			"action_data": {
				"min_filter": "near",
				"mag_filter": "near"
			}
		}
	]
}

Notice the blurry art and white outline.

16x Anisotropic Force Nearest

Load Anisotropic 16x

Load Force Nearest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants