Post Reply 
 
Thread Rating:
  • 11 Votes - 4.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom PPSSPP shaders
03-15-2018, 10:13 AM
Post: #331
RE: Custom PPSSPP shaders
Just for fun, I've also ported the 'psp-color' shader from RetroArch. This applies colour correction to replicate the LCD dynamics of the PSP 1000 and PSP 2000 displays. Basically, this fixes the oversaturated colours you sometimes get as a result of developers 'overcompensating' for the limited colour gamut of the original PSP models (it's not as significant an issue for the PSP as it is for the GBA or NDS, but it still makes games look a little garish by default).

The attached zip file is a bundle containing all my shaders so far: the 'psp-color' shader, my zfast_lcd port and hybrid shaders that combine the two effects. As before, there are standard and 'mobile' versions (please see the previous post for more details).

Here are a couple of random examples of the shaders in action:

--- BUST A MOVE DELUXE

With the "zfast LCD Shader":

   

With the "zfast LCD + PSP Color" shader:

   

Note how the colour correction makes the greens more natural, and removes the lurid purpleness of the background.

--- WipEout Pulse

With no shader:

   

With the "PSP Color" shader:

   

Without colour correction, the background highlights are all purple. With colour correction applied, you can see that they are supposed to be a mixture of purple and blue.

---

I guess the effects are fairly subtle, but I think it's worth playing around with...


Attached File(s)
.zip  ppsspp_zfast_lcd+psp_color.zip (Size: 16.62 KB / Downloads: 3337)
Find all posts by this user
Quote this message in a reply
03-22-2018, 09:59 AM (This post was last modified: 03-29-2018 08:10 AM by jdgleaver.)
Post: #332
RE: Custom PPSSPP shaders
I've updated my shader collection with a few more ports and such - this is probably the last of them now, so I'll stop spamming this thread... Smile

You can get a copy of the final bundle here:
.zip  ppsspp_shader_bundle.zip (Size: 42.23 KB / Downloads: 4915)

It contains my existing 'PSP Color' and 'zfast LCD' variants, plus the following new additions:

=== Bead ===

This is a port of the 'bead' shader from RetroArch, which turns each pixel into a round bead. The native PSP resolution is actually too high for this to work entirely as it should (unless you have a 4k+ display), but it still produces quite a nice clean, crisp result:

[Bead] / [Bead + PSP Color]

       

Notes:

- REQUIRES a rendering resolution of 1xPSP

- REQUIRES a display resolution of at least 1080p

- Runs at full speed on mid-range Android devices

=== Dot ===

This is a port of the 'dot' shader from RetroArch, which produces an LCD effect with a sort of cosy glow to it:

[Dot] / [Dot + PSP Color]

       

Notes:

- REQUIRES a rendering resolution of 1xPSP

- REQUIRES a display resolution of at least 1080p

- This is quite a 'heavy' shader, intended for Desktop use. I've included a 'mobile' version (for Android, as I have with all the shaders), but you'll struggle to run it at full speed unless you have a beastly device.

=== LCD3x ===

This is a port of the LCD3x shader from RetroArch.

NB: There is already a version of this in LunaMoo's superb shader collection, but it has a hard-coded 'scanline size' parameter which doesn't match the pitch of the PSP screen. This shader just fixes that one issue, and adds a 'PSP Color' variant.

[LCD3x] / [LCD3x + PSP Color]

       

Notes:

- REQUIRES a rendering resolution of 1xPSP

- Runs at full speed on mid-range Android devices

- Does *not* require a 1080p display! This shader produces decent results (i.e. no unbearable aliasing effects) at 1360x768, so it's quite good for potato laptops:

   

=== LCD1x Sharp ===

Personally, I don't like blurry shaders, and the the colour separation of LCD3x gives me a massive headache... so I made a 'tweaked' version that is 'sharp' and which omits the 3-band LCD colour effect:

[LCD1x Sharp] / [LCD1x Sharp + PSP Color]

       

Notes:

- REQUIRES a rendering resolution of 1xPSP

- Runs at full speed on mid-range Android devices

- As with the LCD3x shader, produces decent results at 1360x768:

   
Find all posts by this user
Quote this message in a reply
03-22-2018, 10:32 PM (This post was last modified: 04-04-2018 03:32 PM by LunaMoo.)
Post: #333
RE: Custom PPSSPP shaders
(03-22-2018 09:59 AM)jdgleaver Wrote:  (...)
but it has a hard-coded 'scanline size' parameter
(...)

I would say there's nothing hardcoded in any post process shader loaded externally from text file;p, but also "scanline size" is actually a define right under the option to activate the effect, left there specially to be messed with.;p

(03-22-2018 09:59 AM)jdgleaver Wrote:  (...)
- REQUIRES a rendering resolution of 1xPSP
(...)

Hint: as long as it doesn't depend on linear screen scaling filter(which overall makes image blurry when stretched from x1 to higher display/window res) you can simply add "upscaling" flag to shader ini file as it forces x1 render res and nearest screen scaling filter ~ it's required for upscaling filters, but can be used freely for any effects which have similar requirement. This will avoid manual switching of resolution and bothering people to remember about doing soTongue.


~

Quick copy-paste reminder of flags we have:
Code:
RequiresIntSupport=True - when unsure, you most likely don't need it
Upscaling=True - forces x1 render res and nearest screen scaling filter which upscaling filters require
OutputResolution=True - outputs to display res, almost always good thing to have
60fps=True - for animated filters
SSAA=value - forces rendering res to value * display res, combined with blurry filters it's nice, but expensive form of AA.
(edit: added new SSAA flag and some descriptions)

We also have some special uniforms like
Code:
u_time
u_video
u_texelDelta
u_pixelDelta
which combined with flags above can make some otherwise impossible things easy, all are used in at least one default effect to see example usage. For example u_time can be used for animations and 60fps flag makes it constant even when game native fps drops down(loading screens for example can often drop to 0 fps which would pause the animation).

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
03-23-2018, 09:49 AM
Post: #334
RE: Custom PPSSPP shaders
(03-22-2018 10:32 PM)LunaMoo Wrote:  I would say there's nothing hardcoded in any post process shader loaded externally from text file;p, but also "scanline size" is actually a define right under the option to activate the effect, left there specially to be messed with.;p

You are of course correct! I didn't intend any disrespect towards your work! What I meant to say is that the 'scanline size' value in your shader has to be entered by hand, whereas it's just as easy to determine the 'correct' value automatically... Wink

(03-22-2018 10:32 PM)LunaMoo Wrote:  Hint: as long as it doesn't depend on linear screen scaling filter(which overall makes image blurry when stretched from x1 to higher display/window res) you can simply add "upscaling" flag to shader ini file as it forces x1 render res and nearest screen scaling filter ~ it's required for upscaling filters, but can be used freely for any effects which have similar requirement. This will avoid manual switching of resolution and bothering people to remember about doing soTongue.

I realise this is true (and I used it for some of the shaders)... but at least for me, running under Linux (OpenSUSE), the 'upscaling' flag is rather unreliable - half the time I have to switch to another shader and back again before the 1xPSP resolution is enforced. It may be a bother to set the resolution manually, but at least that way I can be sure it's going to work... Undecided
Find all posts by this user
Quote this message in a reply
03-23-2018, 03:08 PM
Post: #335
RE: Custom PPSSPP shaders
(03-23-2018 09:49 AM)jdgleaver Wrote:  (...)
I didn't intend any disrespect towards your work!
(...)

Don't worry and don't treat me like an rotten egg. I'm not oversensitive nor delicate.;p Frankly the only time I felt disrespected here was when some dude took my work, edited default values changing options half of which were counter productive or even intentionally disabling each other which he didn't even understand and posted a link to his site filled with advertisement which had a link behind even more advertisement to grab his edited shader;p. Aka I'm not a fan of people earning money of other people's work released for free, doesn't matter how they change it and how they choose to charge for it, parteon, invasive ads, or any other bullshit popular among some greedy people who make excuses on having to pay for hosting costs etc is really the only thing I can't stand and unfortunately it became a thing in "emulation" due to rise in popularity .Tongue

(03-23-2018 09:49 AM)jdgleaver Wrote:  (...)
ut at least for me, running under Linux (OpenSUSE), the 'upscaling' flag is rather unreliable - half the time I have to switch to another shader and back again before the 1xPSP resolution is enforced
(...)
If you have problem with it, best if you open an issue on PPSSPP issue tracker might be some linux specific problem possibly some race issue as I recall linux behaving differently from windows during resizing which was never properly fixed yet.

The flag was always reliable on windows, through from some time I mostly used d3d11 backend which ofc is not an option for linux users.;c

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
04-06-2018, 06:18 PM (This post was last modified: 04-06-2018 06:19 PM by Endarko.)
Post: #336
RE: Custom PPSSPP shaders
please port to ppssp
shadersmods.com/chocapic13s-shaders-mod/
Find all posts by this user
Quote this message in a reply
04-07-2018, 03:17 PM
Post: #337
RE: Custom PPSSPP shaders
You can forget about post processing filters from moddable games, they're using a lot of game specific uniforms and can't be ported, because PPSSPP does not provide nor have the information they're based on.

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
04-09-2018, 04:35 AM
Post: #338
RE: Custom PPSSPP shaders
whether shader like this can be used in ppsspp? I've tried changing the name of shaders.vert to shaders.fsh but the game screen becomes a black screen

#version 300 es
precision highp float;
in vec3 position;
in mediump vec3 normal;
in vec2 texcoord;
uniform mat4 u_proj;
uniform mat4 u_world;
uniform mat4 u_view;
uniform vec4 u_uvscaleoffset;
uniform vec3 u_lightpos0;
uniform lowp vec3 u_lightambient0;
uniform lowp vec3 u_lightdiffuse0;
uniform vec3 u_lightpos1;
uniform lowp vec3 u_lightambient1;
uniform lowp vec3 u_lightdiffuse1;
uniform vec3 u_lightpos2;
uniform lowp vec3 u_lightambient2;
uniform lowp vec3 u_lightdiffuse2;
uniform lowp vec4 u_ambient;
uniform lowp vec3 u_matdiffuse;
uniform lowp vec4 u_matspecular;
uniform lowp vec3 u_matemissive;
uniform lowp vec4 u_matambientalpha;
uniform highp vec2 u_fogcoef;
out lowp vec4 v_color0;
out mediump vec3 v_texcoord;
out mediump float v_fogdepth;
void main() {
vec3 worldpos = (u_world * vec4(position.xyz, 1.0)).xyz;
mediump vec3 worldnormal = normalize((u_world * vec4(normal, 0.0)).xyz);
vec4 viewPos = u_view * vec4(worldpos, 1.0);
gl_Position = u_proj * viewPos;
lowp vec4 lightSum0 = u_ambient * u_matambientalpha + vec4(u_matemissive, 0.0);
vec3 toLight;
lowp vec3 diffuse;
mediump float ldot;
toLight = u_lightpos0;
ldot = max(dot(toLight, worldnormal), 0.0);
diffuse = (u_lightdiffuse0 * u_matdiffuse) * ldot;
lightSum0.rgb += (u_lightambient0 * u_matambientalpha.rgb + diffuse);
toLight = u_lightpos1;
ldot = max(dot(toLight, worldnormal), 0.0);
diffuse = (u_lightdiffuse1 * u_matdiffuse) * ldot;
lightSum0.rgb += (u_lightambient1 * u_matambientalpha.rgb + diffuse);
toLight = u_lightpos2;
ldot = max(dot(toLight, worldnormal), 0.0);
diffuse = (u_lightdiffuse2 * u_matdiffuse) * ldot;
lightSum0.rgb += (u_lightambient2 * u_matambientalpha.rgb + diffuse);
v_color0 = clamp(lightSum0, 9.0, 1.0);
v_texcoord = vec3(texcoord.xy * u_uvscaleoffset.xy, 0.0);
v_fogdepth = (viewPos.z + u_fogcoef.x) * u_fogcoef.y;
}
Find all posts by this user
Quote this message in a reply
04-09-2018, 09:31 AM
Post: #339
RE: Custom PPSSPP shaders
Check my post above as it's exactly about stuff like that.

Maybe it would be possible to provide more specific information via some addition to texture replacement or something, but nothing like that exists currently and even if someone would make it possible(which would be a lot of work aka might never happen), it would require a lot of manual work for each game from the user to make use of any effect using such extra information. And even then it would most likely be impossible to reproduce everything which native moddable game has.

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-05-2018, 08:13 PM (This post was last modified: 06-05-2018 08:19 PM by ppssp213.)
Post: #340
RE: Custom PPSSPP shaders
Still tweaking, trying not destory the smokey / rainy atmosphere
but give it richer colours for better greens and browns.

               

Code:
#define SHADEBOOST   1         //ON:1/OFF:0 /color correction from GSdx/pcsx2 plugin, initially taken from

http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057
#define saturation   2.0       //Default: 1.0 //negative will look like inverted colors shader
#define brightness   2.0       //Default: 1.0
#define contrast     1.0       //Default: 1.0 //negative will be... well negative;p
#define red          0.7       //Default: 1.0
#define green        0.7       //Default: 1.0
#define blue         0.7       //Default: 1.0
Find all posts by this user
Quote this message in a reply
10-01-2018, 07:21 AM
Post: #341
RE: Custom PPSSPP shaders
Simple request. Is it possible to port the sharp-bilinear-simple shader from libretro to PPSSPP? All it does is prescale the image by nearest neighbor integer scaling as high as possible under the current display resolution, and then uses hardware bilinear scaling to do the rest. Extremely useful for 2D games, and it has effectively no performance cost under modern hardware.

I'd do it myself, since the GLSL code doesn't seem to need rewriting, but I don't know how to split it into explicit fragment and vertex shaders as PPSSPP requires. (I also don't know if it'd be Vulkan compatible, and I'd like to use this with my Android phone as well.)

I can't link the shader because of account restrictions, but it's sharp-bilinear-simple.glsl under the libretro/glsl-shaders repo on GitHub. That or I'll just post the entire code here:

Code:
/*
   Author: rsn8887 (based on TheMaister)
   License: Public domain

   This is an integer prescale filter that should be combined
   with a bilinear hardware filtering (GL_BILINEAR filter or some such) to achieve
   a smooth scaling result with minimum blur. This is good for pixelgraphics
   that are scaled by non-integer factors.
  
   The prescale factor and texel coordinates are precalculated
   in the vertex shader for speed.
*/

#if defined(VERTEX)

#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif

COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;

uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;

// vertex compatibility #defines
#define vTexCoord TEX0.xy
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)

COMPAT_VARYING vec2 precalc_texel;
COMPAT_VARYING vec2 precalc_scale;

void main()
{
    gl_Position = MVPMatrix * VertexCoord;
    COL0 = COLOR;
    TEX0.xy = TexCoord.xy;

    precalc_texel = vTexCoord * SourceSize.xy;
    precalc_scale = max(floor(outsize.xy / InputSize.xy), vec2(1.0, 1.0));
}

#elif defined(FRAGMENT)

#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif

#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif

uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
uniform sampler2D Texture;
COMPAT_VARYING vec4 TEX0;

// fragment compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy

#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)

COMPAT_VARYING vec2 precalc_texel;
COMPAT_VARYING vec2 precalc_scale;

void main()
{
   vec2 texel = precalc_texel;
   vec2 scale = precalc_scale;

   vec2 texel_floored = floor(texel);
   vec2 s = fract(texel);
   vec2 region_range = 0.5 - 0.5 / scale;

   // Figure out where in the texel to sample to get correct pre-scaled bilinear.
   // Uses the hardware bilinear interpolator to avoid having to sample 4 times manually.

   vec2 center_dist = s - 0.5;
   vec2 f = (center_dist - clamp(center_dist, -region_range, region_range)) * scale + 0.5;

   vec2 mod_texel = texel_floored + f;

   FragColor = vec4(COMPAT_TEXTURE(Source, mod_texel / SourceSize.xy).rgb, 1.0);
}
#endif
Find all posts by this user
Quote this message in a reply
06-01-2019, 02:36 PM
Post: #342
RE: Custom PPSSPP shaders
Hello. Thanks for all your wonderful work guys. Thanks to you, my games are looking absolutely gorgeous (like ps2.5). I wanted to combine the effects of my two favorite shaders "fxaa_nat_bloom" and "cartoon shader I" from the epsxe pack (both of which are I can't do without now. Thumbs up to the creators.) but to no avail. So if one of you experts can do this for me, I'd be eternally grateful.

Thank you.
Find all posts by this user
Quote this message in a reply
07-27-2019, 12:39 PM
Post: #343
RE: Custom PPSSPP shaders
After playing Liberty City Stories on PCSX2 emulator, I finally got to play Chinatown wars on PPSSPP emulator.
And what I'm missing here is scanlines filter variant that was presented there.
Its called: diagonal filter.
So my question will be: is it possible to modify current scanline shader to add an angle, or it will be easier to write down new one (port from PCSX2)?

On first sight it looks kinda simple, just same lines over entire screen, just with 45 degree angle.
https://i.imgur.com/Iz4GV3n.png
Find all posts by this user
Quote this message in a reply
10-13-2019, 04:20 AM
Post: #344
RE: Custom PPSSPP shaders
Hello All.

I'm in need of help removing the corners?

I'm using CRT Lottes TV from this post.

https://forums.ppsspp.org/showthread.php...#pid128965

Thanks


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
11-02-2019, 05:09 PM (This post was last modified: 11-02-2019 05:11 PM by guest.r.)
Post: #345
RE: Custom PPSSPP shaders
Hey there! Corners are sortoff hard-coded into the shader, but they can be altered/removed.

You need to alter the corner value in the corner function:
Code:
float corner(vec2 coord)
  {
                coord = (coord - vec2(0.5)) * 1.0 + vec2(0.5);
                coord = min(coord, vec2(1.0)-coord) * vec2(1.0, 0.5666667);
                vec2 cdist = vec2(0.01);  // edit this value
                coord = (cdist - min(coord,cdist));
                float dist = sqrt(dot(coord,coord));
                return clamp((cdist.x-dist)*200.0,0.0, 1.0);
  }

to a lower value, but greater than 0.0 or the image would turn black.

Thanks for having fun...Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: