Post Reply 
 
Thread Rating:
  • 11 Votes - 4.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom PPSSPP shaders
09-29-2013, 10:26 PM (This post was last modified: 03-07-2024 11:35 PM by LunaMoo.)
Post: #1
Custom PPSSPP shaders
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(now actually divided to separate files since PPSSPP supports multi level shaders and has UI for their options) 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,
- scalable xBRZ pre-setted for Street Fighter Alpha 3 MAX, but usable in any game you set it for - doesn't use upscaling flag so if you need an upscaling for video only while keeping the 3D as sharp as it can be you can try this,
- 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,
- color reduction(by default will not appear to do much, but change RGB to lower values like all 2 or all 4 and you will see some dated graphics),
- pixelate(increases the size of pixels),
- custom aspect ratio(you can change PSP rendered scene to different aspect ratio, for example 4:3),
- 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, even newer chain version with full UI support(no more editing files): 2021-02-26, tiny fixes to 3 effects I tested after making, but before adding UI controls and forgot about video uniform, which broke them heh...: 08.03.2024

Please use PPSSPP v1.10.3-741-g4ccde4848 or newer, older versions doesn't support UI nor test shader in chain.

Installation is same as noted below, just extract all of the 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
SSAA=*integer number* #4
60fps=True  #5
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.
4) It will set up a resolution with a multiply of set value of current window resolution, so let's say you're running the game in x2 window with x2 SSAA it will have full HD resolution, but if you then switch to fullscreen, it will use a resolution used by your monitor multiplied by 2, such super sampling combined with any blurry filter will result in super sampling AA effect.
5) It does the same thing as the option to duplicate frames up to 60, except this was existing much earlier as it's doing so for shaders that include animation without that flag animation speed would be affected by FPS changes in-game which is bad for a post process.

=======================================================
Changing shader settings:

Just use PPSSPP UI, latest version(post release!) allow shader modification directly from graphics settings menu, I even cut my large shader and provided it in separate effects each with it's own settings.Smile

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.
===========================

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-29-2013, 10:38 PM (This post was last modified: 09-29-2013 10:51 PM by TheDax.)
Post: #2
RE: Custom PPSSPP shaders
Here are a couple(default settings in the shader file, PPSSPP settings are 4x Render res, 3x window size, buffered rendering):

Monster Hunter 3rd HD:
(Click/tap for full size):
[Image: iu3r64rXWhcfx.jpg]


(Click/tap for full size):
[Image: iuGqedctWrJiC.jpg]

This thread gives me an idea for a nice menu option on Windows: Under game settings, I could add a new menu popout that lists all of the shaders you have in the shaders directory and lets you pick one..hm..

Maybe I'll add it once we have some more shaders.

It'd probably also be possible to add in a second shader program(e.g. run FXAA and another) to combine more effects(say xBRZ/HQ4x and FXAA).

4GHz AMD 3900X, 32GB DDR4 RAM, 6GB Nvidia RTX 2060, Asus Crosshair 7 Hero (Wifi), Linux
How to ask useful questions: https://web.archive.org/web/20110214010944/http://support.microsoft.com/kb/555375
I'm not Dark_Alex, nor do I claim to be. Our nicknames are merely coincidence.
Find all posts by this user
Quote this message in a reply
09-30-2013, 12:03 AM
Post: #3
RE: Custom PPSSPP shaders
That would be nice, hope we get some people that are good with shaders here, I know only basics^_^, lots to learn and little time/lack of will(;p) to do it.

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-30-2013, 02:24 AM (This post was last modified: 09-30-2013 02:42 AM by GuilhermeGS2.)
Post: #4
RE: Custom PPSSPP shaders
Wow, very nice. I will try on android, but I don't have sure if that will works.

I've tried on 0.9.1-1371 and not worked. May be:

-The PPSSPP for Android doesn't support that (need write a code to support).
-The Android can't read the files.
-I did anything wrong.

I put the files on "PSP/assests/shaders" (the two latest folders not existed before, need create), but didn't work. I tried put on "(root)...data/data/org.ppsspp.ppsspp/assests/shaders", and didn't work too.
I enabled the buffer rendering and the FXAA Antialiasing.

Phones: Poco F3 8GB/256GB (Snapdragon 870 5G) and Redmi Note 6 Pro 4/64GB (Snapdragon 636)

PC: AMD Ryzen 5 3600 / 16GB RAM DDR4 3600MHz / NVIDIA GTX 1660 Ti 6GB / Windows 10 Pro
Find all posts by this user
Quote this message in a reply
09-30-2013, 05:04 AM (This post was last modified: 09-30-2013 05:51 AM by LunaMoo.)
Post: #5
RE: Custom PPSSPP shaders
Hmm, about folders didn't checked earlier, but apparently on android it should go to simply "shaders" dir, either "..ppsspp\shaders" or "(root)...data/data/org.ppsspp.ppsspp/shaders" not sure which one, but there should be default shader in there already to point you to correct one. If it's not check which version you have since FXAA was enabled on mobiles in v0.9.1-1319+ and will not have default shader files nor a chance to work in any earlier one.

I'm somewhat curious about the speed of it, if it actually compiles on android(@_@). Initially I thought just FXAA would be overkill already on mobiles, but this default simple FXAA has actually little to do with it's more accurate(less blurry;p) but heavier version. Bloom shader can be easily made lighter by decreasing samples and quality as well. Not so sure about speed after using all of them at once through, so if it works, but will be extremely slow, you can edit the fragment shader file(.fsh) to change some options.^o^

Edit: I installed latest ppsspp on android myself to test it and cannot find the default fxaa.fsh anywhere either. I don't think it's stored externally on android at all(but even default simple fxaa is pretty serious hit to framerate;p).

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-30-2013, 06:52 AM
Post: #6
RE: Custom PPSSPP shaders
I'd like to say that it worked for me, but it doesn't. Enabling FXAA in a game with your customized shader files just causes PPSSPP to crash with a BEX64 error using a 64bit build:-

Code:
Problem signature:
  Problem Event Name:    BEX64
  Application Name:    PPSSPPWindows64test1378.exe
  Application Version:    0.0.9.1
  Application Timestamp:    5248ba6a
  Fault Module Name:    PPSSPPWindows64test1378.exe
  Fault Module Version:    0.0.9.1
  Fault Module Timestamp:    5248ba6a
  Exception Offset:    0000000000198acc
  Exception Code:    c0000409
  Exception Data:    0000000000000000
  OS Version:    6.1.7601.2.1.0.256.48
  Locale ID:    1033
  Additional Information 1:    d26f
  Additional Information 2:    d26ff532f30d12254825d0eda6694d8e
  Additional Information 3:    2173
  Additional Information 4:    21731f93c13e195ecff107090e482efe

Read our privacy statement online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

If the online privacy statement is not available, please read our privacy statement offline:
  C:\Windows\system32\en-US\erofflps.txt

Tested using rig in sig, latest 64bit Orphis build and default settings except for FXAA enabled.

PPSSPP Modern Testbed:-
Intel Core i5 4690K @ 4.0 GHz
NVIDIA Geforce GTX 760 2GB GDDR5 VRAM @ 1138/6500 Mhz
16 GB DDR3 RAM @ 1600 MHz
Windows 7 x64 SP1

PPSSPP Ancient Testing Rig:-
Intel Core 2 Duo T9550 @ 2.8GHz
ATI Mobility Radeon 4670 1GB GDDR3 VRAM @ 843/882 MHz
8 GB DDR3 RAM @ 1066 MHz
Windows 7 x64 SP1
Find all posts by this user
Quote this message in a reply
09-30-2013, 07:43 AM
Post: #7
RE: Custom PPSSPP shaders
BEX is related to windows data execution prevention, how's that linked to modded shader? And are you sure it was latest Orphis build? PPSSPPWindows64test1378.exe ~ doesn't really look as default name from Orphis buildbot.

Sorry, but with that I'm totally clueless about that, seems like some quirk of windows. As long as default fxaa works, this shader just add's extra work to it using exactly same input and outputting it's results same way. Something like an abussive firewall or antivirus could potentially prevent the file from being read by ppsspp which could cause BEX error, no clue why it would happen through.

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-30-2013, 08:23 AM (This post was last modified: 09-30-2013 08:25 AM by solarmystic.)
Post: #8
RE: Custom PPSSPP shaders
(09-30-2013 07:43 AM)LunaMoo Wrote:  BEX is related to windows data execution prevention, how's that linked to modded shader? And are you sure it was latest Orphis build? PPSSPPWindows64test1378.exe] ~ doesn't really look as default name from Orphis buildbot.

Sorry, but with that I'm totally clueless about that, seems like some quirk of windows. As long as default fxaa works, this shader just add's extra work to it using exactly same input and outputting it's results same way. Something like an abussive firewall or antivirus could potentially prevent the file from being read by ppsspp which could cause BEX error, no clue why it would happen through.

I just renamed it, since as a PPSSPP tester I run multiple builds in the same folder for ease of testing multiple games and multiple issues, and to prevent any confusion.

Replacing the your shader files with the original packaged ones make FXAA work again. I'm rather clueless myself as to why using your files would cause a BEX64 (DEP) error since I have DEP disabled on my machine.

PPSSPP Modern Testbed:-
Intel Core i5 4690K @ 4.0 GHz
NVIDIA Geforce GTX 760 2GB GDDR5 VRAM @ 1138/6500 Mhz
16 GB DDR3 RAM @ 1600 MHz
Windows 7 x64 SP1

PPSSPP Ancient Testing Rig:-
Intel Core 2 Duo T9550 @ 2.8GHz
ATI Mobility Radeon 4670 1GB GDDR3 VRAM @ 843/882 MHz
8 GB DDR3 RAM @ 1066 MHz
Windows 7 x64 SP1
Find all posts by this user
Quote this message in a reply
09-30-2013, 08:31 AM
Post: #9
RE: Custom PPSSPP shaders
Can someone make a shader that is increasing the brightness\gama if it's possible.
Some games are just too dark.

Using PPSSPP on Windows 7 x64 SP1
i7 4771 3.5Ghz,GTX750TI,16GB RAM

Batch iso <=> cso converter
http://forums.ppsspp.org/showthread.php?tid=5384
Save Game\States Manager
http://forums.ppsspp.org/showthread.php?tid=5516
Find all posts by this user
Quote this message in a reply
09-30-2013, 09:07 AM (This post was last modified: 09-30-2013 09:07 AM by LunaMoo.)
Post: #10
RE: Custom PPSSPP shaders
@solarmystic Maybe that's exactly a reason why windows go crazy? Doesn't have enough priviledge to check stuff so it pulls the plug out to be safe.;X As far as I know DEP is mostly positive feature in modern windows, not sure about any reason to disable it.

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-30-2013, 09:26 AM
Post: #11
RE: Custom PPSSPP shaders
Thanks for this, it works nicely.

PC Specs:
Intel Pentium Dual-Core E6700 3.2 Ghz
4gb ddr3 ram
Geforce GTS 450 1 GB DDR3
Windows 7 x64
Find all posts by this user
Quote this message in a reply
09-30-2013, 09:34 AM (This post was last modified: 09-30-2013 10:24 AM by LunaMoo.)
Post: #12
RE: Custom PPSSPP shaders
Just added "Shadeboost" shader to it, should be what you're looking for @vsub :3 in case you want only that, all other shaders can be disabled easily, just edit .fsh which has all the options at the start of the file.
Shadeboost basically allows change of:
-saturation,
-brightness,
-contrast.
As well as changing rgb color intensity.:3
Edit: blah that shadeboost had a bug with color channels (misleading code comments ~ blah;p) /fixed now

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-30-2013, 10:34 AM
Post: #13
RE: Custom PPSSPP shaders
Thanks(now I'll think about how to make some kind of gui so I can configure it easily)

Btw just as if info you didn't know,after you save the file,just do some kind of update to the window resize,minimize\restore\maximize,stretch,selecting the same rendering resolution and so on will reload the shader and apply the changes...much easier than constantly disabling=>enabling FXAA

Using PPSSPP on Windows 7 x64 SP1
i7 4771 3.5Ghz,GTX750TI,16GB RAM

Batch iso <=> cso converter
http://forums.ppsspp.org/showthread.php?tid=5384
Save Game\States Manager
http://forums.ppsspp.org/showthread.php?tid=5516
Find all posts by this user
Quote this message in a reply
09-30-2013, 05:03 PM
Post: #14
RE: Custom PPSSPP shaders
Wow this is interesting! What about compatibility with SweetFX shaders? I have been dying to use the Advance CRT Arcade Monitor effects shader from SweetFX in PPSSPP.

http://forums.ppsspp.org/showthread.php?tid=3289

http://forums.guru3d.com/showthread.php?t=376265
Find all posts by this user
Quote this message in a reply
09-30-2013, 09:28 PM (This post was last modified: 09-30-2013 09:28 PM by TheDax.)
Post: #15
RE: Custom PPSSPP shaders
I don't know much about GLSL yet, but solarmystic's crash seems to be caused by this line:

vec3 color = texture2D(sampler0, v_texcoord0.xy);

4GHz AMD 3900X, 32GB DDR4 RAM, 6GB Nvidia RTX 2060, Asus Crosshair 7 Hero (Wifi), Linux
How to ask useful questions: https://web.archive.org/web/20110214010944/http://support.microsoft.com/kb/555375
I'm not Dark_Alex, nor do I claim to be. Our nicknames are merely coincidence.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: