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

Cho Aniki: Seinaru Protein Densetsu - Misaligned sprites (?) #3552

Open
Silanda opened this issue Jul 16, 2020 · 6 comments
Open

Cho Aniki: Seinaru Protein Densetsu - Misaligned sprites (?) #3552

Silanda opened this issue Jul 16, 2020 · 6 comments

Comments

@Silanda
Copy link

Silanda commented Jul 16, 2020

PCSX2 version:
PCSX2 v1.7.0-dev-125. My build is slightly customized but the customization doesn't touch anything relevant to this game.

PCSX2 options:
The only option that has an impact is the texture offset hardware hack.

Description of the issue:
The text on the high score screen is slightly misaligned. I've noticed what I assume to be related glitches elsewhere, but the high score screen is the most obvious example. This happens in both software and hardware modes, but it is fixable in hardware mode by setting the texture offset hack X value to 2.

gsdx_20200716154813

As an aside, this isn't the only game I've encountered with sprite alignment issues that occur in software mode (the PAL versions of the Strikers 1945 double pack, Assault Suits Vulkan, and Neo Geo Battle Coliseum have minor issues). However the same texture offset value either has no effect there, is unnecessary as the problem only seems to affect software mode, or makes things worse.

How to reproduce the issue:
Let the game run until the high score screen appears

PC specifications:
Ryzen 3700x, Nvidia GTX 1080, Windows 10

GSDump attached:
ChoAnikiHighScore.gs.zip

@hibye8313
Copy link
Contributor

hibye8313 commented Aug 18, 2020

I did a test of the GS dump that was posted and as far as I can see the input texture coordinates given to the GS are bad (they specify a rectangle that overlaps the next character in the font texture). Unless the game itself is buggy, or there is something else I am missing, this might be a core issue instead of a GS issue. I'll try and do some more tests.

Edit: Oops looks like I was wrong. The core is giving the correct texture coordinates but I think the GS is incorrectly rasterizing the sprite by an extra pixel. For example if input coordinates of the sprite are (0, 0) and (10, 10) the GS is incorrectly rasterizing pixels with x = 10 or y = 10 when it should be stopping at x = 9 or y = 9. Can anyone confirm that this is incorrect behavior for the GS? @lightningterror sorry about the hassle of changing tags. I'll try and be more careful in the future before posting my guesses.

@hibye8313
Copy link
Contributor

hibye8313 commented Aug 20, 2020

So it looks like my hypothesis above was completely wrong this seems to actually be a GS issue. The problem here seems to be that the pixels on the right and bottom edges are getting UV coordinates that are exactly between 2 texels (U or V is an exact integer). It seems that OpenGL is rounding the texture coordinate up (so to the right or down) so the sprites are picking up texels from the neighboring font on the right. Does anyone know how to fix this? Maybe there is a way to put a hack in the pixel shader so that a tiny amount is subtracted (or added) from texture coordinate that are exact integers so that is rounds towards the center of the sprite? Anyone have any idea how the actual GS handles the case of UV coordinates that are exact integers?

@lightningterror (and the PCSX2 team) I don't know if you remember me, I submitted a few small changes to the GS a year or so ago. Looks like PCSX2 has come a long since then with a new release and many improvements. If there's any areas I could help with on GS or otherwise, please let me know. Thanks! :)

Edit: if the OP sees this can you please post some other dumps of similar graphical issues? It would be really helpful to figure out what kind of inputs are causing the graphical issues and whether this game is a one-off or it is the same problem for other games.

@lightningterror
Copy link
Contributor

Yeah I remember you, nice to have you back :)

I submitted a few small changes to the GS a year or so ago.

Porting sw blending to dx weren't small changes either.
Maybe you should hop on our discord server since we basically discuss stuff there.
If you're interested I got some jobs that you can take a look at.

@hibye8313
Copy link
Contributor

hibye8313 commented Aug 20, 2020

Thanks for welcoming me back! I kind of left in the middle of things due to personal issues but looks like you didn't need my help much (looking at all the improvements you and the team made to the GS in the past year). Yeah, I'm definitely interested, will see you on discord.

Edit: opened a PR that hopefully fixes this issues and others: #3624. If the OP sees this and could point out other specific issues in games or has dumps would be a huge help. Thanks.

@hibye8313
Copy link
Contributor

@tadanokojin Hi, I have still been working on this issue and the other issue with this game that the OP posted. Refraction mentioned that you might be working on sprite alignment issues as well. One of the ways I have tried to fix this issue is in the PR I posted above (which is a hack because its not pixel accurate), but I have also tried another way with breaking the sprite into 2 or 4 new sprites if the boundary pixels have UV coords that will be incorrectly rounded (I think this way will be pixel accurate in the main part of the sprite) and it seems to work for this GS dump. Do you happen to have any ideas of how I could better test my code before submitting a PR (such as GS dumps, or GamesSaves with known issues)? Any pointers are greatly appreciated.

@JordanTheToaster
Copy link
Member

Fixed in software by #6553

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

No branches or pull requests

4 participants