Post Reply 
 
Thread Rating:
  • 11 Votes - 4.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom PPSSPP shaders
02-23-2021, 10:24 AM (This post was last modified: 02-26-2021 11:48 PM by LunaMoo.)
Post: #361
RE: Custom PPSSPP shaders
I would recommend to just try different backend, PPSSPP post process shaders are auto translated from GLSL(native to OGL) to other backends, auto translation depends on third party projects we use as submodules, an update to the submodule can introduce or fix problems, there might also be some problems introduced on PPSSPP side. If you have time you could check which version exactly broke the custom effects for you in the backend you're using and report to official PPSSPP issue tracker in here, you can use builds from orphis buildbot if on android/windows to figure out when the issue started by just going in halves between the build that last worked and build which doesn't work anymore a few times.

I'm not spending much time around the project nowadays and have some covid sadness in the close family emerging, I can only recall testing all the effects in OGL and Vulkan, in Vulkan Bilateral filtering was broken in some weird way(which I still couldn't/didn't-even-had-time-to figure out, but it certainly was a translation failure of some kind), but aside of that the effects worked well.

Some of the effects like FXAA are exactly the same as the official version already included in the project, but has added settings to be video-aware(apply only in-game/video/both), so if a shader like my version of FXAA fails while official version works, it could just mean the effect translation fails horribly, possibly due to video awareness(can test official Video smoothing AA shader which is the only one that uses video awareness) or branching(that's used in for example 5xBR effects). So if none of my shaders works, by testing 3 official shaders FXAA, Video smoothing AA and 5xBR you could tell whenever the problem is general failure(fxaa), with video awareness(Video smoothing AA) or with branching(ie 5xBR-lv2) and post that info on the issue tracker along with gpu & backend you're using.

Edit: There was an actual issue with one submodule of a pair used for shaders updated without the other, but it was fixed in latest PPSSPP version.
Edit2: Added some useless tiny effects for color reduction, aspect ratio and pixelate, added a workaround for vulkan backend for bilateral filtering and an ordered(faked) option for frost debanding.

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-11-2021, 06:35 AM
Post: #362
RE: Custom PPSSPP shaders
Hi I really like your shaders but I got one problem. I'm playing FF1 and 4 and I've noticed that whenever I'm walking in world it's so blurry and as soon as I stopped moving it's not. Also it's not blurry inside of town or caves when walking. Only in world when walking. I'm using XBR shader.
Find all posts by this user
Quote this message in a reply
03-13-2021, 12:08 AM (This post was last modified: 03-13-2021 12:09 AM by LunaMoo.)
Post: #363
RE: Custom PPSSPP shaders
It's not blur, upscaling post process effects apply to what you see each frame not to the textures like texture scaling which then never change, so when a non-animated object like background is moving on the screen, you will see the effect being re-made each pixel moves and since the pixel location is then different, the effect is slightly different as well.

It's just one of the downside of using upscaling post process effects we have to live in(another would be effects that resize textures, like for example explosions in some 2D games), but it's not actually blur, if you record a video of it and then watch it frame by frame you will see none of those frames are actually "blurry", they're just slightly different.

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-13-2021, 02:29 AM
Post: #364
RE: Custom PPSSPP shaders
(03-13-2021 12:08 AM)LunaMoo Wrote:  It's not blur, upscaling post process effects apply to what you see each frame not to the textures like texture scaling which then never change, so when a non-animated object like background is moving on the screen, you will see the effect being re-made each pixel moves and since the pixel location is then different, the effect is slightly different as well.

It's just one of the downside of using upscaling post process effects we have to live in(another would be effects that resize textures, like for example explosions in some 2D games), but it's not actually blur, if you record a video of it and then watch it frame by frame you will see none of those frames are actually "blurry", they're just slightly different.

So there's nothing I can do to fix that? Damn. Anyway thanks for a detailed explanation. Again thank you for sharing your wonderful shaders.
Find all posts by this user
Quote this message in a reply
11-11-2021, 03:16 PM (This post was last modified: 11-11-2021 03:24 PM by el_rika.)
Post: #365
RE: Custom PPSSPP shaders
Hey guys,

I have a tiny (a bit strange) request, that i only dare to ask because you're such a great comunity, and i hope doesn't offend anyone here. I sincerely appologise if it does.

I was wondering if anyone could create a little .glsl shader compatible with android version of official Dolphin emulator, that zooms in/stretches the image by some 50%.
Some GC games like RE4 and Beyond Good and Evil, are stuck in a zoomed out fake 16/9 aspect, and there is no fix for android.

Thanks so much guys! ^_^
Find all posts by this user
Quote this message in a reply
11-11-2021, 04:32 PM
Post: #366
RE: Custom PPSSPP shaders
Why don't you ask in Dolphin's forums? Here's a link.

I don't know anything about dolphin's post process shader support, but if it uses glsl, you could use my "custom aspect ratio"(it's in the first post, I just forgot to mention it in the list) shader as a base if that's what you need, it doesn't do zoom-in, but it should be trivial to modify it to just use X or Y scale instead of automatically picking as it does now, but you'll need to change the input and potentially formatting to match what dolphin uses. Possibly also remove options and replace them with hardcoded values if dolphin doesn't support post process settings and if it does, just rename them to what Dolphin recognizes.

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
11-11-2021, 05:14 PM (This post was last modified: 11-11-2021 07:18 PM by el_rika.)
Post: #367
RE: Custom PPSSPP shaders
Thanks for the reply!

Tried in their forums, but with no luck.
I am a complete noob, but i will look for your shader and try it, at least to see if they are compatible.

Edit:
This is how a shader looks for Dolphin (and Citra)

https://we.tl/t-cwzxUXnt4t

Edit2: well, "surprisingly" renaming the file to .glsl doesn't work (gives a "cannot compile shader" message)...that's about all my tehnical knowledge on the matter Smile)
Find all posts by this user
Quote this message in a reply
11-11-2021, 08:33 PM (This post was last modified: 11-11-2021 11:05 PM by LunaMoo.)
Post: #368
RE: Custom PPSSPP shaders
Didn't tested and it's just copy&paste with changes I noticed in the glsl(which looks more like hlsl to me) you posted, so no promises, but try this:
Code:
-removed-
just copy into new text file and rename it to customAR.glsl or whatever, don't forget to edit the values in the beginning of the file to achieve whatever you want.

On a side note a find it weird this bloom effect you posted is converted from the custom shader I made for PPSSPP, it has power value and mixes with default output purely to deal with lack of multi pass shaders in old PPSSPP versions while trying to mix various effects in one large shader file. Basically doing 100% work then using just 50% of it instead of tweaking other parameters to achieve similar reduction in effect while also keeping it lighter.
In new PPSSPP we can do soo much more so while converting to multi pass I removed that or just set it to 100%, since I probably had no time to properly clean the code aside from just making effects separate;o.

Edit: noticed one mistake, fixed, but might be more.

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
11-11-2021, 09:02 PM
Post: #369
RE: Custom PPSSPP shaders
ha! very interesting what you are saying regarding the bloom shader...hmmm

I must thank you for taking the time to help me, i did exactly as instructed, pasted the code into a txt file then renamed it to glsl, but sadly it doesn't work. It give the exact same error, about "failing to compile the post-processing shader".
Find all posts by this user
Quote this message in a reply
11-11-2021, 11:05 PM
Post: #370
RE: Custom PPSSPP shaders
(11-11-2021 09:02 PM)el_rika Wrote:  (...)
sadly it doesn't work
(...)

Try this then

Code:
const float customX = 4.0; //edit only values in here
const float customY = 3.0; // here
const float zoom = 3.0; // and here, through you can set automatic zoom based on X or Y few lines lower

void main() {

    float zoomByX = 16.0 / customX;
    float zoomByY = 9.0 / customY;
    float zoomByXY = zoom;
    
    //zoomByXY = zoomByX;
    // uncomment the above or below(remove // before the code) to have it zoom based on X or Y edge instead of the zoom you manually typed in above
    //zoomByXY = zoomByY;

    float xdivision = 1.0 / (customX / 16.0 * zoomByXY);
    float ydivision = 1.0 / (customY / 9.0 * zoomByXY);

    float2 vCoord0 = GetCoordinates().xy;
    float3 color = Sample().xyz;

    color = SampleLocation(float2(vCoord0.x * xdivision - (0.5 + xdivision / 2.0 - 1.0), vCoord0.y * ydivision - (0.5 + ydivision / 2.0 - 1.0)).xy).xyz;

    // Remove color bleed outside of the game scene caused by shrinking
    float rangex = (0.5 + (xdivision / 2.0 - 1.0)) / xdivision;
    float rangey = (0.5 + (ydivision / 2.0 - 1.0)) / ydivision;
    if (vCoord0.x < rangex || vCoord0.x > 1.0 - rangex || vCoord0.y < rangey || vCoord0.y > 1.0 - rangey) {
        color.xyz = float3(0.0,0.0,0.0).xyz;
    }

    SetOutput(float4(color.rgb, 1.0));
}

I also changed settings to change 16:9 into 4:3 aspect ratio to see it's effect by default.

Also yeah Dolphin does use HLSL in their shaders, they define it into GLSL through, probably to make use of it on d3d and ogl backends without auto-translation that PPSSPP does.

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
11-12-2021, 04:29 AM
Post: #371
RE: Custom PPSSPP shaders
Fantastic! One month of searching comes to an end thanks to you. Thanks so much!

It works exactly as needed. The only value i modified was - const float zoom to "4" (and set the emulation aspect in Dolphin to Force 16:9...for some reason it was forcing 4:3 in auto mode).
It looks amazing now, perfectly framed!


Now, i humbly ask one last question, could this and the gorgeous bloom shader be merged ? is it possible to have one file with both shaders attributes?
Find all posts by this user
Quote this message in a reply
11-12-2021, 03:52 PM
Post: #372
RE: Custom PPSSPP shaders
Without multi-pass some effects cannot be mixed while other just require a bit of extra effort, here:
Code:
const float customX = 4.0; //edit only values in here
const float customY = 3.0; // here
const float zoom = 3.0; // and here, through you can set automatic zoom based on X or Y few lines lower
const float amount = 0.60; // suitable range = 0.00 - 1.00
const float power = 0.5; // suitable range = 0.0 - 1.0

void main() {

    float zoomByX = 16.0 / customX;
    float zoomByY = 9.0 / customY;
    float zoomByXY = zoom;
    
    //zoomByXY = zoomByX;
    // uncomment the above or below(remove // before the code) to have it zoom based on X or Y edge instead of the zoom you manually typed in above
    //zoomByXY = zoomByY;

    float xdivision = 1.0 / (customX / 16.0 * zoomByXY);
    float ydivision = 1.0 / (customY / 9.0 * zoomByXY);

    float2 vCoord0 = GetCoordinates().xy;
    float3 color = Sample().xyz;

    color = SampleLocation(float2(vCoord0.x * xdivision - (0.5 + xdivision / 2.0 - 1.0), vCoord0.y * ydivision - (0.5 + ydivision / 2.0 - 1.0)).xy).xyz;

    float4 sum = vec4(0);
    float3 bloom;
    float2 adjustedCoords = float2(vCoord0.x * xdivision - (0.5 + xdivision / 2.0 - 1.0), vCoord0.y * ydivision - (0.5 + ydivision / 2.0 - 1.0)).xy;

    for(int i= -3 ;i < 3; i++)
    {
        sum += SampleLocation(adjustedCoords + vec2(-1, i) * 0.004) * amount;
        sum += SampleLocation(adjustedCoords + vec2( 0, i) * 0.004) * amount;
        sum += SampleLocation(adjustedCoords + vec2( 1, i) * 0.004) * amount;
    }

    if (color.r < 0.3 && color.g < 0.3 && color.b < 0.3) {
        bloom = sum.xyz * sum.xyz * 0.012 + color;
    } else {
        if (color.r < 0.5 && color.g < 0.5 && color.b < 0.5) {
            bloom = sum.xyz * sum.xyz * 0.009 + color;
        } else {
            bloom = sum.xyz * sum.xyz * 0.0075 + color;
        }
    }

    // Remove color bleed outside of the game scene caused by shrinking
    float rangex = (0.5 + (xdivision / 2.0 - 1.0)) / xdivision;
    float rangey = (0.5 + (ydivision / 2.0 - 1.0)) / ydivision;
    if (vCoord0.x < rangex || vCoord0.x > 1.0 - rangex || vCoord0.y < rangey || vCoord0.y > 1.0 - rangey) {
        bloom.xyz = float3(0.0,0.0,0.0).xyz;
    }

    SetOutput(float4(bloom.rgb, 1.0));
}

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
11-12-2021, 08:25 PM (This post was last modified: 11-13-2021 07:26 AM by el_rika.)
Post: #373
RE: Custom PPSSPP shaders
It's brilliant!

It's exactly right Smile

Your shaders and the ppsspp implementation are truly the best! Thanks so much for your effort friend!

https://gcdn.pbrd.co/images/Ca6UyPbyxoIA.jpg?o=1
Find all posts by this user
Quote this message in a reply
11-19-2021, 01:57 PM
Post: #374
RE: Custom PPSSPP shaders
I want to ask how to use code to get depth buffer,gl_depth not work.I had converted some simple Reshade's shaders like Aces tonemap,watchdogTonemap,FakeHDR into Android PPSSPP.But the ScreenSpaceAmbientOcclusion needs depth buffer.Can I use code to get it like reshade's getDepth void?
Find all posts by this user
Quote this message in a reply
11-19-2021, 11:53 PM
Post: #375
RE: Custom PPSSPP shaders
You'll have to look around the code yourself.
You can check this this just to get the idea that you could do much more in PPSSPP than you might be expecting, the thing is some people get's excited very easily seeing a big difference even if the end result looks like poo and doesn't fit the game at all and when everyone calms down they see the poo as poo and stop caring.

PPSSPP is open source through and over time from something very basic like hardcoded FXAA it grew to easily THE most advanced post process shader system out of any emulator out there despite most people not caring since with post process effects less means more for most people out there. PPSSPP even includes custom CWCheat types which can activate shader effects based on values from game's memory, apply different effects when FMV's are running, menu-tweakable shader variables and other features that does not exist in any other emulator post process effects support all while keeping those shaders translated automatically between supported backends.
So yeah try your best implementing what you need without breaking what exists - pull requests are welcome.

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
Post Reply 


Forum Jump: