mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-08 14:58:36 +00:00
Added new Natural Colors PP shader (removed blur) (#10782)
Add Natural Colors shader with removed blur.
This commit is contained in:
parent
84203e8d3d
commit
8e8c21fa0b
@ -14,6 +14,10 @@ Vertex=fxaa.vsh
|
||||
Name=Natural Colors
|
||||
Fragment=natural.fsh
|
||||
Vertex=natural.vsh
|
||||
[NaturalA]
|
||||
Name=Natural Colors (No Blur)
|
||||
Fragment=naturalA.fsh
|
||||
Vertex=naturalA.vsh
|
||||
[Vignette]
|
||||
Name=Vignette
|
||||
Author=Henrik
|
||||
@ -82,4 +86,4 @@ Name=Video aware guest.r AA 4.o
|
||||
Author=guest.r(tweak by LunaMoo)
|
||||
Fragment=videoAA.fsh
|
||||
Vertex=fxaa.vsh
|
||||
OutputResolution=True
|
||||
OutputResolution=True
|
||||
|
77
assets/shaders/naturalA.fsh
Normal file
77
assets/shaders/naturalA.fsh
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
Natural Colors
|
||||
|
||||
Copyright (C) 2006 guest(r) - guest.r@gmail.com
|
||||
|
||||
part of code by ShadX
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#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 mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212,
|
||||
0.587,-0.275,-0.523,
|
||||
0.114,-0.321, 0.311);
|
||||
|
||||
const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
|
||||
0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
|
||||
0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);
|
||||
|
||||
const vec3 val00 = vec3( 1.2, 1.2, 1.2);
|
||||
|
||||
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);
|
||||
|
||||
float d1=dot(abs(c00-c22),dt)+0.0001;
|
||||
float d2=dot(abs(c20-c02),dt)+0.0001;
|
||||
float hl=dot(abs(c01-c21),dt)+0.0001;
|
||||
float vl=dot(abs(c10-c12),dt)+0.0001;
|
||||
|
||||
float md = d1+d2; float mc = hl+vl;
|
||||
hl*= md;vl*= md; d1*= mc;d2*= mc;
|
||||
|
||||
float ww = d1+d2+hl+vl;
|
||||
|
||||
c00 = RGBtoYIQ*((hl*(c10+c12)+vl*(c01+c21)+d1*(c20+c02)+d2*(c00+c22)+ww*c11)/(3.0*ww));
|
||||
|
||||
c00 = vec3(pow(c00.x,val00.x),c00.yz*val00.yz);
|
||||
|
||||
gl_FragColor.xyz= YIQtoRGB*c00;
|
||||
}
|
55
assets/shaders/naturalA.vsh
Normal file
55
assets/shaders/naturalA.vsh
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (C) 2005 guest(r) - guest.r@gmail.com
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
attribute vec4 a_position;
|
||||
attribute vec2 a_texcoord0;
|
||||
uniform vec2 u_texelDelta;
|
||||
|
||||
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.6;
|
||||
|
||||
void main()
|
||||
|
||||
{
|
||||
float x = u_texelDelta.x*scaleoffset;
|
||||
float y = u_texelDelta.y*scaleoffset;
|
||||
vec2 dg1 = vec2( x,y);
|
||||
vec2 dg2 = vec2(-x,y);
|
||||
vec2 sd1 = dg1*0.5;
|
||||
vec2 sd2 = dg2*0.5;
|
||||
gl_Position = 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_texcoord1.zw = v_texcoord0.xy - dg2;
|
||||
v_texcoord2.zw = v_texcoord0.xy + dg2;
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user