| 1 |
uniform sampler2D u_Texture0; |
| 2 |
varying vec2 texture_coordinate; |
| 3 |
|
| 4 |
void main() |
| 5 |
{ |
| 6 |
|
| 7 |
// Sampling The Texture And Passing It To The Frame Buffer |
| 8 |
gl_FragColor = texture2D(u_Texture0, texture_coordinate); |
| 9 |
|
| 10 |
// LEILEI EGA POSTPOOCESS BAGIN |
| 11 |
// 16 color ega works with highlight colors and normal colors, and to prevent /mixing/ of them we divide them first |
| 12 |
// there's either a mix of 0 and 170, or 85 and 255, |
| 13 |
// NEVER 255 and 170, or 0 and 85 (that's Web Safe territory) |
| 14 |
// this is my first glsl shader ever |
| 15 |
float egar; |
| 16 |
float egag; |
| 17 |
float egab; |
| 18 |
float egaa; // average, not alpha |
| 19 |
float egahighlightthreshold = 0.6; |
| 20 |
float egadarkhold = 0.1; |
| 21 |
|
| 22 |
gl_FragColor = gl_FragColor * 1.4; // more color vibrance necessary |
| 23 |
|
| 24 |
|
| 25 |
egar = gl_FragColor.r; |
| 26 |
egag = gl_FragColor.g; |
| 27 |
egab = gl_FragColor.b; |
| 28 |
egaa = egar + egag + egab / 3; |
| 29 |
|
| 30 |
if (egaa > egahighlightthreshold) |
| 31 |
{ // it's a highlight |
| 32 |
if (egar > egahighlightthreshold) egar = 1; |
| 33 |
else egar = 0.33; |
| 34 |
if (egag > egahighlightthreshold) egag = 1; |
| 35 |
else egag = 0.33; |
| 36 |
if (egab > egahighlightthreshold) egab = 1; |
| 37 |
else egab = 0.33; |
| 38 |
if ((egar == 0.33) && (egag == 0.33) && (egab == 0.33)){ |
| 39 |
egar = 1; egag = 1; egab = 1; } // swap dark gray for gray for stupid fix |
| 40 |
} |
| 41 |
else |
| 42 |
{ |
| 43 |
// it's not a highlight |
| 44 |
|
| 45 |
if (egar > egadarkhold) egar = 0.667; |
| 46 |
else egar = 0; |
| 47 |
if (egag > egadarkhold) egag = 0.667; |
| 48 |
else egag = 0; |
| 49 |
if (egab > egadarkhold - 0.02) egab = 0.667; |
| 50 |
else egab = 0; |
| 51 |
|
| 52 |
if ((egar == 0.667) && (egag == 0.667) && (egab == 0)){ |
| 53 |
egag = 0.33;} // ega is wierd when dealing with brown |
| 54 |
// it's the only color that uses 0 and 85 |
| 55 |
// (otherwise we get 'ski free dog pee' brown) |
| 56 |
} |
| 57 |
|
| 58 |
gl_FragColor.r = egar; // frag out! |
| 59 |
gl_FragColor.g = egag; |
| 60 |
gl_FragColor.b = egab; |
| 61 |
|
| 62 |
|
| 63 |
gl_FragColor = gl_FragColor * 0.5; |
| 64 |
// LEILEI EGA POSTPOOCESS END |
| 65 |
|
| 66 |
} |