Update defaultshaders.ini

Update natural.fsh

Create 4xhqglsl.vsh

Update 4xhqglsl.vsh

Create 4xhqglsl.fsh

Create aacolor.vsh

Create aacolor.fsh

Update cartoon.vsh

Update cartoon.fsh

Update cartoon.fsh

Update cartoon.fsh

Update and rename Scanlines.fsh to scanlines.fsh

Update aacolor.fsh

Update 4xhqglsl.vsh

Update aacolor.vsh

Update cartoon.vsh
This commit is contained in:
danyalzia
2013-10-14 16:21:11 +05:00
committed by DanyalZia
parent ffbac62f01
commit d45049e7b5
10 changed files with 284 additions and 64 deletions

View File

@@ -0,0 +1,76 @@
// 4xGLSL HqFilter shader, Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// by guest(r) (guest.r@gmail.com)
// License: GNU-GPL
// Shader notes: looks better with sprite games
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
const float mx = 0.325; // start smoothing factor
const float k = -0.250; // smoothing decrease factor
const float max_w = 0.25; // max. smoothing weigth
const float min_w =-0.05; // min smoothing/sharpening weigth
void main()
{
vec3 c = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 i1 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 i2 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 i3 = texture2D(sampler0, v_texcoord3.xy).xyz;
vec3 i4 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 o1 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 o3 = texture2D(sampler0, v_texcoord6.xy).xyz;
vec3 o2 = texture2D(sampler0, v_texcoord5.zw).xyz;
vec3 o4 = texture2D(sampler0, v_texcoord6.zw).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float ko1=dot(abs(o1-c),dt);
float ko2=dot(abs(o2-c),dt);
float ko3=dot(abs(o3-c),dt);
float ko4=dot(abs(o4-c),dt);
float sd1 = dot(abs(i1-i3),dt);
float sd2 = dot(abs(i2-i4),dt);
float w1 = step(ko1,ko3)*sd2;
float w2 = step(ko2,ko4)*sd1;
float w3 = step(ko3,ko1)*sd2;
float w4 = step(ko4,ko2)*sd1;
c = (w1*o1+w2*o2+w3*o3+w4*o4+0.1*c)/(w1+w2+w3+w4+0.1);
float lc = c.r+c.g+c.b+0.2;
w1 = (i1.r+i1.g+i1.b+lc)*0.2;
w1 = clamp(k*dot(abs(c-i1),dt)/w1+mx,min_w,max_w);
w2 = (i2.r+i2.g+i2.b+lc)*0.2;
w2 = clamp(k*dot(abs(c-i2),dt)/w2+mx,min_w,max_w);
w3 = (i3.r+i3.g+i3.b+lc)*0.2;
w3 = clamp(k*dot(abs(c-i3),dt)/w3+mx,min_w,max_w);
w4 = (i4.r+i4.g+i4.b+lc)*0.2;
w4 = clamp(k*dot(abs(c-i4),dt)/w4+mx,min_w,max_w);
gl_FragColor.xyz = w1*i1 + w2*i2 + w3*i3 + w4*i4 + (1.0-w1-w2-w3-w4)*c;
}

View File

@@ -0,0 +1,34 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform mat4 u_viewproj;
uniform vec2 u_texcoordDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
float scaleoffset = 0.8;
void main()
{
float x = u_texcoordDelta.x*scaleoffset;
float y = u_texcoordDelta.y*scaleoffset;
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 sd1 = dg1*0.5;
vec2 sd2 = dg2*0.5;
gl_Position = u_viewproj * a_position;
v_texcoord0=a_texcoord0.xyxy;
v_texcoord1.xy = v_texcoord0.xy - sd1;
v_texcoord2.xy = v_texcoord0.xy - sd2;
v_texcoord3.xy = v_texcoord0.xy + sd1;
v_texcoord4.xy = v_texcoord0.xy + sd2;
v_texcoord5.xy = v_texcoord0.xy - dg1;
v_texcoord6.xy = v_texcoord0.xy + dg1;
v_texcoord5.zw = v_texcoord0.xy - dg2;
v_texcoord6.zw = v_texcoord0.xy + dg2;
}

View File

@@ -1,22 +0,0 @@
//Simple Scanlines shader
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
uniform sampler2D sampler0;
float offset = 1.0;
float frequency = 170.0;
varying vec2 v_texcoord0;
void main()
{
float pos0 = (v_texcoord0.y + offset) * frequency;
float pos1 = cos((fract( pos0 ) - 0.5)*3.14);
vec4 pel = texture2D( sampler0, v_texcoord0 );
gl_FragColor = mix(vec4(0,0,0,0), pel, pos1);
}

