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.38k stars 2.19k forks source link

Linear Filtering turns off by itself #2843

Closed ppmeis closed 7 years ago

ppmeis commented 11 years ago

During playing Dj Max series, I detect LF turns off by itself when there's any note on the gear, see pics:

LF off, gear empty: lfoff

LF turns on when first note appears: lfon

LF turned off again when the gear is empty again: lfoffagain

It happens in all playing song.

solarmystic commented 11 years ago

@ppmeis

And this is with the Texture Filtering forced to Linear Filtering right?

Setting it to Auto will let the program turn it on and off depending on its own requirements.

ppmeis commented 11 years ago

Yeah I try both cases, normal and auto, same issue.

bagnz0r commented 11 years ago

Strange... I do have DJ MAX 1 at home as well, will take a look at it.

hrydgard commented 11 years ago

It's entirely possible that the game does this on the real hardware too, it's just not noticeable at all at 1x so they never fixed it...

bagnz0r commented 11 years ago

Well, this doesn't happen on the real hardware though @hrydgard http://www.youtube.com/watch?v=sZVWiJZk3Ec

ppmeis commented 11 years ago

Also, about pink transparency issue, Does would be fine to open another thread for that or use this one?

ppmeis commented 11 years ago

I just tried latest build and still happend....both linear filter and pink transparency error...any news?

unknownbrackets commented 11 years ago

Hmm. Does this happen if you select the "software renderer"? (it will be slow.)

A display list dump would help (can be created from the GL renderer, doesn't make a difference): https://github.com/hrydgard/ppsspp/wiki/How-to-create-a-display-list-dump

-[Unknown]

ppmeis commented 11 years ago

@unknownbrackets I tried software rendering but it gets me very glitchy and slow graphics. I will check the display list dump steps. Thanks for the info.

unknownbrackets commented 11 years ago

I realize it's glitchy, I'm more interested in the pink. Also, pretty sure you can savestate from GL, and load state in the software renderer. That way you don't have to deal with the slowness so much.

-[Unknown]

ppmeis commented 11 years ago

I did it...pink is not present at all: image

ppmeis commented 11 years ago

I tried latest build, same pink glitches...and also filter issues.

unknownbrackets commented 11 years ago

Any changes here?

And to confirm (for the pink issue):

And it still happens?

For the filter issues, the same as above, but with texture filtering se to linear, and it still happens?

-[Unknown]

ppmeis commented 11 years ago

Pink issue still present, tried latest build available right now with setting you said: 1

Now the lineal filter issue does not happend with 1x rendering resolution: 2 3

But when I change rendering resolution to 2x, filter issue is still present: 4 5

ppmeis commented 10 years ago

Tried latest build. Same status.

ppmeis commented 10 years ago

Latest build tested. Same...

unknownbrackets commented 10 years ago

Has the software renderer improved?

We have a new awesome feature for these types of problems: the GE debugger. It's only available on Windows currently. If you're using Linux or Mac, you should be able to run PPSSPP in WINE without a hitch for testing.

Anyway, with software renderer OFF, if you go to Debug -> GE Debugger, you'll get a window that allows you to step through the frame. Click "Step Frame" to get to the start of a frame (emulation will pause), and then hit "Step Prim" several times.

The goal is to step until it's about to draw the parts that are pink. It will color these parts red when it's about to draw them. If you miss it, you can click Step Frame again and then Step Prim. If it's taking too long, Step Tex will step by texture changes instead (but we still want to end up with Stpe Prim being the last button you pressed and the areas that will soon be pink highlighted.)

Once you get there, it'd really help to have screenshots of:

This should show exactly what it's trying to do for both the pink and the filtering.

-[Unknown]

ppmeis commented 10 years ago

@unknownbrackets We already talk about pink issue on #3468 and I did same steps. Do you want to test the same for linear filtering?

unknownbrackets commented 10 years ago

Oh, darn, I forgot. Sorry.

So, texture filtering is set to 0604. We don't expect this value.

Currently we support the lower value (4) being from 0 - 7. This is the min value (used when sampling the texture to a smaller area.)

The upper value (6), we treat odd values as linear filtering, and even values as nearest. We ignore any value like 6. However, if we did support 6, it would still be nearest, but it would filter between the nearest two mipmap levels I guess.

Does this value vary when linear filtering is working / is not working? Or is it always 0604 or etc. when things that ought to be filtered are drawn?

Maybe the PSP treats any none zero value in the upper slot as linear.

-[Unknown]

hrydgard commented 10 years ago

That's weird. When the texture unit is "minifying", that is, mapping a large number of texels to a small number of pixels, it makes sense to use mipmapping (use a smaller texture to keep the ratio of texels to pixels around 1, preventing undersampling). When "magnifying" (less texels than pixels), mipmapping becomes meaningless and the only thing you can set is whether to filter nearest or linear. So the game is indeed setting an invalid value.

I would expect the hardware to only bother looking at the bottom bit, it would be surprising to me at least if other values were interpreted as linear filtering.

ppmeis commented 10 years ago

Tried latest build. Both bugs still present.

ppmeis commented 10 years ago

Tried latest build. Same status.

unknownbrackets commented 10 years ago

I wonder if we're forcing nearest because it's doing a color test. Does this happen with 1x? Does force linear make it at least always linear? I think I asked before, but we changed our nearest fallback a bit since then.

Also, does the "Tex filtering" value vary from 0604 when drawing the elements that are sometimes not linear filtered? Like does it use 0104 when they are filtered?

-[Unknown]

ppmeis commented 10 years ago

Issue is still present, but now the pink is gone when there's any note, when a note appears pink you can see pink lines in some borders,:

No filtering, no pink lines image

With notes, filtering is on and pink lines appear: image

ppmeis commented 9 years ago

Tested with latest build. Now pink lines are almost gone when texture scaling is set to 5x xBRZ. Without texture scaling lines are visible like before.

Texture scaling on: ulks46050_00002

Texture scaling off: ulks46050_00003

unknownbrackets commented 7 years ago

As noted in #3468, this is only happening when using resolutions greater than 1x. Linear filtering is bleeding pink in, because the actual pixels are surrounded with pink. Texture scaling is able to workaround this and give more non-pink pixels to filter from. Forcing nearest also resolves this, avoiding pink blending with other colors.

Basically this is a rendering technique that is just not very friendly to higher-resolution scaling. The developer obviously wasn't very concerned with resolutions higher than the PSP was capable of when they implemented this. It's likely alpha blending or something would've been used if they had.

As for the hardware testing - my mipmap testing confirmed that only the lowest bit of the magnify value is used. Bias can cause it to use the minify value, but in no case are the higher bits of magnify used.

The best we can do here is force nearest when colortesting is enabled. However, this makes people unhappy - #4202, #4192, #4217, #4405.

I'm going to close this. I'd recommend using 1x rendering resolution, and possible an upscaling shader.

-[Unknown]