Post Reply 
 
Thread Rating:
  • 11 Votes - 4.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom PPSSPP shaders
12-09-2013, 08:08 PM (This post was last modified: 12-09-2013 08:40 PM by LunaMoo.)
Post: #121
RE: Custom PPSSPP shaders
Maybe something changed recently how the list is handled on android. Even test ini file with renamed default fxaa:
Code:
[Test]
Name=Test Shader
Fragment=fxaa1.fsh
Vertex=fxaa1.vsh
does cause a crash, I'm not using any android device to play, but from my test almost 2 months ago it worked fine as it is.

Edit: From what I checked it broke somewhere between ppsspp-v0.9.5-143-gc290cb2(on which it works) and ppsspp-v0.9.5-151-ge3f6f25(on which it doesn't). /Blah testing android is slow;p. ~ time to make a bug report.

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
12-10-2013, 02:45 AM
Post: #122
RE: Custom PPSSPP shaders
* so its a bug then..
* good thing i noticed! LOLBig Grin

* i'll just wait for the fix.
* thanks bro!

Reality is a Lovely Place, But i Wouldn't Wanna Live There..
• • gLoBe ~
Find all posts by this user
Quote this message in a reply
12-10-2013, 05:25 AM
Post: #123
RE: Custom PPSSPP shaders
Argh, I can't get u_time working.
How do I use it? Shouldn't I just be able to define 'uniform vec4 u_time;' at the top of the file, and just be able to use it in main()? for some reason x,y,z, and w all appear to just be zero. I downloaded the latest version from the website, so it should have u_time right?
Find all posts by this user
Quote this message in a reply
12-10-2013, 08:49 AM
Post: #124
RE: Custom PPSSPP shaders
@KillaMaaki u_time works fine for me, althrough I cannot really find any great use for it besides testing. What are you trying to do/how you're trying to use it?
u_time.x - constantly rises as it's time, .y - changes between 0.0-1.0 and is pretty good if you need to have something repeated, .z -constantly rises as well(? not sure, didn't used it;p), u_time.w - can be used similar way to .y

A simple example fragment shader to make use of u_time:
Code:
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
uniform vec4 u_time;

void main() {
vec3 color = texture2D(sampler0, v_texcoord0.xy).xyz;
if(u_time.y<0.5)
{
    color=color-0.1+(u_time.yyy/10);
}
else
{
    color=color-(u_time.yyy/10);
}
gl_FragColor.rgb=color;
gl_FragColor.a = 1.0;
}
Should make a subtle, repeatable changes in color(darker~lighter +/-0.05f). Same can be done with coordinates and stuff.

The change yet as it was added in v0.9.5-824-g7c7c4aa, so if you got latest from buildbot or the bottom of the download page(which also is from buildbot), then you surely have it, if you just clicked "download" on main page it links to 0.9.5 release version which doesn't have it through;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
12-10-2013, 09:43 AM (This post was last modified: 12-10-2013 09:43 AM by Henrik.)
Post: #125
RE: Custom PPSSPP shaders
Yeah, you need the latest build from the buildbot or wait for 0.9.6.

Anyway, here are the four times:

u_time.x: Current time in seconds, not connected to emulator frame rate (so will not react to "unthrottle" (holding tab))
u_time.y: 0.0-1.0 increasing, wrapping every game time second
u_time.z: Current time as a count of 60ths of a game time second
u_time.w: Same as z but wrapping (game time)
Find all posts by this user
Quote this message in a reply
12-10-2013, 02:22 PM
Post: #126
RE: Custom PPSSPP shaders
Thanks @Henrik for fixing the custom shaders loading on android bug just now, tested and workingSmile.

Oh and @globe94 and anyone if you want to use those shaders of mine from first post on android, redownload the archive, I added it's own vertex shader file as it cannot reuse it on android as it was on windows, also renamed sharpen filter as it had same name as the default one included from some time with ppsspp which was slightly confusing.

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
12-10-2013, 05:07 PM
Post: #127
RE: Custom PPSSPP shaders
Nice, it works now. Here's the custom CRT-style shader. It's got scanlines, psuedo color bleed, and that wierd vsync rollbar thingy.

Code:
// Retro (CRT) shader, created to use in PPSSPP.

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

uniform sampler2D sampler0;
varying vec2 v_texcoord0;
uniform vec4 u_time;

void main()
{
    // scanlines
    int vPos = int( ( v_texcoord0.y + u_time.x * 0.5 ) * 272.0 );
    float line_intensity = mod( float(vPos), 2.0 );
    
    // color shift
    float off = line_intensity * 0.0005;
    vec2 shift = vec2( off, 0 );
    
    // shift R and G channels to simulate NTSC color bleed
    vec2 colorShift = vec2( 0.001, 0 );
    float r = texture2D( sampler0, v_texcoord0 + colorShift + shift ).x;
    float g = texture2D( sampler0, v_texcoord0 - colorShift + shift ).y;
    float b = texture2D( sampler0, v_texcoord0 ).z;
    
    vec4 c = vec4( r, g * 0.99, b, 1 ) * clamp( line_intensity, 0.85, 1 );
    
    float rollbar = sin( ( v_texcoord0.y + u_time.x ) * 4 );
    
    gl_FragColor.rgba = c + (rollbar * 0.02);
}
Find all posts by this user
Quote this message in a reply
12-10-2013, 09:59 PM
Post: #128
RE: Custom PPSSPP shaders
That one looks WAY cooler than our existing scanlines shader. Can I take this and replace it? Smile
Find all posts by this user
Quote this message in a reply
12-10-2013, 10:02 PM
Post: #129
RE: Custom PPSSPP shaders
Sure Smile
Find all posts by this user
Quote this message in a reply
12-10-2013, 11:11 PM
Post: #130
RE: Custom PPSSPP shaders
Perhaps have it as a separate shader instead? Doesn't hurt to have alternatives.

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
12-10-2013, 11:30 PM
Post: #131
RE: Custom PPSSPP shaders
(12-10-2013 11:11 PM)daxtsu Wrote:  Perhaps have it as a separate shader instead? Doesn't hurt to have alternatives.

Agreed.
better have alternatives than replacing the existing shader Big Grin

-my outdated testing rig-
Intel Core2Quad [email protected]
Shappire HD7750 1GB DDR5

contact me at:
[email protected]
facebook.com/love.grimangel
Find all posts by this user
Quote this message in a reply
12-11-2013, 08:35 AM
Post: #132
RE: Custom PPSSPP shaders
Added as a separate shader.
Find all posts by this user
Quote this message in a reply
12-11-2013, 08:41 AM
Post: #133
RE: Custom PPSSPP shaders
Should the shader is hosted out from the build such as homebrew did? Give user a choice to download the shader they want. That way can reduce the binary size especially android apk.
Find all posts by this user
Quote this message in a reply
12-11-2013, 09:06 AM
Post: #134
RE: Custom PPSSPP shaders
Shaders are absolutely tiny so that's not really a concern, but I guess the list may be cluttered with shaders you don't want. Maybe in the future.
Find all posts by this user
Quote this message in a reply
01-09-2014, 11:12 AM
Post: #135
RE: Custom PPSSPP shaders
Sharing my current favorite shader, a mix of ppsspp fxaa, bloom and natural shader : http://www.mediafire.com/?fq1c9pa3smpoz

A comparison with normal fxaa shader :
[Image: ibw0paizedDYVV.png]
this shader :
[Image: ibcJfNR744c23Y.png]
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: