hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.39k stars 2.19k forks source link

Knights in the Nightmare: Glitching at Transparent Edges of Rotating Sprite #11057

Open TideGear opened 6 years ago

TideGear commented 6 years ago

Hello, I'm playing Knights in the Nightmare (my official PSN EBOOT download), and I've noticed some slight glitching at the edges of a sprite that should be transparent. Here's a savestate... KitN Transparent Fireball Edge Glitching.zip

When the skeletons throw the fireball type projectiles (not the rice-shaped ones), move the analog stick around to dodge them and notice the occasional glitching around what should be a transparent rectangular edge on the sprite.

You can only see a little to the bottom left of the orange fire ball (the faint vertical line) in this screenshot... ulus10539_1 00_0 ...but it is more obvious at times and certain rotation angles.

Any ideas? Thanks!

I'm playing on my Samsung Galaxy S9+ (USA) with v1.5.4-993-gab65c5210.

hrydgard commented 6 years ago

This is one of those typical artifacts you get with resolution upscaling, or very slight misalignment of texture coordinates. Do you see this at 1x render resolution?

TideGear commented 6 years ago

Yup, I'm using 1x render and 1x display.

unknownbrackets commented 6 years ago

Hmm, strange. Does it happen on both OpenGL and Vulkan? Do any of these settings change it?

I think it's probably aniso.

-[Unknown]

TideGear commented 6 years ago

@unknownbrackets I had those all set already except for aniso. Aniso off didn't fix it, but texture filtering set to nearest (not linear) seems to fix it.

Any idea of linear can be fixed?

hrydgard commented 6 years ago

In theory this kind of thing could also be caused by us using the wrong mipmap level, etc, but if it's correct in point sampling it seems likely that we're just some subtexel off, somehow. How is it in our software renderer?

TideGear commented 6 years ago

@hrydgard How do I test with the software renderer?

hrydgard commented 6 years ago

On PC you just enable it in settings. On Android where the setting is hidden (due to it very rarely being desirable and it showed up a lot in crash reports) you can enable it with PPSSPP.ini, by setting SoftwareRenderer = True under [Graphics]. Beware that it's not fast.

TideGear commented 6 years ago

@hrydgard Ok, I can confirm that software rendering still has the glitchy border effect.

Also, I forgot to mention before that the glitching appears in both OpenGL and Vulkan.

TideGear commented 6 years ago

Is there anything else I can do to help with this issue?

hrydgard commented 6 years ago

Well, it's one of those issues where tiny, tiny differences in implementations cause visible differences. Very hard to tell what the root cause is...

unknownbrackets commented 6 years ago

Could you try exporting a GE debugger dump on PC?

To do this, open the game and select Debug -> GE debugger..., then when it's displaying the scene, press Record in the top right. After a second or so, it'll finish and save a trace of the drawing activity.

After that, check the memstick/PSP/SYSTEM/DUMP folder and it'll have created a file named something like "ULES12345_0000.ppdmp". You can zip that and then drag and drop it into a reply here.

-[Unknown]

TideGear commented 6 years ago

@unknownbrackets Sorry for the delay! Here's the dump... KitN DUMP.zip

unknownbrackets commented 6 years ago

It's using wrap S/T, and there's a little bit on the other side of the texture.

The size is basically 1:1, but it's at a slight angle. I'm guessing there's some accuracy difference with the PSP, or maybe it doesn't actually do linear interpolation with wrapping or something.

-[Unknown]

TideGear commented 6 years ago

@unknownbrackets Any idea how to fix it?

hrydgard commented 5 years ago

Might possibly not be 100% fixable without very accurately emulating the rasterization rules of the PSP (something that would require rendering a conservative shape around every triangle, implement the rule and discard pixels outside it, or something like that). Or maybe just a very slight offset is needed in some direction, in framebuffer and/or UV space. Pushing into the future...

TideGear commented 5 years ago

Fair enough. Thanks for keeping on issues like this! If you'd like me to test anything, just say the word.

TideGear commented 1 year ago

Yes, it's still there. Load the save state and you'll see brief, faint, green horizontal lines under the orange fireball.

On Thu, Dec 8, 2022, 8:21 PM benderscruffy @.***> wrote:

@TideGear https://github.com/TideGear is this still a problem ??? i tried the savestate but couldnt see a problem with it

— Reply to this email directly, view it on GitHub https://github.com/hrydgard/ppsspp/issues/11057#issuecomment-1343829111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4ZNQ3B54CZOFBS4S4GI53WMKXURANCNFSM4FAYCJ5Q . You are receiving this because you were mentioned.Message ID: @.***>

unknownbrackets commented 1 year ago

I must not have tested this on a PSP before. I just ran the framedump on a PSP and here's the output for the most recent two: #11057_ULUS10539_knights_nightmare_rot_sprite_edge1 #11057_ULUS10539_knights_nightmare_rot_sprite_edge2

You can see the slight lines there, even in the PSP rendering. It'd probably best to compare with the actual game running on a PSP, to confirm - it could be there's a CPU bug or otherwise, but this may actually just be a bug in the game.

If the game turned off texture wrapping, this wouldn't happen (although it does intentionally use wrapping for some drawing, like the fog.)

-[Unknown]

TideGear commented 1 year ago

Is it possible this old save state is the issue?

On Sat, Dec 10, 2022, 10:12 AM Unknown W. Brackets @.***> wrote:

I must not have tested this on a PSP before. I just ran the framedump on a PSP and here's the output for the most recent two: [image: #11057_ULUS10539_knights_nightmare_rot_sprite_edge1] https://user-images.githubusercontent.com/191233/206869130-4dbee972-9f77-4c28-bd41-aebab4ff0086.png [image: #11057_ULUS10539_knights_nightmare_rot_sprite_edge2] https://user-images.githubusercontent.com/191233/206869137-dbad7f8f-eb75-4f7b-a4f9-7167ed61483b.png

You can see the slight lines there, even in the PSP rendering. It'd probably best to compare with the actual game running on a PSP, to confirm

  • it could be there's a CPU bug or otherwise, but this may actually just be a bug in the game.

If the game turned off texture wrapping, this wouldn't happen (although it does intentionally use wrapping for some drawing, like the fog.)

-[Unknown]

— Reply to this email directly, view it on GitHub https://github.com/hrydgard/ppsspp/issues/11057#issuecomment-1345352660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4ZNQ33O7DXQN3J7LSHTM3WMTBYDANCNFSM4FAYCJ5Q . You are receiving this because you were mentioned.Message ID: @.***>

unknownbrackets commented 1 year ago

Save states can definitely cement problems, so that is possible. But I don't think we've changed anything that would alter the coordinates the game sent for the render, and that's what was replayed on the PSP. It's probably worth trying fresh without the save state, but it probably still happens.

-[Unknown]

hrydgard commented 1 year ago

Given the above I think it's very likely to be a game bug, as a glitch that small can easily be smeared away by the slow LCD of most PSP models, if things are in motion. So it could make sense to just close this.