Merge pull request #386 from myownfriend/master

Fixed formatting of post-processing shaders so they better match Dolphin's coding style
This commit is contained in:
shuffle2 2014-05-21 21:42:57 -07:00
commit 7a7aa8c5a3
29 changed files with 652 additions and 607 deletions

View File

@ -1,18 +1,16 @@
/* // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // Version 2, December 2004
Version 2, December 2004
Copyright (C) 2013 mudlord // Copyright (C) 2013 mudlord
Everyone is permitted to copy and distribute verbatim or modified // Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long // copies of this license document, and changing it is allowed as long
as the name is changed. // as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION // TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO. // 0. You just DO WHAT THE FUCK YOU WANT TO.
*/
uniform sampler2D samp9; uniform sampler2D samp9;

View File

@ -1,4 +1,5 @@
uniform sampler2D samp8; // textures // textures
uniform sampler2D samp8;
uniform sampler2D samp9; uniform sampler2D samp9;
const int char_width = 8; const int char_width = 8;
@ -18,21 +19,25 @@ void main()
vec2 char_pos = floor(uv0*resolution.xy/char_dim); vec2 char_pos = floor(uv0*resolution.xy/char_dim);
vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim; vec2 pixel_offset = floor(uv0*resolution.xy) - char_pos*char_dim;
float mindiff = float(char_width*char_height) * 100.0; // just a big number // just a big number
float mindiff = float(char_width*char_height) * 100.0;
float minc = 0.0; float minc = 0.0;
vec4 mina = vec4(0.0, 0.0, 0.0, 0.0); vec4 mina = vec4(0.0, 0.0, 0.0, 0.0);
vec4 minb = vec4(0.0, 0.0, 0.0, 0.0); vec4 minb = vec4(0.0, 0.0, 0.0, 0.0);
for(int i=0; i<char_count; i++) { for (int i=0; i<char_count; i++)
{
vec4 ff = vec4(0.0, 0.0, 0.0, 0.0); vec4 ff = vec4(0.0, 0.0, 0.0, 0.0);
vec4 f = vec4(0.0, 0.0, 0.0, 0.0); vec4 f = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ft = vec4(0.0, 0.0, 0.0, 0.0); vec4 ft = vec4(0.0, 0.0, 0.0, 0.0);
vec4 t = vec4(0.0, 0.0, 0.0, 0.0); vec4 t = vec4(0.0, 0.0, 0.0, 0.0);
vec4 tt = vec4(0.0, 0.0, 0.0, 0.0); vec4 tt = vec4(0.0, 0.0, 0.0, 0.0);
for(int x=0; x<char_width; x++) { for (int x=0; x<char_width; x++)
for(int y=0; y<char_height; y++) { {
for (int y=0; y<char_height; y++)
{
vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5; vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5;
vec4 tex = texture(samp9, tex_pos * resolution.zw); vec4 tex = texture(samp9, tex_pos * resolution.zw);
@ -48,39 +53,39 @@ void main()
} }
} }
/* // The next lines are a bit harder, hf :-)
The next lines are a bit harder, hf :-)
The idea is to find the perfect char with the perfect background color and the perfect font color. // The idea is to find the perfect char with the perfect background color and the perfect font color.
As this is an equation with three unknowns, we can't just try all chars and color combinations. // As this is an equation with three unknowns, we can't just try all chars and color combinations.
As criterion how "perfect" the selection is, we compare the "mean squared error" of the resulted colors of all chars. // As criterion how "perfect" the selection is, we compare the "mean squared error" of the resulted colors of all chars.
So, now the big issue: how to calculate the MSE without knowing the two colors ... // So, now the big issue: how to calculate the MSE without knowing the two colors ...
In the next steps, "a" is the font color, "b" is the background color, "f" is the font value at this pixel, "t" is the texture value // In the next steps, "a" is the font color, "b" is the background color, "f" is the font value at this pixel, "t" is the texture value
So the square error of one pixel is: // So the square error of one pixel is:
e = ( t - a⋅f - b⋅(1-f) ) ^ 2 // e = ( t - a⋅f - b⋅(1-f) ) ^ 2
In longer: // In longer:
e = a^2⋅f^2 - 2⋅a⋅b⋅f^2 + 2⋅a⋅b⋅f - 2⋅a⋅f⋅t + b^2⋅f^2 - 2⋅b^2⋅f + b^2 + 2⋅b⋅f⋅t - 2⋅b⋅t + t^2 // e = a^2⋅f^2 - 2⋅a⋅b⋅f^2 + 2⋅a⋅b⋅f - 2⋅a⋅f⋅t + b^2⋅f^2 - 2⋅b^2⋅f + b^2 + 2⋅b⋅f⋅t - 2⋅b⋅t + t^2
The sum of all errors is: (as shortcut, ff,f,ft,t,tt are now the sums like declared above, sum(1) is the count of pixels) // The sum of all errors is: (as shortcut, ff,f,ft,t,tt are now the sums like declared above, sum(1) is the count of pixels)
sum(e) = a^2⋅ff - 2⋅a^2⋅ff + 2⋅a⋅b⋅f - 2⋅a⋅ft + b^2⋅ff - 2⋅b^2⋅f + b^2⋅sum(1) + 2⋅b⋅ft - 2⋅b⋅t + tt // sum(e) = a^2⋅ff - 2⋅a^2⋅ff + 2⋅a⋅b⋅f - 2⋅a⋅ft + b^2⋅ff - 2⋅b^2⋅f + b^2⋅sum(1) + 2⋅b⋅ft - 2⋅b⋅t + tt
To find the minimum, we have to derive this by "a" and "b": // To find the minimum, we have to derive this by "a" and "b":
d/da sum(e) = 2⋅a⋅ff + 2⋅b⋅f - 2⋅b⋅ff - 2⋅ft // d/da sum(e) = 2⋅a⋅ff + 2⋅b⋅f - 2⋅b⋅ff - 2⋅ft
d/db sum(e) = 2⋅a⋅f - 2⋅a⋅ff - 4⋅b⋅f + 2⋅b⋅ff + 2⋅b⋅sum(1) + 2⋅ft - 2⋅t // d/db sum(e) = 2⋅a⋅f - 2⋅a⋅ff - 4⋅b⋅f + 2⋅b⋅ff + 2⋅b⋅sum(1) + 2⋅ft - 2⋅t
// So, both equations must be zero at minimum and there is only one solution.
So, both equations must be zero at minimum and there is only one solution.
*/
vec4 a = (f*ft - ff*t + f*t - ft*float(char_pixels)) / (f*f - ff*float(char_pixels)); vec4 a = (f*ft - ff*t + f*t - ft*float(char_pixels)) / (f*f - ff*float(char_pixels));
vec4 b = (f*ft - ff*t) / (f*f - ff*float(char_pixels)); vec4 b = (f*ft - ff*t) / (f*f - ff*float(char_pixels));
vec4 diff = a*a*ff + 2.0*a*b*f - 2.0*a*b*ff - 2.0*a*ft + b*b *(-2.0*f + ff + float(char_pixels)) + 2.0*b*ft - 2.0*b*t + tt; vec4 diff = a*a*ff + 2.0*a*b*f - 2.0*a*b*ff - 2.0*a*ft + b*b *(-2.0*f + ff + float(char_pixels)) + 2.0*b*ft - 2.0*b*t + tt;
float diff_f = dot(diff, vec4(1.0, 1.0, 1.0, 1.0)); float diff_f = dot(diff, vec4(1.0, 1.0, 1.0, 1.0));
if(diff_f < mindiff) { if (diff_f < mindiff)
{
mindiff = diff_f; mindiff = diff_f;
minc = float(i); minc = float(i);
mina = a; mina = a;

View File

@ -7,6 +7,7 @@ uniform vec4 resolution;
void main() void main()
{ {
//Changethis to increase the number of colors. //Changethis to increase the number of colors.
int numColors =8; int numColors =8;
@ -20,8 +21,6 @@ void main()
float4 c0 = color - float4(edge, edge, edge, edge) * 12.0; float4 c0 = color - float4(edge, edge, edge, edge) * 12.0;
float red = 0.0; float red = 0.0;
float green = 0.0; float green = 0.0;
float blue = 0.0; float blue = 0.0;
@ -33,12 +32,14 @@ void main()
float colorN = 0.0; float colorN = 0.0;
float colorB = 0.0; float colorB = 0.0;
for (count = 1; count <= numColors; count++)
for(count = 1; count <= numColors ; count++){ {
colorN = float(count / numColors); colorN = float(count / numColors);
if ( c0.r <= colorN && c0.r >= colorB && rr == false ){ if ( c0.r <= colorN && c0.r >= colorB && rr == false )
if (count == 1){ {
if (count == 1)
{
if (colorN >= 0.1) if (colorN >= 0.1)
red = 0.01; red = 0.01;
else else
@ -52,8 +53,10 @@ void main()
rr = true; rr = true;
} }
if (c0.b <= colorN && c0.b >= colorB && bb == false){ if (c0.b <= colorN && c0.b >= colorB && bb == false)
if (count == 1){ {
if (count == 1)
{
if (colorN >= 0.1) if (colorN >= 0.1)
blue = 0.01; blue = 0.01;
else else
@ -67,8 +70,10 @@ void main()
bb = true; bb = true;
} }
if (c0.g <= colorN && c0.g >= colorB && gg == false){ if (c0.g <= colorN && c0.g >= colorB && gg == false)
if (count == 1){ {
if (count == 1)
{
if (colorN >= 0.1) if (colorN >= 0.1)
green = 0.01; green = 0.01;
else else
@ -82,11 +87,10 @@ void main()
} }
colorB = float(count / numColors); colorB = float(count / numColors);
if (rr == true && bb == true && gg == true) if (rr == true && bb == true && gg == true)
break; break;
} }
ocol0 = float4(red, green, blue, c0.a); ocol0 = float4(red, green, blue, c0.a);
} }

View File

@ -13,5 +13,6 @@ void main()
green = c0.g + (c0.b / 2.0); green = c0.g + (c0.b / 2.0);
else else
red = c0.r + 0.4; red = c0.r + 0.4;
ocol0 = vec4(red, green, 0.0, 1.0); ocol0 = vec4(red, green, 0.0, 1.0);
} }

View File

@ -20,5 +20,6 @@ void main()
blue = c0.r; blue = c0.r;
green = c0.r; green = c0.r;
} }
ocol0 = vec4(red, green, blue, 1.0); ocol0 = vec4(red, green, blue, 1.0);
} }

View File

@ -31,7 +31,6 @@ void main()
else else
green = c0.g - c0.g / 2.0; green = c0.g - c0.g / 2.0;
if (blue2 > 0.3) if (blue2 > 0.3)
blue = c0.b+ c0.b / 2.0; blue = c0.b+ c0.b / 2.0;
else else

View File

@ -12,9 +12,7 @@ void main()
red = c0.r; red = c0.r;
if (c0.r > 0.0 && c0.g > c0.r)
if (c0.r > 0.0)
if (c0.g > c0.r)
green = (c0.g - (c0.g - c0.r)) / 3.0; green = (c0.g - (c0.g - c0.r)) / 3.0;
if (c0.b > 0.0 && c0.r < 0.25) if (c0.b > 0.0 && c0.r < 0.25)

View File

@ -10,9 +10,13 @@ void main()
float4 emboss = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw))*2.0; float4 emboss = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw))*2.0;
emboss -= (texture(samp9, uv0+float2(1,-1)*resolution.zw).rgba - texture(samp9, uv0+float2(-1,1)*resolution.zw).rgba); emboss -= (texture(samp9, uv0+float2(1,-1)*resolution.zw).rgba - texture(samp9, uv0+float2(-1,1)*resolution.zw).rgba);
float4 color = texture(samp9, uv0).rgba; float4 color = texture(samp9, uv0).rgba;
if (color.r > 0.8 && color.b + color.b < 0.2) if (color.r > 0.8 && color.b + color.b < 0.2)
{
ocol0 = float4(1,0,0,0); ocol0 = float4(1,0,0,0);
else { }
else
{
color += emboss; color += emboss;
if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5) if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5)
ocol0 = float4(1,1,1,1); ocol0 = float4(1,1,1,1);

