Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ways to counteract sprite glitches caused by upscaling / texture filtering?
10-27-2014, 02:34 AM
Post: #4
RE: Ways to counteract sprite glitches causes by upscaling / texture filtering?
Yes, I think the Phantasy Star Portable 1 and Valhalla Knights problems are the ones you mentioned (I subtly linked to the respective github issues in my post.) I'm not sure about the monster being entirely missing but it sounds right.

As far as 2D vs 3D; we know when the game is drawing without transform enabled, aka "through mode". When not using transform, you're pretty much necessarily drawing 2D (although depth still works.) However, many 2D games actually still draw with transform enabled.

I guess it might potentially be possible to use a separate (1x) buffer for 2D and then composite it onto the primary buffer, but it would be very hard to detect when to do this properly. Some games may switch transform off and on often (I'm pretty sure I've seen it), and doing a blending copy each time would devastate their performance I'm pretty sure. It could be more realistic to do this if one of the game's buffers is used ONLY for 2D, but that's likely only the case with games that do everything with transform off.

The nearest thing specifically probably means this is a texture coordinate problem. Here's a new grid:

+---+---+---+---+ 0
| X | Z | Z | X |
+---+---+---+---+ 1
| Y | A | A | Y |
+---+---+---+---+ 2
| Y | A | A | Y |
+---+---+---+---+ 3
| X | Z | Z | X |
+---+---+---+---+ 4
0   1   2   3   4

Okay, so imagine that every letter above (X, Y, Z, and A) is a different color. Each of these is called a "texel". You'll also notice that I've moved the grid lines (this is actually how positions work too, but I was trying to simplify.)

Each texel is actually at the "center". That is, (0.5, 0.5) is X. If I ask for (1, 1), that's when filtering comes into play. Nearest snaps to (0.5, 0.5). Linear essentially takes (simplifying) X, Y, Z, and A, and blurs them together (each weighted by distance) to give you the final pixel.

At a higher resolution, you end up sampling more from the texture. Imagine that I was only trying to draw the A colors from that grid: I would use (1, 1) - (3, 3) again.

You might think, "hey wait - you're outside the centers you just explained, you made a mistake right?" But, no, I want the "edges" of the texels. The reason is because I'm going to map it to the "edges" of the pixels on screen, and these also have centers. I will end up with center -> center. Perfect.

Except, we get that tricky higher resolution problem again. Before, my (1, 1) - (3, 3) sampled 4 total times (one per each pixel I'm drawing.) But, now I'm drawing 16 pixels (because it's double X and Y.)

Before, the samplings actually happened at each center. At 1.5 and 2.5 on both X and Y. Now they happen four times each for X and Y: 1.25, 1.75, 2.25, 2.75. These still correspond to the centers of the pixels (destination) I'm drawing, but no longer the centers of the texles (source.)

To simplify, I'm only going to talk about X for the moment. Here's a slice of the grid enlarged a bit:

+-------+-------+-------+-------+ 1
|   Y   |   A   |   A   |   Y   |
+-------+-------+-------+-------+ 2
0  0.5  1  1.5  2  2.5  3  3.5  4

At 1x, the first sample was at 1.5 - A. But at 2x, the first sample is 1.25. The pixel center isn't exactly there, we're 25% the way to 0.5. So the resulting color is Y * 25% + A * 75%. Not exactly A.

Nearest "fixes" this, because it forces it to use 1.5. However, it also means that no filtering happens, even if the game looks better at 1x with filtering happening (and quite a few do; the PSP's GPU allows the game to turn on or off filtering and most games request it on for the majority of their drawing.)

Quote:This was one of the main things that caught me off guard when checking out PPSSPP for the first time. When I first started using PPSSPP I was shocked that there was very little setup required to run a game and that most games looked and ran great with default settings.

I don't think it should require detailed setup. In contrast to your experience, I hate the experience in other emulators where I have to second guess every setting, and burn all the free time I had to play the game trying to get the settings to a workable place.

I think it's fine to have enhancements to play with, but I would rather work a little harder to find that awesome default that makes games look beautiful without all the fuss, and have only the necessary options for the rest.

"Half on" is probably like our "Auto". Auto means "let the game decide". Sometimes it's on, sometimes it's off. I'm not sure what the other 4 do but it sounds like they indeed mess with positions of texture coordinates.

Sprite sheets: yes. Many games upload a single texture that is e.g. a tilemap. Then they carefully render from a portion of that texture (see my example above, where the Xs, Ys, and Zs are other tiles.) When the texels from an adjacent tile bleed in, bad things happen. FF4 has a green BG in unused space, iirc, which is why it gets green boxes around certain tiles.

No, there aren't any other options right now worth messing with for this issue. I don't think PPSSPP will ever have a big mess of options but it will likely have more as we run out of ways to fix things for all games.

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Ways to counteract sprite glitches causes by upscaling / texture filtering? - [Unknown] - 10-27-2014 02:34 AM

Forum Jump: