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

Linear Filtering turns off by itself #2843

Closed
ppmeis opened this issue Jul 19, 2013 · 26 comments
Closed

Linear Filtering turns off by itself #2843

ppmeis opened this issue Jul 19, 2013 · 26 comments

Comments

@ppmeis
Copy link
Contributor

ppmeis commented Jul 19, 2013

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
Copy link
Contributor

@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
Copy link
Contributor Author

ppmeis commented Jul 19, 2013

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

@bagnz0r
Copy link
Contributor

bagnz0r commented Jul 19, 2013

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

@hrydgard
Copy link
Owner

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
Copy link
Contributor

bagnz0r commented Jul 19, 2013

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

@ppmeis
Copy link
Contributor Author

ppmeis commented Jul 19, 2013

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

@ppmeis
Copy link
Contributor Author

ppmeis commented Aug 26, 2013

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

@unknownbrackets
Copy link
Collaborator

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
Copy link
Contributor Author

ppmeis commented Aug 26, 2013

@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
Copy link
Collaborator

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
Copy link
Contributor Author

ppmeis commented Aug 26, 2013

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

@ppmeis
Copy link
Contributor Author

ppmeis commented Sep 8, 2013

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

@unknownbrackets
Copy link
Collaborator

Any changes here?

And to confirm (for the pink issue):

  • You have texture scaling off.
  • You have texture filtering set to auto.
  • You have selected 1x rendering resolution.

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
Copy link
Contributor Author

ppmeis commented Oct 14, 2013

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
Copy link
Contributor Author

ppmeis commented Jan 8, 2014

Tried latest build. Same status.

@ppmeis
Copy link
Contributor Author

ppmeis commented Feb 4, 2014

Latest build tested. Same...

@unknownbrackets
Copy link
Collaborator

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:

  • The texture (on the left)
  • Everything in the Texture tab (make the window as tall as possible and screenshot.)
  • Everything in the Settings tab.

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

-[Unknown]

@ppmeis
Copy link
Contributor Author

ppmeis commented Feb 4, 2014

@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
Copy link
Collaborator

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
Copy link
Owner

hrydgard commented Feb 4, 2014

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
Copy link
Contributor Author

ppmeis commented May 2, 2014

Tried latest build. Both bugs still present.

@ppmeis
Copy link
Contributor Author

ppmeis commented May 12, 2014

Tried latest build. Same status.

@unknownbrackets
Copy link
Collaborator

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
Copy link
Contributor Author

ppmeis commented Jul 1, 2014

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
Copy link
Contributor Author

ppmeis commented Jan 8, 2015

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 unknownbrackets added the Needs hardware testing Testing on a real device needed to determine correct behavior. label Jan 18, 2016
@unknownbrackets unknownbrackets removed the Needs hardware testing Testing on a real device needed to determine correct behavior. label May 14, 2017
@unknownbrackets
Copy link
Collaborator

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]

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

No branches or pull requests

5 participants