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

Texture Filtering / Scaling #93

Closed
Papermanzero opened this issue Sep 28, 2016 · 10 comments
Closed

Texture Filtering / Scaling #93

Papermanzero opened this issue Sep 28, 2016 · 10 comments

Comments

@Papermanzero
Copy link

A feature to use predefined filters (bilinear, bicubic, trilinear...) or to use shaders (xbr, smartblur...) for textures. PS1 textures are very pixelated, so it would be a improvement to make those textures more appealing.

@SpaceAgeHero
Copy link

Texture Filtering already exists in core options.

"Texture filtering – This only works with the OpenGL renderer. You can toggle between ‘nearest’ point filtering, 3-point filtering (N64-style quasi-linear filtering), and plain bilinear filtering. Both 3-point filtering and bilinear filtering can impact performance negatively right now, and on average bilinear filtering has less graphics issues than 3-point so far. If you want the best performance, go with ‘nearest’."

@Papermanzero
Copy link
Author

thanks a lot. I oversaw that option. :-)
Would it be possible to enhance this features with the shaders?
I saw PCSX-PGXP screenshots with xBR which were amazing. That's why I am asking.

@saftle
Copy link

saftle commented Sep 28, 2016

When using the HW core, shaders work without problems. You however are limited to GLSL shaders (rather than CG).

@Papermanzero
Copy link
Author

That's the issue. I would like to use the CG (OpenGL) or SLANG (for Vulkan) shaders.
The idea would be to use the cgp or slangp files for the stacking of shaders.
e.g.
https://github.com/libretro/common-shaders/blob/master/xbr/super-xbr-2p.cgp
https://github.com/libretro/slang-shaders/blob/master/xbr/2xBR-lv1-multipass.slangp

The benefit would be to have one filter/scaling database.
So every emulator can use it. Optimisations of shaders can directly be used by every emulator which uses cgp or slangp files as filter/scaling technique.
Therefore it would be beneficial for the beetle saturn core and the mupen core as well.

@saftle
Copy link

saftle commented Sep 28, 2016

Have you used the GLSL shaders? Most CG shaders have been ported to GLSL. So, I don't see the merit in using CG shaders at all. Or are you merely intending a shader type (CG, GLSL, and SLANG) to work on all emulators?

When using the auto-updater, download the GLSL shaders. You will then see all of the XBR shaders that you're looking for.

@hizzlekizzle
Copy link
Contributor

I think what he's asking for is texture filtering with shaders, which is a separate task from the postprocessing that we do with our current batch of shaders. Texture filtering needs to be baked into the core because the postproc that we typically do only has access to the final combined framebuffer rather than the individual textures.

@saftle
Copy link

saftle commented Sep 28, 2016

Oh I see, thanks for the explanation. :)

@simias
Copy link
Collaborator

simias commented Sep 29, 2016

If somebody knows GL shaders and wants to work on improving/adding filters you don't need to know about PlayStation emulation to play with the code, you can just start from the fragment shader code.

The only think that needs careful handling is that texels with a value equal to 0 (as tested by the is_transparent function in the shader) are a special case in the PSX hardware, they're not black as you would expect but rather fully transparent (i.e. the hardware ignores those pixels and doesn't draw them). So when you filter you need to be careful when you encounter those pixels because you could end up introducing an unwanted black color in your interpolation.

For the rest you can just implement your favourite filter in a relatively straightforward manner.

@hizzlekizzle
Copy link
Contributor

That's generally Hyllian's area of expertise, but I may be able to take a stab at it.

@simias
Copy link
Collaborator

simias commented Sep 29, 2016

Please do! Don't hesitate to ping me here or on IRC if you need some precisions or whatever.

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

6 participants