View File

@ -9,9 +9,7 @@ void main()
float green = c0.g; float green = c0.g;
if (c0.g < 0.50) if (c0.g < 0.50)
{
green = c0.r + c0.b; green = c0.r + c0.b;
}
ocol0 = float4(0.0, green, 0.0, 1.0); ocol0 = float4(0.0, green, 0.0, 1.0);
} }

View File

@ -10,6 +10,7 @@ void main()
//variables //variables
float internalresolution = 1278.0; float internalresolution = 1278.0;
float4 c0 = texture(samp9, uv0).rgba; float4 c0 = texture(samp9, uv0).rgba;
//blur //blur
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0); float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
float blursize = 1.5; float blursize = 1.5;
@ -23,34 +24,46 @@ void main()
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize) * resolution.zw); blurtotal += texture(samp9, uv0 + float2( 0.0, blursize) * resolution.zw);
blurtotal *= 0.125; blurtotal *= 0.125;
c0 = blurtotal; c0 = blurtotal;
//greyscale //greyscale
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b)); float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
// brighten // brighten
grey = grey * 0.5 + 0.7; grey = grey * 0.5 + 0.7;
// darken edges // darken edges
float x = uv0.x * resolution.x; float x = uv0.x * resolution.x;
float y = uv0.y * resolution.y; float y = uv0.y * resolution.y;
if (x > internalresolution/2.0) x = internalresolution-x; if (x > internalresolution/2.0)
if (y > internalresolution/2.0) y = internalresolution-y; x = internalresolution-x;
if (x > internalresolution/2.0*0.95) x = internalresolution/2.0*0.95; if (y > internalresolution/2.0)
if (y > internalresolution/2.0*0.95) y = internalresolution/2.0*0.95; y = internalresolution-y;
if (x > internalresolution/2.0*0.95)
x = internalresolution/2.0*0.95;
if (y > internalresolution/2.0*0.95)
y = internalresolution/2.0*0.95;
x = -x+641.0; x = -x+641.0;
y = -y+641.0; y = -y+641.0;
/*****inline square root routines*****/ /*****inline square root routines*****/
// bit of a performance bottleneck. // bit of a performance bottleneck.
// neccessary to make the darkened area rounded // neccessary to make the darkened area rounded
// instead of rhombus-shaped. // instead of rhombus-shaped.
float sqrt = x / 10.0; float sqrt = x / 10.0;
while((sqrt*sqrt) < x) sqrt+=0.1;
while ((sqrt*sqrt) < x)
sqrt+=0.1;
x = sqrt; x = sqrt;
sqrt = y / 10.0; sqrt = y / 10.0;
while((sqrt*sqrt) < y) sqrt+=0.1; while ((sqrt*sqrt) < y)
sqrt+=0.1;
y = sqrt; y = sqrt;
/*****end of inline square root routines*****/
x *= 2.0; x *= 2.0;
y *= 2.0; y *= 2.0;
grey -= x / 200.0; grey -= x / 200.0;
grey -= y / 200.0; grey -= y / 200.0;
// output // output
ocol0 = float4(0.0, grey, 0.0, 1.0); ocol0 = float4(0.0, grey, 0.0, 1.0);
} }

View File

@ -10,6 +10,7 @@ void main()
//variables //variables
float internalresolution = 1278.0; float internalresolution = 1278.0;
float4 c0 = texture(samp9, uv0).rgba; float4 c0 = texture(samp9, uv0).rgba;
//blur //blur
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0); float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
float blursize = 1.5; float blursize = 1.5;
@ -23,8 +24,10 @@ void main()
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw); blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
blurtotal *= 0.125; blurtotal *= 0.125;
c0 = blurtotal; c0 = blurtotal;
//greyscale //greyscale
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b)); float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
// brighten and apply horizontal scanlines // brighten and apply horizontal scanlines
// This would have been much simpler if I could get the stupid modulo (%) to work // This would have been much simpler if I could get the stupid modulo (%) to work
// If anyone who is more well versed in Cg knows how to do this it'd be slightly more efficient // If anyone who is more well versed in Cg knows how to do this it'd be slightly more efficient
@ -32,30 +35,44 @@ void main()
float vPos = uv0.y*resolution.y / 9.0; float vPos = uv0.y*resolution.y / 9.0;
float lineIntensity = (((vPos - floor(vPos)) * 9.0) - 4.0) / 40.0; float lineIntensity = (((vPos - floor(vPos)) * 9.0) - 4.0) / 40.0;
grey = grey * 0.5 + 0.7 + lineIntensity; grey = grey * 0.5 + 0.7 + lineIntensity;
// darken edges // darken edges
float x = uv0.x * resolution.x; float x = uv0.x * resolution.x;
float y = uv0.y * resolution.y; float y = uv0.y * resolution.y;
if (x > internalresolution/2.0) x = internalresolution-x;
if (y > internalresolution/2.0) y = internalresolution-y; if (x > internalresolution/2.0)
if (x > internalresolution/2.0*0.95) x = internalresolution/2.0*0.95; x = internalresolution-x;
if (y > internalresolution/2.0*0.95) y = internalresolution/2.0*0.95;
if (y > internalresolution/2.0)
y = internalresolution-y;
if (x > internalresolution/2.0*0.95)
x = internalresolution/2.0*0.95;
if (y > internalresolution/2.0*0.95)
y = internalresolution/2.0*0.95;
x = -x + 641.0; x = -x + 641.0;
y = -y + 641.0; y = -y + 641.0;
/*****inline square root routines*****/
//****inline square root routines*****/
// bit of a performance bottleneck. // bit of a performance bottleneck.
// neccessary to make the darkened area rounded // neccessary to make the darkened area rounded
// instead of rhombus-shaped. // instead of rhombus-shaped.
float sqrt = x / 10.0; float sqrt = x / 10.0;
while((sqrt*sqrt) < x) sqrt+=0.1; while ((sqrt*sqrt) < x)
sqrt+=0.1;
x = sqrt; x = sqrt;
sqrt = y / 10.0; sqrt = y / 10.0;
while((sqrt*sqrt) < y) sqrt+=0.1; while ((sqrt*sqrt) < y)
sqrt+=0.1;
y = sqrt; y = sqrt;
/*****end of inline square root routines*****/
x *= 2.0; x *= 2.0;
y *= 2.0; y *= 2.0;
grey -= x / 200.0; grey -= x / 200.0;
grey -= y / 200.0; grey -= y / 200.0;
// output // output
ocol0 = float4(0.0, grey, 0.0, 1.0); ocol0 = float4(0.0, grey, 0.0, 1.0);
} }

View File

@ -11,19 +11,13 @@ void main()
float blue = 0.0; float blue = 0.0;
if (c0.r > 0.25) if (c0.r > 0.25)
{
red = c0.r; red = c0.r;
}
if (c0.g > 0.25) if (c0.g > 0.25)
{
green = c0.g; green = c0.g;
}
if (c0.b > 0.25) if (c0.b > 0.25)
{
blue = c0.b; blue = c0.b;
}
ocol0 = float4(red, green, blue, 1.0); ocol0 = float4(red, green, blue, 1.0);
} }

View File

@ -8,11 +8,11 @@ float bound(float color)
if (color < 0.35) if (color < 0.35)
{ {
if (color < 0.25) if (color < 0.25)
{
return color; return color;
}
return 0.5; return 0.5;
} }
return 1.0; return 1.0;
} }
@ -21,4 +21,3 @@ void main()
float4 c0 = texture(samp9, uv0); float4 c0 = texture(samp9, uv0);
ocol0 = float4(bound(c0.r), bound(c0.g), bound(c0.b), c0.a); ocol0 = float4(bound(c0.r), bound(c0.g), bound(c0.b), c0.a);
} }

View File

@ -13,54 +13,66 @@ void main()
float max = 0.8; float max = 0.8;
float min = 0.3; float min = 0.3;
if(c0.r > c0.g && c0.b > c0.g){ if (c0.r > c0.g && c0.b > c0.g)
if(c0.r < c0.b + 0.05 && c0.b < c0.r + 0.05){ {
if (c0.r < c0.b + 0.05 && c0.b < c0.r + 0.05)
{
red = 0.7; red = 0.7;
blue = 0.7; blue = 0.7;
green = 0.05; green = 0.05;
} }
else if(c0.r > c0.b + 0.05){ else if (c0.r > c0.b + 0.05)
{
red = 0.7; red = 0.7;
blue = 0.05; blue = 0.05;
green = 0.05; green = 0.05;
} }
else if (c0.b > c0.r + 0.05){ else if (c0.b > c0.r + 0.05)
{
red = 0.05; red = 0.05;
blue = 0.7; blue = 0.7;
green = 0.05; green = 0.05;
} }
} }
if(c0.r > c0.b && c0.g > c0.b){ if (c0.r > c0.b && c0.g > c0.b)
if(c0.r < c0.g + 0.05 && c0.g < c0.r + 0.05){ {
if (c0.r < c0.g + 0.05 && c0.g < c0.r + 0.05)
{
red = 0.7; red = 0.7;
blue = 0.05; blue = 0.05;
green = 0.7; green = 0.7;
} }
else if(c0.r > c0.g + 0.05){ else if (c0.r > c0.g + 0.05)
{
red = 0.7; red = 0.7;
blue = 0.05; blue = 0.05;
green = 0.05; green = 0.05;
} }
else if (c0.g > c0.r + 0.05){ else if (c0.g > c0.r + 0.05)
{
red = 0.05; red = 0.05;
blue = 0.05; blue = 0.05;
green = 0.7; green = 0.7;
} }
} }
if(c0.g > c0.r && c0.b > c0.r){ if (c0.g > c0.r && c0.b > c0.r)
if(c0.g < c0.b + 0.05 && c0.b < c0.g + 0.05){ {
if (c0.g < c0.b + 0.05 && c0.b < c0.g + 0.05)
{
red = 0.05; red = 0.05;
blue = 0.7; blue = 0.7;
green = 0.7; green = 0.7;
} }
else if(c0.g > c0.b + 0.05){ else if (c0.g > c0.b + 0.05)
{
red = 0.05; red = 0.05;
blue = 0.05; blue = 0.05;
green = 0.7; green = 0.7;
} }
else if (c0.b > c0.g + 0.05){ else if (c0.b > c0.g + 0.05)
{
red = 0.05; red = 0.05;
blue = 0.7; blue = 0.7;
green = 0.05; green = 0.05;

View File

@ -6,9 +6,11 @@ in vec2 uv0;
void main() void main()
{ {
vec4 c0 = texture(samp9, uv0); vec4 c0 = texture(samp9, uv0);
// Same coefficients as grayscale2 at this point // Same coefficients as grayscale2 at this point
float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b); float avg = (0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b);
float red=avg; float red=avg;
// Not sure about these coefficients, they just seem to produce the proper yellow // Not sure about these coefficients, they just seem to produce the proper yellow
float green=avg*.75; float green=avg*.75;
float blue=avg*.5; float blue=avg*.5;

View File

@ -14,9 +14,11 @@ void main()
tmp += c0 - texture(samp9, uv0 + float2(2.0, -2.0)*resolution.zw).rgba; tmp += c0 - texture(samp9, uv0 + float2(2.0, -2.0)*resolution.zw).rgba;
tmp += c0 - texture(samp9, uv0 - float2(2.0, -2.0)*resolution.zw).rgba; tmp += c0 - texture(samp9, uv0 - float2(2.0, -2.0)*resolution.zw).rgba;
float grey = ((0.222 * tmp.r) + (0.707 * tmp.g) + (0.071 * tmp.b)); float grey = ((0.222 * tmp.r) + (0.707 * tmp.g) + (0.071 * tmp.b));
// get rid of the bottom line, as it is incorrect. // get rid of the bottom line, as it is incorrect.
if (uv0.y*resolution.y < 163.0) if (uv0.y*resolution.y < 163.0)
tmp = float4(1.0, 1.0, 1.0, 1.0); tmp = float4(1.0, 1.0, 1.0, 1.0);
c0 = c0 + 1.0 - grey * 7.0; c0 = c0 + 1.0 - grey * 7.0;
ocol0 = float4(c0.r, c0.g, c0.b, 1.0); ocol0 = float4(c0.r, c0.g, c0.b, 1.0);
} }

View File

@ -10,13 +10,13 @@ uniform vec4 resolution;
void main() void main()
{ {
float4 c0 = texture(samp9, uv0).rgba; // Source Color // Source Color
float4 c0 = texture(samp9, uv0).rgba;
float sep = 5.0; float sep = 5.0;
float red = c0.r; float red = c0.r;
float green = c0.g; float green = c0.g;
float blue = c0.b; float blue = c0.b;
// Left Eye (Red) // Left Eye (Red)
float4 c1 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba; float4 c1 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
red = max(c0.r, c1.r); red = max(c0.r, c1.r);
@ -27,6 +27,5 @@ void main()
green = max(c0.g, cyan); green = max(c0.g, cyan);
blue = max(c0.b, cyan); blue = max(c0.b, cyan);
ocol0 = float4(red, green, blue, c0.a); ocol0 = float4(red, green, blue, c0.a);
} }

View File

@ -10,13 +10,13 @@ uniform vec4 resolution;
void main() void main()
{ {
float4 c0 = texture(samp9, uv0).rgba; // Source Color // Source Color
float4 c0 = texture(samp9, uv0).rgba;
float sep = 5.0; float sep = 5.0;
float red = c0.r; float red = c0.r;
float green = c0.g; float green = c0.g;
float blue = c0.b; float blue = c0.b;
// Left Eye (Amber) // Left Eye (Amber)
float4 c2 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba; float4 c2 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
float amber = (c2.r + c2.g) / 2.0; float amber = (c2.r + c2.g) / 2.0;
@ -27,6 +27,5 @@ void main()
float4 c1 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba; float4 c1 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
blue = max(c0.b, c1.b); blue = max(c0.b, c1.b);
ocol0 = float4(red, green, blue, c0.a); ocol0 = float4(red, green, blue, c0.a);
} }