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

xBR 3D shader #12150

Open
bajolzas opened this issue Jul 3, 2019 · 4 comments
Open

xBR 3D shader #12150

bajolzas opened this issue Jul 3, 2019 · 4 comments

Comments

@bajolzas
Copy link

bajolzas commented Jul 3, 2019

Not sure if this is the right place to ask but is it possible to add an xbr 3d shader to ppsspp (in like it filters 2d sprites but ignores 3d polygons)?

I'm using such a shader in pcsxr (.slf/.slv) and it look pretty nice.
For some reason when using a similar named shader in retroarch's beetle it doesnt look that nice, but for ppsspp I cant even find anything that fits that description.

As an example here's a pic:
xbr3d pcsxr

as you can see it filters 2d elements but 3d stuff is unfiltered.
This would greatly help games like Valkyrie Profile or Breath of Fire III, that dont work that well with the texture filter

@LunaMoo
Copy link
Collaborator

LunaMoo commented Jul 3, 2019

We already have texture scaling which does exactly that and PPSSPP was likely one of the first emulators to even have such feature althrough because it's done on CPU for performance reasons it does not apply to constantly modified textures.

Compute shader version of texture scaling might eventually happen, we already have a pull request with proof of concept for such way in #10818 and a slightly different approach in #10393 that will basically be a per-texture shader like I guess the thing you're requesting, but for now texture scaling via cpu is the only thing you can get in PPSSPP.

Not sure if we need this opened since technically we already have pull requests and will to provide something alike in the future, but it probably wasn't ever requested so might as well leave it.

@bajolzas
Copy link
Author

bajolzas commented Jul 3, 2019

it isnt really a per texture scaler, it's a fullscreen shader that simply ignores 3d assets.
more info here:
https://forums.libretro.com/t/filtering-games-with-2d-and-3d-elements/3964

I am asking this because per texture filtering sometimes causes bugs (like in valkyrie profile) and the delay is also kinda distracting in some games.

isnt there a way to convert glsl shader to work on ppsspp? never managed to get how it is supposed to be done...

@unknownbrackets
Copy link
Collaborator

It is possible to apply shaders after rendering is complete, but not "only on 2D elements." It just applies to the final rendered screen. You can already use custom shaders there.

It's unfortunately far less obvious on the PSP whether a game is drawing 2D or 3D than you might think. See #7232 for a technical discussion on this.

Bloom and other things complicate this. Games also mix drawing, and draw things in patches. A lot of these problems are responsible for the issues with higher resolutions you already call out - they are the same problems that make it hard to detect 2D vs 3D drawing.

Imagine that the HP/MP numbers and portrait were drawn in "3D mode" (but for some reason, drawing each 1/4 of the portrait separately), but the names and HP/MP labels were in "2D mode".

Maybe that sounds silly, but that easily might be the result of heuristics about whether graphics are 2D or not in games. All game developers cared about was getting it to look right on the PSP screen. Whatever took less time and money to build, and ran at an acceptable FPS (usually 30 FPS.)

-[Unknown]

@LunaMoo
Copy link
Collaborator

LunaMoo commented Jul 4, 2019

Seems like Hyllian's actually did make it via a post process, however:

  • it's multi pass using potentially up to 8 passes and PPSSPP supports only single pass post process custom shaders aka can't be ported to PPSSPP,
  • likely would only have a chance of even compiling on desktops with modern dedicated gpu's,
  • I guess it tries to detect what to scale via the size of each colored square and in PSP games that will be impossible in majority of games since most problematic games that could use such things would fit into examples where such shader can't work due to diffent "pixel" sizes on different elements,
  • since it's still just a post process the common in PSP games artifacts in 2D elements would still show up when increasing render res and would not be worked around post process as it often is by texture scaling and not increasing it would equal to just using standard xBR based filter,
  • looking closer the results are actually pretty nasty even on the screenshot provided above where it dealt with the skybox and portraits and only partially on other elements leaving them really ugly compared not just to what texture scaling could do, but also to just leaving the original image, there are much better examples in the thread linked like that Ikaruga game, but still not even close to actual texture scaling + for example SSAA.

In the end PPSSPP texture scaling + any other post process like SSAA will look way better in PSP games and even work around some issues soo common when increasing render res in those games, the problems of texture scaling just have to wait for an gpu implementation of it.

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

3 participants