~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to assets/shaders/natural.fsh

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Natural Vision Shader, modified to use in PPSSPP.
 
2
 
 
3
// by ShadX (Modded by SimoneT)
 
4
// http://forums.ngemu.com/showthread.php?t=76098
 
5
 
 
6
#ifdef GL_ES
 
7
precision mediump float;
 
8
precision mediump int;
 
9
#endif
 
10
 
 
11
uniform sampler2D sampler0;
 
12
varying vec4 v_texcoord0;
 
13
varying vec4 v_texcoord1;
 
14
varying vec4 v_texcoord2;
 
15
varying vec4 v_texcoord3;
 
16
 
 
17
const mat3 RGBtoYIQ = mat3(0.299, 0.596, 0.212, 
 
18
                           0.587,-0.275,-0.523, 
 
19
                           0.114,-0.321, 0.311);
 
20
 
 
21
const mat3 YIQtoRGB = mat3(1.0, 1.0, 1.0,
 
22
                           0.95568806036115671171,-0.27158179694405859326,-1.1081773266826619523,
 
23
                           0.61985809445637075388,-0.64687381613840131330, 1.7050645599191817149);
 
24
 
 
25
const vec3 val00 = vec3( 1.2, 1.2, 1.2);
 
26
 
 
27
void main()
 
28
{
 
29
vec3 c0,c1;
 
30
 
 
31
c0 = texture2D(sampler0,v_texcoord0.xy).xyz;
 
32
c0+=(texture2D(sampler0,v_texcoord0.zy).xyz)*0.25;
 
33
c0+=(texture2D(sampler0,v_texcoord0.xw).xyz)*0.25;
 
34
c0+=(texture2D(sampler0,v_texcoord0.zw).xyz)*0.125;
 
35
 
 
36
c0+= texture2D(sampler0,v_texcoord1.xy).xyz;
 
37
c0+=(texture2D(sampler0,v_texcoord1.zy).xyz)*0.25;
 
38
c0+=(texture2D(sampler0,v_texcoord1.xw).xyz)*0.25;
 
39
c0+=(texture2D(sampler0,v_texcoord1.zw).xyz)*0.125;
 
40
 
 
41
c0+= texture2D(sampler0,v_texcoord2.xy).xyz;
 
42
c0+=(texture2D(sampler0,v_texcoord2.zy).xyz)*0.25;
 
43
c0+=(texture2D(sampler0,v_texcoord2.xw).xyz)*0.25;
 
44
c0+=(texture2D(sampler0,v_texcoord2.zw).xyz)*0.125;
 
45
 
 
46
c0+= texture2D(sampler0,v_texcoord3.xy).xyz;
 
47
c0+=(texture2D(sampler0,v_texcoord3.zy).xyz)*0.25;
 
48
c0+=(texture2D(sampler0,v_texcoord3.xw).xyz)*0.25;
 
49
c0+=(texture2D(sampler0,v_texcoord3.zw).xyz)*0.125;
 
50
c0*=0.153846153846;
 
51
 
 
52
c1=RGBtoYIQ*c0;
 
53
 
 
54
c1=vec3(pow(c1.x,val00.x),c1.yz*val00.yz);
 
55
 
 
56
gl_FragColor.rgb=YIQtoRGB*c1;
 
57
gl_FragColor.a = 1.0;
 
58
}