View File

@@ -0,0 +1,63 @@
// AA-Color shader, Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// by guest(r) (guest.r@gmail.com)
// license: GNU-GPL
// Color variables
const vec3 c_ch = vec3(1.0,1.0,1.0); // rgb color channel intensity
const float a = 1.20 ; // saturation
const float b = 1.00 ; // brightness
const float c = 1.25 ; // contrast
// you can use contrast1,contrast2...contrast4 (or contrast0 for speedup)
float contrast0(float x)
{ return x; }
float contrast1(float x)
{ x = x*1.1547-1.0;
return sign(x)*pow(abs(x),1.0/c)*0.86 + 0.86;}
float contrast2(float x)
{ return normalize(vec2(pow(x,c),pow(0.86,c))).x*1.72;}
float contrast3(float x)
{ return 1.73*pow(0.57735*x,c); }
float contrast4(float x)
{ return clamp(0.866 + c*(x-0.866),0.05, 1.73); }
uniform sampler2D sampler0;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
void main()
{
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 c01 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 c21 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float k1=dot(abs(c01-c21),dt);
float k2=dot(abs(c10-c12),dt);
vec3 color = (k1*(c10+c12)+k2*(c01+c21)+0.001*c11)/(2.0*(k1+k2)+0.001);
float x = sqrt(dot(color,color));
color.r = pow(color.r+0.001,a);
color.g = pow(color.g+0.001,a);
color.b = pow(color.b+0.001,a);
gl_FragColor.xyz = contrast4(x)*normalize(color*c_ch)*b;
}

View File

@@ -0,0 +1,34 @@
// by guest(r) - guest.r@gmail.com
// license: GNU-GPL
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform mat4 u_viewproj;
uniform vec2 u_texcoordDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
varying vec4 v_texcoord2;
varying vec4 v_texcoord3;
varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
float scaleoffset = 0.8;
void main()
{
float x = u_texcoordDelta.x*scaleoffset;
float y = u_texcoordDelta.y*scaleoffset;
gl_Position = u_viewproj * a_position;
v_texcoord0 = a_texcoord0.xyxy;
v_texcoord1 = v_texcoord0;
v_texcoord2 = v_texcoord0;
v_texcoord4 = v_texcoord0;
v_texcoord5 = v_texcoord0;
v_texcoord1.y-=y;
v_texcoord2.y+=y;
v_texcoord4.x-=x;
v_texcoord5.x+=x;
}

View File

@@ -1,5 +1,5 @@
//Modified to use in PPSSPP, Grabbed from:
//http://forums.ngemu.com/showthread.php?t=76098
// Modified to use in PPSSPP. Grabbed from:
// http://forums.ngemu.com/showthread.php?t=76098
// Advanced Cartoon shader I
// by guest(r) (guest.r@gmail.com)
@@ -24,28 +24,28 @@ varying vec4 v_texcoord6;
void main()
{
vec3 c00 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 c20 = texture2D(sampler0, v_texcoord2.zw).xyz;
vec3 c01 = texture2D(sampler0, v_texcoord3.xy).xyz;
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 c21 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 c02 = texture2D(sampler0, v_texcoord1.zw).xyz;
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 c22 = texture2D(sampler0, v_texcoord6.xy).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
vec3 c00 = texture2D(sampler0, v_texcoord5.xy).xyz;
vec3 c10 = texture2D(sampler0, v_texcoord1.xy).xyz;
vec3 c20 = texture2D(sampler0, v_texcoord2.zw).xyz;
vec3 c01 = texture2D(sampler0, v_texcoord3.xy).xyz;
vec3 c11 = texture2D(sampler0, v_texcoord0.xy).xyz;
vec3 c21 = texture2D(sampler0, v_texcoord4.xy).xyz;
vec3 c02 = texture2D(sampler0, v_texcoord1.zw).xyz;
vec3 c12 = texture2D(sampler0, v_texcoord2.xy).xyz;
vec3 c22 = texture2D(sampler0, v_texcoord6.xy).xyz;
vec3 dt = vec3(1.0,1.0,1.0);
float d1=dot(abs(c00-c22),dt);
float d2=dot(abs(c20-c02),dt);
float hl=dot(abs(c01-c21),dt);
float vl=dot(abs(c10-c12),dt);
float d = bb*(d1+d2+hl+vl)/(dot(c11,dt)+0.15);
float d1=dot(abs(c00-c22),dt);
float d2=dot(abs(c20-c02),dt);
float hl=dot(abs(c01-c21),dt);
float vl=dot(abs(c10-c12),dt);
float d = bb*(d1+d2+hl+vl)/(dot(c11,dt)+0.15);
float lc = 4.0*length(c11);
float f = fract(lc); f*=f;
lc = 0.25*(floor(lc) + f*f)+0.05;
c11 = 4.0*normalize(c11);
vec3 frct = fract(c11); frct*=frct;
c11 = floor(c11)+ 0.05*dt + frct*frct;
gl_FragColor.xyz = 0.25*lc*(1.1-d*sqrt(d))*c11;
float lc = 4.0*length(c11);
float f = fract(lc); f*=f;
lc = 0.25*(floor(lc) + f*f)+0.05;
c11 = 4.0*normalize(c11);
vec3 frct = fract(c11); frct*=frct;
c11 = floor(c11)+ 0.05*dt + frct*frct;
gl_FragColor.xyz = 0.25*lc*(1.1-d*sqrt(d))*c11;
}

View File

@@ -1,6 +1,7 @@
attribute vec4 a_position;
attribute vec2 a_texcoord0;
uniform mat4 u_viewproj;
uniform vec2 u_texcoordDelta;
varying vec4 v_texcoord0;
varying vec4 v_texcoord1;
@@ -10,25 +11,25 @@ varying vec4 v_texcoord4;
varying vec4 v_texcoord5;
varying vec4 v_texcoord6;
float size = 2.0; //edge detection offset, 2.0-5.0 suitable range
float scaleoffset = 0.8; //edge detection offset
void main()
{
float x = (0.125/480.0)*size;
float y = (0.25/272.0)*size;
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 dx = vec2(x,0.0);
vec2 dy = vec2(0.0,y);
gl_Position = u_viewproj * a_position;
v_texcoord0=a_texcoord0.xyxy;
v_texcoord1.xy = v_texcoord0.xy - dy;
v_texcoord2.xy = v_texcoord0.xy + dy;
v_texcoord3.xy = v_texcoord0.xy - dx;
v_texcoord4.xy = v_texcoord0.xy + dx;
v_texcoord5.xy = v_texcoord0.xy - dg1;
v_texcoord6.xy = v_texcoord0.xy + dg1;
v_texcoord1.zw = v_texcoord0.xy - dg2;
v_texcoord2.zw = v_texcoord0.xy + dg2;
float x = u_texcoordDelta.x*scaleoffset;
float y = u_texcoordDelta.y*scaleoffset;
vec2 dg1 = vec2( x,y);
vec2 dg2 = vec2(-x,y);
vec2 dx = vec2(x,0.0);
vec2 dy = vec2(0.0,y);
gl_Position = u_viewproj * a_position;
v_texcoord0=a_texcoord0.xyxy;
v_texcoord1.xy = v_texcoord0.xy - dy;
v_texcoord2.xy = v_texcoord0.xy + dy;
v_texcoord3.xy = v_texcoord0.xy - dx;
v_texcoord4.xy = v_texcoord0.xy + dx;
v_texcoord5.xy = v_texcoord0.xy - dg1;
v_texcoord6.xy = v_texcoord0.xy + dg1;
v_texcoord1.zw = v_texcoord0.xy - dg2;
v_texcoord2.zw = v_texcoord0.xy + dg2;
}

View File

@@ -31,3 +31,11 @@ Vertex=fxaa.vsh
Name=Cartoon
Fragment=cartoon.fsh
Vertex=cartoon.vsh
[4xHqGLSL]
Name=4xHqGLSL
Fragment=4xhqglsl.fsh
Vertex=4xhqglsl.vsh
[AAColor]
Name=AA-Color
Fragment=aacolor.fsh
Vertex=aacolor.vsh

View File

@@ -1,4 +1,6 @@
// Natural shader, GLSL code adapted from:
// Natural Vision Shader, modified to use in PPSSPP.
// by ShadX (Modded by SimoneT)
// http://forums.ngemu.com/showthread.php?t=76098
#ifdef GL_ES

View File

@@ -0,0 +1,24 @@
// Simple Scanlines shader, created to use in PPSSPP.
// Looks good at Internal resolution same as viewport.
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define PI 3.14159
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
float offset = 1.0;
float frequency = 166;
void main()
{
float pos0 = (v_texcoord0.y + offset) * frequency;
float pos1 = cos((fract( pos0 ) - 0.5)*PI);
vec4 pel = texture2D( sampler0, v_texcoord0 );
gl_FragColor = mix(vec4(0,0,0,0), pel, pos1);
}