Post Reply 
 
Thread Rating:
  • 11 Votes - 4.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom PPSSPP shaders
04-05-2020, 12:15 PM (This post was last modified: 04-05-2020 05:01 PM by guest.r.)
Post: #346
RE: Custom PPSSPP shaders
Been doing some higher res content shading recently and i've come up with a couple of nice (blending and crt mask) shaders for PPSSPP too.

They play quite well with xBRZ enhanced gfx. with 2x or 3x rendering resolution. If you want to tweak the shaders a bit, there are also options (#defines) present.

It's advisable to use mask sizes of 2.0 with 4k etc.

Regular version is as heavy as the 5xbr shader, fast version is almost 2x the speed.

Happy shading!


Attached File(s)
.zip  2xres-crt.zip (Size: 4.76 KB / Downloads: 1217)
Find all posts by this user
Quote this message in a reply
04-21-2020, 01:19 AM
Post: #347
RE: Custom PPSSPP shaders
Hello all.

AA 4.o shader can't work
Error messages like pictures
Is there a solution?

[Image: 4VYdCS6.jpg]

PPSSPP version is 1.9.3
Find all posts by this user
Quote this message in a reply
04-21-2020, 02:57 AM
Post: #348
RE: Custom PPSSPP shaders
Hello all.

AA 4.o not work with PPSSPP
Error messages like pictures
[Image: 4VYdCS6.jpg]
Is there a solution?
Find all posts by this user
Quote this message in a reply
05-18-2020, 12:41 AM (This post was last modified: 05-18-2020 01:09 AM by LunaMoo.)
Post: #349
RE: Custom PPSSPP shaders
It works perfectly fine on my end, althrough maybe you just tried to convert it yourself from some other place and forgot something?

My overgrown shader from the first post now has a new version divided to separate passes since PPSSPP does support multi-pass shaders now, you can just get "LunaVSmoothing.fsh" and edit it to activate AA 4.o then combine with "LunaAll.vsh" and create ini file to set it up for PPSSPP. Next update I'll probably include shader settings, so it all can be changed from PPSSPP UI, I just forget we have shader settings through uniforms now.

Edit: Oh I didn't read actual error, your shader copy doesn't have precision declaration, just adding "precision mediump float;" anywhere on the start of the fsh file should fix that issue. PPSSPP has a few backends and translates post process effects automatically for all of them nowadays so things changed a bit from X years ago.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
06-12-2020, 02:56 PM
Post: #350
RE: Custom PPSSPP shaders
I guess the effects are fairly subtle, but I think it's worth playing around with...
Find all posts by this user
Quote this message in a reply
07-07-2020, 10:36 AM
Post: #351
RE: Custom PPSSPP shaders
How hard would it be to make 16 bit shaders for kicks. It'd be hilarious to play a 16 bit Monster Hunter lol
Find all posts by this user
Quote this message in a reply
07-10-2020, 01:23 AM
Post: #352
RE: Custom PPSSPP shaders
Color reduction is pretty easy, but nothing fun to see there.
Here:
Code:
#define Red 5.0
#define Green 6.0
#define Blue 5.0

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif

uniform sampler2D sampler0;
varying vec2 v_texcoord0;

void main() {
    vec3 color = texture2D(sampler0, v_texcoord0.xy).xyz;
    vec3 color_resolution = vec3(Red, Green, Blue);
    vec3 color_bands = floor(color * color_resolution) / (color_resolution - 1.0);
    gl_FragColor.rgb = min(color_bands, 1.0);
    gl_FragColor.a = 1.0;
}

That should result in standard hi color / 16 bit, you can mess around RGB values pretty easily to get different reduction.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
09-12-2020, 04:10 PM
Post: #353
RE: Custom PPSSPP shaders
this doesn't work for me, i have pasted all the shaders on the shaders folder but my ppsspp doesn't recognize em Sad
(09-29-2013 10:26 PM)LunaMoo Wrote:  It started some time ago with just my fast growning customizable shader for quite a while, but finally we have more than one shader here, so slight reformat was neededSmile.
=======================================================
=======================================================
Here's my own shader which is very customizable and includes:
- FXAA,
- 2 Gauss smoothing filters,
- Guest AA 4.o,
- 5xBR variant A and B scaling shader(also includes Guest.r new version with different variants),
- 4xHQ scaling shader,
- Bloom with "Miku" option for very bright anime games,
- Colored(slight enhance of colors),
- Natural Colors,
- Advanced Cartoon,
- Sharpen,
- Complex Sharpen ,
- Shadeboost(color editing with few presets),
- Gamma correction,
- Vignette with optional reverse effect,
- Simple scanlines with some options, can be horizontal(default) or vertical,
- LCD3x ~ note on mobiles/GLES devices it requires changing "precision mediump" to "precision highp" ~ you can use any text editor to find and replace it inside .fsh file if you want to use it - it might not be supported on all devices through and also might cause everything to be slower that's why I didn't set it by default,
- few debanding methods ~ via blur and noise /dithering(with faster version as well) also includes very heavy bilateral filter now,
- last and frankly least as nobody will use that too oftenTongue, test mode, which allows apply any combination to half screen or animated change from left to right, useful for easy comparison screenshots and tweaking.

Now(shortly before 1.10 release) I also added multi-pass version of this, it'll be potentially more expensive, so I'd recommend removing/skipping passes which you don't use by editing ini files. I grouped certain effects which doesn't have sense to activate together, so activate only one smoothing, sharpening or upscaling effect althrough some other ones can still work together despite being in same pass. I did not used any shader settings yet, because it feels like a lot of work(and also because I forgot about it;p), but probably will in next release. Also take note TEST effects doesn't work yet with this chain shader, they will some time after 1.10 release when [Unknown]'s postshader branch get's merged.

I strongly recommend to customize those shaders for your liking, that's the point of my shader, if PPSSPP could easily mix various effects and allow a noob friendly customization I would more than likely never created it. Example is just so you can see how to add modified version of it to PPSSPP via ini file, check "Changing shader settings" below for more information.

download link ~ last time updated old version: 2017-12-01(y-m-d), new chain version(multi-pass): 2020-05-18
Installation is same as noted below, just extract the 4 files into your ppsspp - assets\shaders\ folder (Android just "...PSP\Shaders" same place where saves are stored).

Included "mobile" versions of the shaders with 2 effects removed(natural colors and LCD3x), those effects weren't even heavy, however I think the only reason vertex shader could fail on mobiles for some people would be caused by passing too many variables to fragment shader and to decrease that, those two effects had to go, I could write them differently, but it would make them slower, with mobiles blah not worth the effort. Especially that it might not help, because I couldn't reproduce any real problem on anything I have.

Latest version should also work with d3d11 by glsl autotranslation(using slang and SPIRV-Cross) ~ which is available starting from v1.3-724-gc355947. Had to correct Guest 4.o AA code to match GLSL standard and added some precision workarounds for simple scanlines and xBR. Vulkan post process shaders are now supported as well ~ from around v1.5.

Also starting from PPSSPP v1.4.2-438-g799c85ebe, a new kind of shaders can be made which are video aware, that is can apply different effects to videos vs in-game, as such I added new preset file with doubled config to make use of it. Warning - this preset is probably too heavy to be used on integrated graphics/low end hardware, I used some very heavy effects together, tested only on fairy powerful desktop;p.

Note: Because my shaders can be used for down/up scaling now, if all you want to use it for is some basic coloring and have very weak gpu that cannot run games in at least your display resolution, you might remove "OutputResolution=True" from each shader in the included ini file. It will break all scaling, as well as scanline effects, but all the simple coloring shaders would still work and end up lighter.
Otherwise I don't recommend changing this, in most situations when used on fairy powerful modern hardware disabling it will probably degrade performance thanks to how downscaling works in ppsspp.

Screenies:
- FFIV video smoothed with new video aware shader
[Image: A0up9KN.jpg]

- same shader
[Image: EpH3gqb.jpg]

(~the text on that screenshot without knowing it's just a Castlevania intro might be a bit confusing;p)


- 10x res 3D game with downscaling shader (Monster Hunter Portable 3rd HD)
[Image: Oh0h66U.jpg]


- as above with less colors added, lots of diagonal edges to see AA effect (Senjou no Valkyria III)
[Image: WGLHMEV.jpg]


- 1x res 2D animation with upscaling shader(Heroes Phantasia)
[Image: m8OCK7j.jpg]

Colors I used might be a bit too deep for most games on default, but hey customization of everything is the point here. Also upscaling shader probably works better on more static objects, but I already posted some screenshots of 5xBR variants in here and wanted to check it on low res animation anyway.
- 5xBR again on more fitting scene/game(PoPoLoCrois)
[Image: yTG0mDX.jpg]


=======================================================

We also now have AA_Shader_v2.0_w_Natural_Vision as well as different versions of this shader + probably some extras ported by naoan which you can get from his post(click).

Comparison screenies:
OFF


ON


=======================================================

You can also find different versions of shaders implemented in PPSSPP by default + probably some extras in this Danyal Zia post.


=======================================================
And Nick001's Arcade Scanlines ~ with bunch of screenshots included, if you're into scanlines that might be something to look at. If you get a bug with shader showing only bottom right corner of the screen, you can try my fix for it from this post.

=======================================================
Before it get's hidden, worth linking also Guest.r Updated shaders which has a bunch of different variants of his AA shader.

=======================================================
=======================================================


Installation: Simply unpack to your "..ppsspp\assets\shaders" folder on Android it should be "...PSP\Shaders".

If the shader comes without it's own ini file you can create an empty ini file in same directory(or just edit an existing oneSmile) and add some more and less important lines inside like in this example based on naoan shader:
Code:
[AAShaderNV]
Name=AA Shader with Natural Vision
Author=naoan
Fragment=nat_aa.fsh
Vertex=nat_aa.vsh
Where:
Code:
[] - is just a tag, set it whatever you like
Name= - whatever you write here will be visible in the list:)
Author= - that's only visible in the ini file I guess, but it's nice to give credits whenever you can or simply to remember who made it when something changes and shader stops working:)
Fragment= - has to be set to fragment shader file
Vertex= - has to be set to vertex shader file

In addition to above, ppsspp shader ini files also can include lines:
Code:
OutputResolution=True   #1
Upscaling=True          #2
RequiresIntSupport=True #3
1) Scales the output down/up to your display/window resolution. Combined with most blurry/aa filters and rendering res above your device screen will result in nice SSAA effect. Also required for upscaling filters.
2) Forces rendering resolution to x1 and screen scaling filter to nearest - settings required by upscaling shaders to work.
3) Enables integer support, most shaders will not require it.

=======================================================
Changing shader settings:
Simply open the .fsh file(any text editor is enough) and mess aroundWink, my shader has a pretty big, but clean and well described config with alot of extra settings which can totally(and easily) change how it looks. Most shaders even if not specially made for modifications, should come with at least some variables that can be easily edited to change how the result looks like.

My own shader, under defines also comes with a list of approximate performance hit so you get the general idea which shaders to avoid on slower hardware. In general most desktops with modern dedicated gpu(including cheap ones) should be fine with everything, it also depends a lot on the rendering resolution used, for example xBR is easily the heaviest effect there, but due to upscaling shaders requiring x1 rendering res it might actually be lighter than some cheap downscaling shader used with x10 render res even through both would in the end output same resolution image.:]

=======================================================


Creating your own shaders:
It's actually easy, it was a black magic for me as well, but turned out they're easy to code and no point on doing it from 0 either, many effects are already free to use on the net, just search for GLSL fragment shaders that doesn't require multiply passes or even to HLSL pixel shaders since they're easy to port, tutorials are also scattered around the net, easy to find something for any level.

Not sure if it works on NVidia gpu's, but you might try AMD GPU Shader Analyzer which helps alot in terms of debugging or even optimizing and allows to simulate shader compilation on many different AMD GPU's on different driver version(how's that useful you ask? Well if a shader works on AMD it'll rather for sure work on Nvidia~actually not as history proven AMD drivers sometimes were even more understanding:|, also many people with older AMD gpu's ~ HD4000 series and older are using 11.11 drivers since they're considered best for PPSSPP - this tool allows to simulate those conditions which are somewhat unforgiving).

Another nice tool(CLI) OpenGL / OpenGL ES Reference Compiler, no gui makes it a bit more bothersome to use, but will in theory detect all problems, in practice it still fails to ensure shaders will work on mobiles, since they have messed up drivers and this only checks if code follows GLSL standard:].

===========================
Due to some recent post in this thread as of 2017-01-29 I have to add that I don't support spreading any of my work done for free especially stuff I really care to be easily customizable by community through some personal beerfund advertisement links and close minded rulesets or on sites that promote those.
Will I bother stopping people from doing it? No, I'm even putting it at the very bottom of the post for most people to not waste time reading this, but I will never support nor promote any of this and if you're normal decent human being you shouldn't either and any average user can do better than whatever they would show on screenshots when begging for fixing something they broke while ripping something they couldn't understand.
===========================
Find all posts by this user
Quote this message in a reply
10-08-2020, 03:32 PM (This post was last modified: 10-09-2020 05:47 PM by LunaMoo.)
Post: #354
RE: Custom PPSSPP shaders
If it doesn't show shaders on the list it means you're missing the ini file(or copied/extracted files to wrong place).

Anyway I just updated my shader pack cutting it to basic effects, many which are already existing in PPSSPP, but my versions allow each effect to be selected for in-game, video or both and all have their settings exposed to PPSSPP UI so you don't have to edit files manually anymore(one exception, I left 2 settings from simple scanline shader since it had too many to work with dynamic UI, that's also why I had to cut the shadeboost to 5 different shaders;c).

There are some limitations like flags are persistent so if you pick a normal upscale shader like xBR or xHQ it will affect all other effects with it's upscale flag, but I added a scalable xBRZ effect which works without that flag. Also SSAA, it can't just be turned off, so if one of the effects has it, all will use it so look out when mixing very heavy effects with SSAA.

Unfortunately different backends have shaders translated automatically and the translation is not perfect, so some of the effects might not compile or appear broken in different backends, don't have time to test everything and find workarounds for those translation errors, 90% of the time some function just doesn't translate or translate poorly and the math has to be written in different way. I believe only 1 effect is currently broken in Vulkan(works fine in OGL) - it's bilateral filtering, in d3d backends it might be worse.

Download is under the same link like always in the first post.

Oh and yeah for those that aren't yet aware PPSSPP does have a chain post process effects now, basically what's known as multi pass shaders, so the results can be much better in some cases. I'd recommend using latest PPSSPP version since the UI and some other things simply DON'T exist in last release version, I did included older versions of the shader pack in the archive, but really just get latest PPSSPP.

Edit: And to spread even more awareness, PPSSPP support it's original(non PSP) CWCheat code types supporting shader modification(and vibration, but xinput/windows only for that soo far) based on game memory, so you could mod the game to trigger some shader effect.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
10-09-2020, 06:52 AM (This post was last modified: 10-11-2020 04:12 AM by iota97.)
Post: #355
RE: Custom PPSSPP shaders
(10-08-2020 03:32 PM)LunaMoo Wrote:  I left 2 settings from simple scanline shader since it had too many to work with dynamic UI, that's also why I had to cut the shadeboost to 5 different shaders

You can have all the setting for the scanline shader in the UI as this:

1) have noGradient as a setting instead of the Game/Video/All one (just output always)
2) Use Visible=false to hide it
3) Make a new shader that have Game/Video/All setting, the previous hidden one as parent and switch between sampler0 and sampler1 to apply or not the effect
4) Making 2 different shader one for horizontal and one for vertical scanline should get the last setting as well

You may make a generic Game/Video/All shader to be applied last in the shader chain by the user, may a bit less user friendly tho'

It's also possible to chain all shaderboost and have only 1 visible with all settings, might give performance problem with 5 shader on mobile, not sure about how much it will cost

I was also wondering as this is way more user and UI friendly now it might be worth just include in PPSSPP with the other default shader?

Edit: actually will not work in some chained situation, woops I always forgot some cases xD
Find all posts by this user
Quote this message in a reply
10-26-2020, 07:52 AM
Post: #356
RE: Custom PPSSPP shaders
You are of course correct!
Find all posts by this user
Quote this message in a reply
01-04-2021, 06:25 AM
Post: #357
RE: Custom PPSSPP shaders
(10-08-2020 03:32 PM)LunaMoo Wrote:  ...PPSSPP does have a chain post-process effects now, basically what's known as multi-pass shaders, so the results can be much better in some cases.

@LunaMoo Is this enabled by default? Does it mean I can select multiple shaders? Sorry, I'm new to this. All I know is to play games. I would like to have better graphics. I am currently playing a very old game Patapon and I'm hoping I could make it more HD-ish.

My current GRAPHICS settings are:
D3D11
Buffered
Auto Frameskip: On (1)
Postprocessing shader: LCD3X (didn't change the below values)
10x PSP
Vsync ON
Hardware Transform ON
Software Skinning ON
Vertex Cache ON
Lazy texture caching ON
Retain changed textures ON
Spline/Bezier quality HIGH
Hardware Tessellation ON

Upscale x5
Hybrid + Bicubic
Anisotropic x16
Texture filtering LINEAR
Screen scaling LINEAR

Others not mentioned are off.

Thank you in advanced!
Find all posts by this user
Quote this message in a reply
01-05-2021, 02:50 AM
Post: #358
RE: Custom PPSSPP shaders
@iota97
I really don't want to repeat one program multiply times just to fit all the settings which would not be used together anyway just to have color modifiers under one selection, through maybe less generic names for each group of color mod would be an improvement.

The same for video awareness, I don't want to run some lenghty code just to later disable it, when I can just skip doing all the work when the selected effects should be disabled. But with that the logic would also change in an undesirable way, I don't want to swith a bunch of starting effects off when in-game starts or video starts, but a different mix of them for video and in-game. With video awareness as separate effect you only could disable some effects which you place before other effects, when for example video starts playing or other way around, you could not make a different selection for both modes. nor use them further in the chain behind effects that should apply to either.




@CapedBaldy
The effects are enabled by default if you choose them from the list, but you need latest PPSSPP version(NOT release version, which is quite outdated currently) to use chain shaders with options. As far as I just tried the LCD one works fine under D3D11 in latest PPSSPP at least on Nvidia's Ampere gpu, in general gaming gpu's should be fine, but can't say that about intel or mobile gpu's since they are really awful by design, in the past I did tried to make as many effects as possible work on everything, but since we now have multiply gpu backends and post process shaders are auto-translated between them, it sometimes is really hard to make it work under all conditions especially when it's the translation that fails.

Code:
Auto Frameskip: On (1)
Why do you even care about maximizing graphics if you start by enabling frameskipping?>.> Even if it's on auto, I'd rather drop other settings than allowing the game I play to skip frames.

Code:
10x PSP
Vsync ON
Resolution above your native display resolution is useless without AA shader and if you have to use Vsync which is pretty awful relict of old times not something people use on modern displays I assume your display isn't some ultra high res one. It also doesn't benefit anything if the shader you want to use simulates old/bad LCD screens. You're making things unnecessary demanding and then using frameskipping to handle that... where's the logic in that?

Code:
Vertex Cache ON
Vertex Cache should be purely performance setting that just as often can reduce it as improve it, all depends on the game, preferably I would keep it off as in the past it was kind of buggy also the biggest difference in performance it does was in games where it made it slower.

Code:
Lazy texture caching ON
Retain changed textures ON
Those are dangerous speedhacks that can glitch out graphics and are really only boosting speed in limited selection of games and really even then only for low end hardware. You should not be using speedhacks especially when trying to obtain quality.


Code:
Hybrid + Bicubic
Imo this is the worst texture scaler available, it's basically xBRZ effect mixed with Bicubic, both of those effects do different things, one clears the graphics, the other blurrs it, you would get similar results by just using standard xBRZ with smaller scaling and it would be much cheaper.
Just because something is on the bottom of the list, doesn't mean it's best, dunno really why we keep 4 texture scaling algorithms when only xBRZ and Bicubic are different, hybrid barely differs from xBRZ and performs horribly when compared, and hybrid + bicubic are really countering each other while being even heavier.
When not using Vulkan you are limited to CPU texture scalers and there's no CPU that can scale textures in real time without ruining frametime causing stutters etc. that's possibly why you used frameskipping, but it's not worth it, especially when you plan to obfuscate everything with an old lcd shader.


Code:
Texture filtering LINEAR
Texture filtering is best left on Auto, forcing it to linear can cause glitches on 2D surfaces that otherwise look fine, either way it's not used on scaled textures.


Code:
Others not mentioned are off.
You should keep settings on default when not knowing what they do, saying not mentioned settings are OFF, can mean you disabled important feature like simulate block transfer.

http://forums.ppsspp.org/showthread.php?tid=6594 - Custom PPSSPP Shaders!
http://forums.ppsspp.org/showthread.php?tid=3590&pid=117172#pid117172 - simple CE scripts to help creating CWCheats,
https://github.com/LunaMoo/PPSSPP_workarounds - CWCheat workarounds.
Find all posts by this user
Quote this message in a reply
02-01-2021, 09:55 PM (This post was last modified: 02-01-2021 09:58 PM by isamiyuu2013.)
Post: #359
RE: Custom PPSSPP shaders
(05-18-2020 12:41 AM)LunaMoo Wrote:  It works perfectly fine on my end, althrough maybe you just tried to convert it yourself from some other place and forgot something?

My overgrown shader from the first post now has a new version divided to separate passes since PPSSPP does support multi-pass shaders now, you can just get "LunaVSmoothing.fsh" and edit it to activate AA 4.o then combine with "LunaAll.vsh" and create ini file to set it up for PPSSPP. Next update I'll probably include shader settings, so it all can be changed from PPSSPP UI, I just forget we have shader settings through uniforms now.

Edit: Oh I didn't read actual error, your shader copy doesn't have precision declaration, just adding "precision mediump float;" anywhere on the start of the fsh file should fix that issue. PPSSPP has a few backends and translates post process effects automatically for all of them nowadays so things changed a bit from X years ago.

Sorry, I always thought no one would reply to me, thank you so much!
According to your method, it is ready to use!
Find all posts by this user
Quote this message in a reply
02-23-2021, 06:16 AM
Post: #360
RE: Custom PPSSPP shaders
for some reason, your current custom shaders doesn't work with the current github build.... makes me wonder what changes did they do....
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: