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

Add "Advanced Settings" option for rounding texture coordinates from an upscaled internal resolution #2946

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

Conversation

Superstarxalien
Copy link
Contributor

The problem

In order to prevent issues with displaying textures in games with upscaled internal resolutions, DuckStation floors all texture coordinates whenever vertex offset values are multiplied according to the internal resolution upscaling option. To my understanding, at least.

Flooring the texture coordinates doesn't work best for certain games, however. The Crash Bandicoot series of platformers shows jagged edges on the textures of crates whenever the game is upscaled, which is a pretty noticeable error throughout the entire games. For these games, rounding the texture coordinates instead of flooring them provides more "accurate" behavior, in regards to looking the closest to what the game looks like with its internal resolution unchanged.

These are screenshots I took of the games Crash Bandicoot, Crash Bandicoot 2: Cortex Strikes Back, and Crash Bandicoot: WARPED. Beyond the settings mentioned in each screenshot, I also enabled the "True Color" option to disable dithering.


1x Internal Resolution


4x Internal Resolution (texture coordinates are floored, normal DuckStation behavior)


4x Internal Resolution (texture coordinates are rounded, modified DuckStation behavior)

What this commit does

This commit adds an option to force texture coordinates to always be rounded even when the internal resolution of the game is upscaled, found in the "Advanced Settings" category. While it would seem like a no-brainer to force this setting to be enabled for the games that look better with it, such as Crash Bandicoot...

It isn't actually perfect. Errors like these can be fixed simply by enabling PGXP, but, of course, that only benefits the people that wish to play with PGXP on. For such users, however, this option would be a no-brainer to enable.

P.S. the above screenshots were all with PGXP off, the game only looks bad right about there

Thanks to @ManDude for tipping me off on this problem and its (band-aid) solution.

…an upscaled native resolution

As per the title; normal DuckStation behavior is to floor the texture coordinates only when the native resolution is upscaled, instead of rounding them as done when the native resolution is unchanged (due to very blatant errors in some games). This adds a setting to force texture coordinates to be rounded even when the game is upscaled, as this provides a more accurate (relative to what the game looks like in its original resolution) behavior in certain games, such as the Crash Bandicoot series.
@stenzek
Copy link
Owner

stenzek commented Jan 31, 2023

Yeah, that's why I never did myself.. my concern would be that it breaks more than it fixes.

I suppose you could try limiting it to 3D polygons (either by ignoring it for sprites, or using the Z from PGXP).

@Superstarxalien
Copy link
Contributor Author

so after some investigation, the glitch that occurs in crash 1's title screen when enabling this option can probably be fixed

that title screen is made up by Rect16x16TexBlend gpu calls, or in other words rectangle primitives; they're about the only graphics that get really messed up with this option on, so I figure that if the emulator checks for those and sets the texture coordinates to floor on those only it wouldn't be an issue anymore, looking for your thoughts though

@stenzek
Copy link
Owner

stenzek commented Feb 5, 2023

Right, that's why I said "ignoring it for sprites" ;)

@Superstarxalien
Copy link
Contributor Author

well this is certainly how you can tell I'm less experienced in this subject matter lol
yeah I would go for that but I don't really know how to do it, so I wanted to ask you on that

@stenzek stenzek force-pushed the master branch 4 times, most recently from 349fcfa to 6d3f01c Compare May 15, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants