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:
commit
7a7aa8c5a3
|
@ -7,55 +7,55 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//Change this number to increase the pixel size.
|
//Change this number to increase the pixel size.
|
||||||
float pixelSize = 3.0;
|
float pixelSize = 3.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;
|
||||||
|
|
||||||
vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
|
vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
|
||||||
|
|
||||||
vec4 c0 = texture(samp9, pos);
|
vec4 c0 = texture(samp9, pos);
|
||||||
|
|
||||||
if (c0.r < 0.1)
|
if (c0.r < 0.1)
|
||||||
red = 0.1;
|
red = 0.1;
|
||||||
else if (c0.r < 0.20)
|
else if (c0.r < 0.20)
|
||||||
red = 0.20;
|
red = 0.20;
|
||||||
else if (c0.r < 0.40)
|
else if (c0.r < 0.40)
|
||||||
red = 0.40;
|
red = 0.40;
|
||||||
else if (c0.r < 0.60)
|
else if (c0.r < 0.60)
|
||||||
red = 0.60;
|
red = 0.60;
|
||||||
else if (c0.r < 0.80)
|
else if (c0.r < 0.80)
|
||||||
red = 0.80;
|
red = 0.80;
|
||||||
else
|
else
|
||||||
red = 1.0;
|
red = 1.0;
|
||||||
|
|
||||||
if (c0.b < 0.1)
|
if (c0.b < 0.1)
|
||||||
blue = 0.1;
|
blue = 0.1;
|
||||||
else if (c0.b < 0.20)
|
else if (c0.b < 0.20)
|
||||||
blue = 0.20;
|
blue = 0.20;
|
||||||
else if (c0.b < 0.40)
|
else if (c0.b < 0.40)
|
||||||
blue = 0.40;
|
blue = 0.40;
|
||||||
else if (c0.b < 0.60)
|
else if (c0.b < 0.60)
|
||||||
blue = 0.60;
|
blue = 0.60;
|
||||||
else if (c0.b < 0.80)
|
else if (c0.b < 0.80)
|
||||||
blue = 0.80;
|
blue = 0.80;
|
||||||
else
|
else
|
||||||
blue = 1.0;
|
blue = 1.0;
|
||||||
|
|
||||||
if (c0.g < 0.1)
|
if (c0.g < 0.1)
|
||||||
green = 0.1;
|
green = 0.1;
|
||||||
else if (c0.g < 0.20)
|
else if (c0.g < 0.20)
|
||||||
green = 0.20;
|
green = 0.20;
|
||||||
else if (c0.g < 0.40)
|
else if (c0.g < 0.40)
|
||||||
green = 0.40;
|
green = 0.40;
|
||||||
else if (c0.g < 0.60)
|
else if (c0.g < 0.60)
|
||||||
green = 0.60;
|
green = 0.60;
|
||||||
else if (c0.g < 0.80)
|
else if (c0.g < 0.80)
|
||||||
green = 0.80;
|
green = 0.80;
|
||||||
else
|
else
|
||||||
green = 1.0;
|
green = 1.0;
|
||||||
|
|
||||||
ocol0 = vec4(red, green, blue, c0.a);
|
ocol0 = vec4(red, green, blue, c0.a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,80 +7,80 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//Change this number to increase the pixel size.
|
//Change this number to increase the pixel size.
|
||||||
float pixelSize = 2.0;
|
float pixelSize = 2.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;
|
||||||
|
|
||||||
vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
|
vec2 pos = floor(uv0 * resolution.xy / pixelSize) * pixelSize * resolution.zw;
|
||||||
|
|
||||||
vec4 c0 = texture(samp9, pos);
|
vec4 c0 = texture(samp9, pos);
|
||||||
|
|
||||||
if (c0.r < 0.06)
|
if (c0.r < 0.06)
|
||||||
red = 0.06;
|
red = 0.06;
|
||||||
else if (c0.r < 0.13)
|
else if (c0.r < 0.13)
|
||||||
red = 0.13;
|
red = 0.13;
|
||||||
else if (c0.r < 0.26)
|
else if (c0.r < 0.26)
|
||||||
red = 0.26;
|
red = 0.26;
|
||||||
else if (c0.r < 0.33)
|
else if (c0.r < 0.33)
|
||||||
red = 0.33;
|
red = 0.33;
|
||||||
else if (c0.r < 0.46)
|
else if (c0.r < 0.46)
|
||||||
red = 0.46;
|
red = 0.46;
|
||||||
else if (c0.r < 0.60)
|
else if (c0.r < 0.60)
|
||||||
red = 0.60;
|
red = 0.60;
|
||||||
else if (c0.r < 0.73)
|
else if (c0.r < 0.73)
|
||||||
red = 0.73;
|
red = 0.73;
|
||||||
else if (c0.r < 0.80)
|
else if (c0.r < 0.80)
|
||||||
red = 0.80;
|
red = 0.80;
|
||||||
else if (c0.r < 0.93)
|
else if (c0.r < 0.93)
|
||||||
red = 0.93;
|
red = 0.93;
|
||||||
else
|
else
|
||||||
red = 1.0;
|
red = 1.0;
|
||||||
|
|
||||||
if (c0.b < 0.06)
|
if (c0.b < 0.06)
|
||||||
blue = 0.06;
|
blue = 0.06;
|
||||||
else if (c0.b < 0.13)
|
else if (c0.b < 0.13)
|
||||||
blue = 0.13;
|
blue = 0.13;
|
||||||
else if (c0.b < 0.26)
|
else if (c0.b < 0.26)
|
||||||
blue = 0.26;
|
blue = 0.26;
|
||||||
else if (c0.b < 0.33)
|
else if (c0.b < 0.33)
|
||||||
blue = 0.33;
|
blue = 0.33;
|
||||||
else if (c0.b < 0.46)
|
else if (c0.b < 0.46)
|
||||||
blue = 0.46;
|
blue = 0.46;
|
||||||
else if (c0.b < 0.60)
|
else if (c0.b < 0.60)
|
||||||
blue = 0.60;
|
blue = 0.60;
|
||||||
else if (c0.b < 0.73)
|
else if (c0.b < 0.73)
|
||||||
blue = 0.73;
|
blue = 0.73;
|
||||||
else if (c0.b < 0.80)
|
else if (c0.b < 0.80)
|
||||||
blue = 0.80;
|
blue = 0.80;
|
||||||
else if( c0.b < 0.93)
|
else if( c0.b < 0.93)
|
||||||
blue = 0.93;
|
blue = 0.93;
|
||||||
else
|
else
|
||||||
blue = 1.0;
|
blue = 1.0;
|
||||||
|
|
||||||
|
|
||||||
if (c0.g < 0.06)
|
if (c0.g < 0.06)
|
||||||
green = 0.06;
|
green = 0.06;
|
||||||
else if (c0.g < 0.13)
|
else if (c0.g < 0.13)
|
||||||
green = 0.13;
|
green = 0.13;
|
||||||
else if (c0.g < 0.26)
|
else if (c0.g < 0.26)
|
||||||
green = 0.26;
|
green = 0.26;
|
||||||
else if (c0.g < 0.33)
|
else if (c0.g < 0.33)
|
||||||
green = 0.33;
|
green = 0.33;
|
||||||
else if (c0.g < 0.46)
|
else if (c0.g < 0.46)
|
||||||
green = 0.46;
|
green = 0.46;
|
||||||
else if (c0.g < 0.60)
|
else if (c0.g < 0.60)
|
||||||
green = 0.60;
|
green = 0.60;
|
||||||
else if (c0.g < 0.73)
|
else if (c0.g < 0.73)
|
||||||
green = 0.73;
|
green = 0.73;
|
||||||
else if (c0.g < 0.80)
|
else if (c0.g < 0.80)
|
||||||
green = 0.80;
|
green = 0.80;
|
||||||
else if( c0.g < 0.93)
|
else if( c0.g < 0.93)
|
||||||
green = 0.93;
|
green = 0.93;
|
||||||
else
|
else
|
||||||
green = 1.0;
|
green = 1.0;
|
||||||
|
|
||||||
ocol0 = vec4(red, green, blue, c0.a);
|
ocol0 = vec4(red, green, blue, c0.a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -20,53 +18,53 @@ out vec4 ocol0;
|
||||||
in vec2 uv0;
|
in vec2 uv0;
|
||||||
|
|
||||||
uniform vec4 resolution;
|
uniform vec4 resolution;
|
||||||
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
||||||
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
||||||
#define FXAA_SPAN_MAX 8.0
|
#define FXAA_SPAN_MAX 8.0
|
||||||
|
|
||||||
vec4 applyFXAA(vec2 fragCoord, sampler2D tex)
|
vec4 applyFXAA(vec2 fragCoord, sampler2D tex)
|
||||||
{
|
{
|
||||||
vec4 color;
|
vec4 color;
|
||||||
vec2 inverseVP = resolution.zw;
|
vec2 inverseVP = resolution.zw;
|
||||||
vec3 rgbNW = texture(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;
|
vec3 rgbNW = texture(tex, (fragCoord + vec2(-1.0, -1.0)) * inverseVP).xyz;
|
||||||
vec3 rgbNE = texture(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;
|
vec3 rgbNE = texture(tex, (fragCoord + vec2(1.0, -1.0)) * inverseVP).xyz;
|
||||||
vec3 rgbSW = texture(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;
|
vec3 rgbSW = texture(tex, (fragCoord + vec2(-1.0, 1.0)) * inverseVP).xyz;
|
||||||
vec3 rgbSE = texture(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;
|
vec3 rgbSE = texture(tex, (fragCoord + vec2(1.0, 1.0)) * inverseVP).xyz;
|
||||||
vec3 rgbM = texture(tex, fragCoord * inverseVP).xyz;
|
vec3 rgbM = texture(tex, fragCoord * inverseVP).xyz;
|
||||||
vec3 luma = vec3(0.299, 0.587, 0.114);
|
vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||||
float lumaNW = dot(rgbNW, luma);
|
float lumaNW = dot(rgbNW, luma);
|
||||||
float lumaNE = dot(rgbNE, luma);
|
float lumaNE = dot(rgbNE, luma);
|
||||||
float lumaSW = dot(rgbSW, luma);
|
float lumaSW = dot(rgbSW, luma);
|
||||||
float lumaSE = dot(rgbSE, luma);
|
float lumaSE = dot(rgbSE, luma);
|
||||||
float lumaM = dot(rgbM, luma);
|
float lumaM = dot(rgbM, luma);
|
||||||
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
||||||
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
||||||
|
|
||||||
vec2 dir;
|
vec2 dir;
|
||||||
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
||||||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
||||||
|
|
||||||
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
||||||
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
||||||
|
|
||||||
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
||||||
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
||||||
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
||||||
dir * rcpDirMin)) * inverseVP;
|
dir * rcpDirMin)) * inverseVP;
|
||||||
|
|
||||||
vec3 rgbA = 0.5 * (
|
vec3 rgbA = 0.5 * (
|
||||||
texture(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
texture(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
||||||
texture(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
texture(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
||||||
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
||||||
texture(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
texture(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
||||||
texture(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
texture(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
||||||
|
|
||||||
float lumaB = dot(rgbB, luma);
|
float lumaB = dot(rgbB, luma);
|
||||||
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
||||||
color = vec4(rgbA, 1.0);
|
color = vec4(rgbA, 1.0);
|
||||||
else
|
else
|
||||||
color = vec4(rgbB, 1.0);
|
color = vec4(rgbB, 1.0);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|
|
@ -6,8 +6,8 @@ in vec2 uv0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c0 = texture(samp9, uv0);
|
vec4 c0 = texture(samp9, uv0);
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float blue = 0.0;
|
float blue = 0.0;
|
||||||
|
|
||||||
if (c0.r > 0.15 && c0.b > 0.15)
|
if (c0.r > 0.15 && c0.b > 0.15)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,5 +7,5 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
ocol0 = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw)) * 8.0;
|
ocol0 = (texture(samp9, uv0+resolution.zw) - texture(samp9, uv0-resolution.zw)) * 8.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 a = texture(samp9, uv0+resolution.zw);
|
vec4 a = texture(samp9, uv0+resolution.zw);
|
||||||
vec4 b = texture(samp9, uv0-resolution.zw);
|
vec4 b = texture(samp9, uv0-resolution.zw);
|
||||||
ocol0 = ( a*a*1.3 - b ) * 8.0;
|
ocol0 = ( a*a*1.3 - b ) * 8.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -15,81 +16,85 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
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 minc = 0.0;
|
float mindiff = float(char_width*char_height) * 100.0;
|
||||||
vec4 mina = 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++) {
|
float minc = 0.0;
|
||||||
vec4 ff = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 mina = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
vec4 f = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 minb = 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 tt = vec4(0.0, 0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
for(int x=0; x<char_width; x++) {
|
for (int i=0; i<char_count; i++)
|
||||||
for(int y=0; y<char_height; y++) {
|
{
|
||||||
|
vec4 ff = 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 t = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
vec4 tt = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
|
||||||
vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5;
|
for (int x=0; x<char_width; x++)
|
||||||
vec4 tex = texture(samp9, tex_pos * resolution.zw);
|
{
|
||||||
|
for (int y=0; y<char_height; y++)
|
||||||
|
{
|
||||||
|
vec2 tex_pos = char_pos*char_dim + vec2(x,y) + 0.5;
|
||||||
|
vec4 tex = texture(samp9, tex_pos * resolution.zw);
|
||||||
|
|
||||||
vec2 font_pos = vec2(x+i*char_width, y) + 0.5;
|
vec2 font_pos = vec2(x+i*char_width, y) + 0.5;
|
||||||
vec4 font = texture(samp8, font_pos * font_scale);
|
vec4 font = texture(samp8, font_pos * font_scale);
|
||||||
|
|
||||||
// generates sum of texture and font and their squares
|
// generates sum of texture and font and their squares
|
||||||
ff += font*font;
|
ff += font*font;
|
||||||
f += font;
|
f += font;
|
||||||
ft += font*tex;
|
ft += font*tex;
|
||||||
t += tex;
|
t += tex;
|
||||||
tt += tex*tex;
|
tt += tex*tex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// 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 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 a = (f*ft - ff*t + f*t - ft*float(char_pixels)) / (f*f - ff*float(char_pixels));
|
||||||
float diff_f = dot(diff, vec4(1.0, 1.0, 1.0, 1.0));
|
vec4 b = (f*ft - ff*t) / (f*f - ff*float(char_pixels));
|
||||||
|
|
||||||
if(diff_f < mindiff) {
|
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;
|
||||||
mindiff = diff_f;
|
float diff_f = dot(diff, vec4(1.0, 1.0, 1.0, 1.0));
|
||||||
minc = float(i);
|
|
||||||
mina = a;
|
|
||||||
minb = b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 font_pos_res = vec2(minc * float(char_width), 0.0) + pixel_offset + 0.5;
|
if (diff_f < mindiff)
|
||||||
|
{
|
||||||
|
mindiff = diff_f;
|
||||||
|
minc = float(i);
|
||||||
|
mina = a;
|
||||||
|
minb = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vec4 col = texture(samp8, font_pos_res * font_scale);
|
vec2 font_pos_res = vec2(minc * float(char_width), 0.0) + pixel_offset + 0.5;
|
||||||
ocol0 = mina * col + minb * (vec4(1.0,1.0,1.0,1.0) - col);
|
|
||||||
|
vec4 col = texture(samp8, font_pos_res * font_scale);
|
||||||
|
ocol0 = mina * col + minb * (vec4(1.0,1.0,1.0,1.0) - col);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,16 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 to_gray = vec4(0.3,0.59,0.11,0);
|
vec4 to_gray = vec4(0.3,0.59,0.11,0);
|
||||||
|
|
||||||
float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw));
|
float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw));
|
||||||
float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw));
|
float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw));
|
||||||
float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw));
|
float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw));
|
||||||
float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw));
|
float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw));
|
||||||
|
|
||||||
float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2);
|
float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2);
|
||||||
|
|
||||||
float4 color = texture(samp9, uv0).rgba;
|
float4 color = texture(samp9, uv0).rgba;
|
||||||
|
|
||||||
ocol0 = color - vec4(edge, edge, edge, edge) * 12.0;
|
ocol0 = color - vec4(edge, edge, edge, edge) * 12.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,39 +7,40 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//Changethis to increase the number of colors.
|
|
||||||
int numColors =8;
|
|
||||||
|
|
||||||
float4 to_gray = float4(0.3,0.59,0.11,0);
|
//Changethis to increase the number of colors.
|
||||||
float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw));
|
int numColors =8;
|
||||||
float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw));
|
|
||||||
float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw));
|
|
||||||
float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw));
|
|
||||||
float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2);
|
|
||||||
float4 color = texture(samp9, uv0).rgba;
|
|
||||||
|
|
||||||
float4 c0 = color - float4(edge, edge, edge, edge) * 12.0;
|
float4 to_gray = float4(0.3,0.59,0.11,0);
|
||||||
|
float x1 = dot(to_gray, texture(samp9, uv0+vec2(1,1)*resolution.zw));
|
||||||
|
float x0 = dot(to_gray, texture(samp9, uv0+vec2(-1,-1)*resolution.zw));
|
||||||
|
float x3 = dot(to_gray, texture(samp9, uv0+vec2(1,-1)*resolution.zw));
|
||||||
|
float x2 = dot(to_gray, texture(samp9, uv0+vec2(-1,1)*resolution.zw));
|
||||||
|
float edge = (x1 - x0) * (x1 - x0) + (x3 - x2) * (x3 - x2);
|
||||||
|
float4 color = texture(samp9, uv0).rgba;
|
||||||
|
|
||||||
|
float4 c0 = color - float4(edge, edge, edge, edge) * 12.0;
|
||||||
|
|
||||||
|
float red = 0.0;
|
||||||
|
float green = 0.0;
|
||||||
|
float blue = 0.0;
|
||||||
|
bool rr = false;
|
||||||
|
bool bb = false;
|
||||||
|
bool gg = false;
|
||||||
|
int count = 1;
|
||||||
|
|
||||||
float red = 0.0;
|
float colorN = 0.0;
|
||||||
float green = 0.0;
|
float colorB = 0.0;
|
||||||
float blue = 0.0;
|
|
||||||
bool rr = false;
|
|
||||||
bool bb = false;
|
|
||||||
bool gg = false;
|
|
||||||
int count = 1;
|
|
||||||
|
|
||||||
float colorN = 0.0;
|
for (count = 1; count <= numColors; count++)
|
||||||
float colorB = 0.0;
|
{
|
||||||
|
colorN = float(count / numColors);
|
||||||
|
|
||||||
|
if ( c0.r <= colorN && c0.r >= colorB && rr == false )
|
||||||
for(count = 1; count <= numColors ; count++){
|
{
|
||||||
colorN = float(count / numColors);
|
if (count == 1)
|
||||||
|
{
|
||||||
if ( c0.r <= colorN && c0.r >= colorB && rr == false ){
|
if (colorN >= 0.1)
|
||||||
if (count == 1){
|
|
||||||
if(colorN >= 0.1)
|
|
||||||
red = 0.01;
|
red = 0.01;
|
||||||
else
|
else
|
||||||
red = colorN;
|
red = colorN;
|
||||||
|
@ -47,14 +48,16 @@ void main()
|
||||||
else if (count == numColors)
|
else if (count == numColors)
|
||||||
red = 0.95;
|
red = 0.95;
|
||||||
else
|
else
|
||||||
red = colorN ;
|
red = colorN;
|
||||||
|
|
||||||
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(colorN >= 0.1)
|
if (count == 1)
|
||||||
|
{
|
||||||
|
if (colorN >= 0.1)
|
||||||
blue = 0.01;
|
blue = 0.01;
|
||||||
else
|
else
|
||||||
blue = colorN;
|
blue = colorN;
|
||||||
|
@ -64,29 +67,30 @@ void main()
|
||||||
else
|
else
|
||||||
blue = colorN ;
|
blue = colorN ;
|
||||||
|
|
||||||
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(colorN >= 0.1)
|
if (count == 1)
|
||||||
|
{
|
||||||
|
if (colorN >= 0.1)
|
||||||
green = 0.01;
|
green = 0.01;
|
||||||
else
|
else
|
||||||
green = colorN;
|
green = colorN;
|
||||||
}
|
}
|
||||||
else if (count == numColors)
|
else if (count == numColors)
|
||||||
green = 0.95 ;
|
green = 0.95;
|
||||||
else
|
else
|
||||||
green = colorN ;
|
green = colorN;
|
||||||
gg = true;
|
gg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,37 +7,37 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c_center = texture(samp9, uv0);
|
float4 c_center = texture(samp9, uv0);
|
||||||
|
|
||||||
float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
|
float4 bloom_sum = float4(0.0, 0.0, 0.0, 0.0);
|
||||||
vec2 pos = uv0 + float2(0.3, 0.3) * resolution.zw;
|
vec2 pos = uv0 + float2(0.3, 0.3) * resolution.zw;
|
||||||
float2 radius1 = 1.3 * resolution.zw;
|
float2 radius1 = 1.3 * resolution.zw;
|
||||||
bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(-2.5, 0.0) * radius1);
|
bloom_sum += texture(samp9, pos + float2(-2.5, 0.0) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(0.0, 2.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(0.0, 2.5) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(2.5, 0.0) * radius1);
|
bloom_sum += texture(samp9, pos + float2(2.5, 0.0) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius1);
|
||||||
bloom_sum += texture(samp9, pos + float2(0.0, -2.5) * radius1);
|
bloom_sum += texture(samp9, pos + float2(0.0, -2.5) * radius1);
|
||||||
|
|
||||||
float2 radius2 = 4.6 * resolution.zw;
|
float2 radius2 = 4.6 * resolution.zw;
|
||||||
bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(-1.5, -1.5) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(-2.5, 0.0) * radius2);
|
bloom_sum += texture(samp9, pos + float2(-2.5, 0.0) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(-1.5, 1.5) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(0.0, 2.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(0.0, 2.5) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(1.5, 1.5) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(2.5, 0.0) * radius2);
|
bloom_sum += texture(samp9, pos + float2(2.5, 0.0) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(1.5, -1.5) * radius2);
|
||||||
bloom_sum += texture(samp9, pos + float2(0.0, -2.5) * radius2);
|
bloom_sum += texture(samp9, pos + float2(0.0, -2.5) * radius2);
|
||||||
|
|
||||||
bloom_sum *= 0.07;
|
bloom_sum *= 0.07;
|
||||||
bloom_sum -= float4(0.3, 0.3, 0.3, 0.3);
|
bloom_sum -= float4(0.3, 0.3, 0.3, 0.3);
|
||||||
bloom_sum = max(bloom_sum, float4(0.0, 0.0, 0.0, 0.0));
|
bloom_sum = max(bloom_sum, float4(0.0, 0.0, 0.0, 0.0));
|
||||||
|
|
||||||
float2 vpos = (uv0 - float2(0.5, 0.5)) * 2.0;
|
float2 vpos = (uv0 - float2(0.5, 0.5)) * 2.0;
|
||||||
float dist = (dot(vpos, vpos));
|
float dist = (dot(vpos, vpos));
|
||||||
dist = 1.0 - 0.4*dist;
|
dist = 1.0 - 0.4*dist;
|
||||||
|
|
||||||
ocol0 = (c_center * 0.7 + bloom_sum) * dist;
|
ocol0 = (c_center * 0.7 + bloom_sum) * dist;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,13 @@ in vec2 uv0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c0 = texture(samp9, uv0);
|
vec4 c0 = texture(samp9, uv0);
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float green = 0.0;
|
float green = 0.0;
|
||||||
|
|
||||||
if (c0.r < 0.35 || c0.b > 0.35)
|
if (c0.r < 0.35 || c0.b > 0.35)
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ in vec2 uv0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c0 = texture(samp9, uv0);
|
vec4 c0 = texture(samp9, uv0);
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float green = 0.0;
|
float green = 0.0;
|
||||||
float blue = 0.0;
|
float blue = 0.0;
|
||||||
|
|
||||||
if (c0.r < 0.50 || c0.b > 0.5)
|
if (c0.r < 0.50 || c0.b > 0.5)
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,35 +7,34 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0);
|
float4 c0 = texture(samp9, uv0);
|
||||||
float4 c1 = texture(samp9, uv0 - float2(1.0, 0.0)*resolution.zw);
|
float4 c1 = texture(samp9, uv0 - float2(1.0, 0.0) * resolution.zw);
|
||||||
float4 c2 = texture(samp9, uv0 - float2(0.0, 1.0)*resolution.zw);
|
float4 c2 = texture(samp9, uv0 - float2(0.0, 1.0) * resolution.zw);
|
||||||
float4 c3 = texture(samp9, uv0 + float2(1.0, 0.0)*resolution.zw);
|
float4 c3 = texture(samp9, uv0 + float2(1.0, 0.0) * resolution.zw);
|
||||||
float4 c4 = texture(samp9, uv0 + float2(0.0, 1.0)*resolution.zw);
|
float4 c4 = texture(samp9, uv0 + float2(0.0, 1.0) * resolution.zw);
|
||||||
|
|
||||||
float red = c0.r;
|
float red = c0.r;
|
||||||
float blue = c0.b;
|
float blue = c0.b;
|
||||||
float green = c0.g;
|
float green = c0.g;
|
||||||
|
|
||||||
float red2 = (c1.r + c2.r + c3.r + c4.r) / 4.0;
|
float red2 = (c1.r + c2.r + c3.r + c4.r) / 4.0;
|
||||||
float blue2 = (c1.b + c2.b + c3.b + c4.b) / 4.0;
|
float blue2 = (c1.b + c2.b + c3.b + c4.b) / 4.0;
|
||||||
float green2 = (c1.g + c2.g + c3.g + c4.g) / 4.0;
|
float green2 = (c1.g + c2.g + c3.g + c4.g) / 4.0;
|
||||||
|
|
||||||
if(red2 > 0.3)
|
if (red2 > 0.3)
|
||||||
red = c0.r + c0.r / 2.0;
|
red = c0.r + c0.r / 2.0;
|
||||||
else
|
else
|
||||||
red = c0.r - c0.r / 2.0;
|
red = c0.r - c0.r / 2.0;
|
||||||
|
|
||||||
if(green2 > 0.3)
|
if (green2 > 0.3)
|
||||||
green = c0.g+ c0.g / 2.0;
|
green = c0.g+ c0.g / 2.0;
|
||||||
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
|
||||||
blue = c0.b - c0.b / 2.0;
|
blue = c0.b - c0.b / 2.0;
|
||||||
|
|
||||||
ocol0 = float4(red, green, blue, c0.a);
|
ocol0 = float4(red, green, blue, c0.a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
float4 c1 = texture(samp9, uv0 + float2(5.0,5.0)*resolution.zw).rgba;
|
float4 c1 = texture(samp9, uv0 + float2(5.0,5.0)*resolution.zw).rgba;
|
||||||
float y = (0.222 * c1.r) + (0.707 * c1.g) + (0.071 * c1.b);
|
float y = (0.222 * c1.r) + (0.707 * c1.g) + (0.071 * c1.b);
|
||||||
float y2 = ((0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b)) / 3.0;
|
float y2 = ((0.222 * c0.r) + (0.707 * c0.g) + (0.071 * c0.b)) / 3.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;
|
||||||
float alpha = c0.a;
|
float alpha = c0.a;
|
||||||
|
|
||||||
red = y2 + (1.0 - y);
|
red = y2 + (1.0 - y);
|
||||||
green = y2 + (1.0 - y);
|
green = y2 + (1.0 - y);
|
||||||
blue = y2 + (1.0 - y);
|
blue = y2 + (1.0 - y);
|
||||||
|
|
||||||
ocol0 = float4(red, green, blue, alpha);
|
ocol0 = float4(red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,13 @@ in vec2 uv0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c0 = texture(samp9, uv0);
|
vec4 c0 = texture(samp9, uv0);
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float green = 0.0;
|
float green = 0.0;
|
||||||
float blue = 0.0;
|
float blue = 0.0;
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -6,9 +6,9 @@ in vec2 uv0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 c0 = texture(samp9, uv0);
|
vec4 c0 = texture(samp9, uv0);
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float green = 0.0;
|
float green = 0.0;
|
||||||
float blue = 0.0;
|
float blue = 0.0;
|
||||||
float avg = (c0.r + c0.g + c0.b) / 3.0;
|
float avg = (c0.r + c0.g + c0.b) / 3.0;
|
||||||
|
|
||||||
red = c0.r + (c0.g / 2.0) + (c0.b / 3.0);
|
red = c0.r + (c0.g / 2.0) + (c0.b / 3.0);
|
||||||
|
|
|
@ -7,16 +7,16 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0);
|
float4 c0 = texture(samp9, uv0);
|
||||||
float4 c1 = texture(samp9, uv0 + float2(1,1)*resolution.zw);
|
float4 c1 = texture(samp9, uv0 + float2(1,1)*resolution.zw);
|
||||||
float4 c2 = texture(samp9, uv0 + float2(-1,-1)*resolution.zw);
|
float4 c2 = texture(samp9, uv0 + float2(-1,-1)*resolution.zw);
|
||||||
float red = c0.r;
|
float red = c0.r;
|
||||||
float green = c0.g;
|
float green = c0.g;
|
||||||
float blue = c0.b;
|
float blue = c0.b;
|
||||||
float alpha = c0.a;
|
float alpha = c0.a;
|
||||||
|
|
||||||
red = c0.r - c1.b;
|
red = c0.r - c1.b;
|
||||||
blue = c0.b - c2.r + (c0.g - c0.r);
|
blue = c0.b - c2.r + (c0.g - c0.r);
|
||||||
|
|
||||||
ocol0 = float4(red, 0.0, blue, alpha);
|
ocol0 = float4(red, 0.0, blue, alpha);
|
||||||
}
|
}
|
|
@ -7,8 +7,8 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0);
|
float4 c0 = texture(samp9, uv0);
|
||||||
float4 c1 = texture(samp9, uv0 + float2(5,5)*resolution.zw);
|
float4 c1 = texture(samp9, uv0 + float2(5,5)*resolution.zw);
|
||||||
|
|
||||||
ocol0 = c0 - c1;
|
ocol0 = c0 - c1;
|
||||||
}
|
}
|
|
@ -7,16 +7,20 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
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)
|
|
||||||
ocol0 = float4(1,0,0,0);
|
if (color.r > 0.8 && color.b + color.b < 0.2)
|
||||||
else {
|
{
|
||||||
color += emboss;
|
ocol0 = float4(1,0,0,0);
|
||||||
if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5)
|
}
|
||||||
ocol0 = float4(1,1,1,1);
|
else
|
||||||
else
|
{
|
||||||
ocol0 = float4(0,0,0,0);
|
color += emboss;
|
||||||
}
|
if (dot(color.rgb, float3(0.3, 0.5, 0.2)) > 0.5)
|
||||||
|
ocol0 = float4(1,1,1,1);
|
||||||
|
else
|
||||||
|
ocol0 = float4(0,0,0,0);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,13 +5,11 @@ in vec2 uv0;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
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);
|
||||||
}
|
}
|
|
@ -7,50 +7,63 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
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
|
|
||||||
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
|
//blur
|
||||||
float blursize = 1.5;
|
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw);
|
float blursize = 1.5;
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, blursize) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, -blursize) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, 0.0)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, blursize) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, 0.0)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, 0.0) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, 0.0) * resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize) * resolution.zw);
|
||||||
blurtotal *= 0.125;
|
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize) * resolution.zw);
|
||||||
c0 = blurtotal;
|
blurtotal *= 0.125;
|
||||||
//greyscale
|
c0 = blurtotal;
|
||||||
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
|
|
||||||
// brighten
|
//greyscale
|
||||||
grey = grey * 0.5 + 0.7;
|
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
|
||||||
// darken edges
|
|
||||||
float x = uv0.x * resolution.x;
|
// brighten
|
||||||
float y = uv0.y * resolution.y;
|
grey = grey * 0.5 + 0.7;
|
||||||
if (x > internalresolution/2.0) x = internalresolution-x;
|
|
||||||
if (y > internalresolution/2.0) y = internalresolution-y;
|
// darken edges
|
||||||
if (x > internalresolution/2.0*0.95) x = internalresolution/2.0*0.95;
|
float x = uv0.x * resolution.x;
|
||||||
if (y > internalresolution/2.0*0.95) y = internalresolution/2.0*0.95;
|
float y = uv0.y * resolution.y;
|
||||||
x = -x+641.0;
|
if (x > internalresolution/2.0)
|
||||||
y = -y+641.0;
|
x = internalresolution-x;
|
||||||
/*****inline square root routines*****/
|
if (y > internalresolution/2.0)
|
||||||
// bit of a performance bottleneck.
|
y = internalresolution-y;
|
||||||
// neccessary to make the darkened area rounded
|
if (x > internalresolution/2.0*0.95)
|
||||||
// instead of rhombus-shaped.
|
x = internalresolution/2.0*0.95;
|
||||||
float sqrt = x / 10.0;
|
if (y > internalresolution/2.0*0.95)
|
||||||
while((sqrt*sqrt) < x) sqrt+=0.1;
|
y = internalresolution/2.0*0.95;
|
||||||
x = sqrt;
|
x = -x+641.0;
|
||||||
sqrt = y / 10.0;
|
y = -y+641.0;
|
||||||
while((sqrt*sqrt) < y) sqrt+=0.1;
|
|
||||||
y = sqrt;
|
/*****inline square root routines*****/
|
||||||
/*****end of inline square root routines*****/
|
// bit of a performance bottleneck.
|
||||||
x *= 2.0;
|
// neccessary to make the darkened area rounded
|
||||||
y *= 2.0;
|
// instead of rhombus-shaped.
|
||||||
grey -= x / 200.0;
|
float sqrt = x / 10.0;
|
||||||
grey -= y / 200.0;
|
|
||||||
// output
|
while ((sqrt*sqrt) < x)
|
||||||
ocol0 = float4(0.0, grey, 0.0, 1.0);
|
sqrt+=0.1;
|
||||||
|
x = sqrt;
|
||||||
|
sqrt = y / 10.0;
|
||||||
|
while ((sqrt*sqrt) < y)
|
||||||
|
sqrt+=0.1;
|
||||||
|
y = sqrt;
|
||||||
|
|
||||||
|
x *= 2.0;
|
||||||
|
y *= 2.0;
|
||||||
|
grey -= x / 200.0;
|
||||||
|
grey -= y / 200.0;
|
||||||
|
|
||||||
|
// output
|
||||||
|
ocol0 = float4(0.0, grey, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,55 +7,72 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
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
|
|
||||||
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
|
//blur
|
||||||
float blursize = 1.5;
|
float4 blurtotal = float4(0.0, 0.0, 0.0, 0.0);
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw);
|
float blursize = 1.5;
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, -blursize)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, blursize)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, -blursize)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2(-blursize, 0.0)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, blursize)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( blursize, 0.0)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2(-blursize, 0.0)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( blursize, 0.0)*resolution.zw);
|
||||||
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
|
blurtotal += texture(samp9, uv0 + float2( 0.0, -blursize)*resolution.zw);
|
||||||
blurtotal *= 0.125;
|
blurtotal += texture(samp9, uv0 + float2( 0.0, blursize)*resolution.zw);
|
||||||
c0 = blurtotal;
|
blurtotal *= 0.125;
|
||||||
//greyscale
|
c0 = blurtotal;
|
||||||
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
|
|
||||||
// brighten and apply horizontal scanlines
|
//greyscale
|
||||||
// This would have been much simpler if I could get the stupid modulo (%) to work
|
float grey = ((0.3 * c0.r) + (0.4 * c0.g) + (0.3 * c0.b));
|
||||||
// If anyone who is more well versed in Cg knows how to do this it'd be slightly more efficient
|
|
||||||
// float lineIntensity = ((uv0[1] % 9) - 4) / 40;
|
// brighten and apply horizontal scanlines
|
||||||
float vPos = uv0.y*resolution.y / 9.0;
|
// This would have been much simpler if I could get the stupid modulo (%) to work
|
||||||
float lineIntensity = (((vPos - floor(vPos)) * 9.0) - 4.0) / 40.0;
|
// If anyone who is more well versed in Cg knows how to do this it'd be slightly more efficient
|
||||||
grey = grey * 0.5 + 0.7 + lineIntensity;
|
// float lineIntensity = ((uv0[1] % 9) - 4) / 40;
|
||||||
// darken edges
|
float vPos = uv0.y*resolution.y / 9.0;
|
||||||
float x = uv0.x * resolution.x;
|
float lineIntensity = (((vPos - floor(vPos)) * 9.0) - 4.0) / 40.0;
|
||||||
float y = uv0.y * resolution.y;
|
grey = grey * 0.5 + 0.7 + lineIntensity;
|
||||||
if (x > internalresolution/2.0) x = internalresolution-x;
|
|
||||||
if (y > internalresolution/2.0) y = internalresolution-y;
|
// darken edges
|
||||||
if (x > internalresolution/2.0*0.95) x = internalresolution/2.0*0.95;
|
float x = uv0.x * resolution.x;
|
||||||
if (y > internalresolution/2.0*0.95) y = internalresolution/2.0*0.95;
|
float y = uv0.y * resolution.y;
|
||||||
x = -x + 641.0;
|
|
||||||
y = -y + 641.0;
|
if (x > internalresolution/2.0)
|
||||||
/*****inline square root routines*****/
|
x = internalresolution-x;
|
||||||
// bit of a performance bottleneck.
|
|
||||||
// neccessary to make the darkened area rounded
|
if (y > internalresolution/2.0)
|
||||||
// instead of rhombus-shaped.
|
y = internalresolution-y;
|
||||||
float sqrt = x / 10.0;
|
|
||||||
while((sqrt*sqrt) < x) sqrt+=0.1;
|
if (x > internalresolution/2.0*0.95)
|
||||||
x = sqrt;
|
x = internalresolution/2.0*0.95;
|
||||||
sqrt = y / 10.0;
|
|
||||||
while((sqrt*sqrt) < y) sqrt+=0.1;
|
if (y > internalresolution/2.0*0.95)
|
||||||
y = sqrt;
|
y = internalresolution/2.0*0.95;
|
||||||
/*****end of inline square root routines*****/
|
|
||||||
x *= 2.0;
|
x = -x + 641.0;
|
||||||
y *= 2.0;
|
y = -y + 641.0;
|
||||||
grey -= x / 200.0;
|
|
||||||
grey -= y / 200.0;
|
//****inline square root routines*****/
|
||||||
// output
|
// bit of a performance bottleneck.
|
||||||
ocol0 = float4(0.0, grey, 0.0, 1.0);
|
// neccessary to make the darkened area rounded
|
||||||
|
// instead of rhombus-shaped.
|
||||||
|
float sqrt = x / 10.0;
|
||||||
|
while ((sqrt*sqrt) < x)
|
||||||
|
sqrt+=0.1;
|
||||||
|
x = sqrt;
|
||||||
|
sqrt = y / 10.0;
|
||||||
|
while ((sqrt*sqrt) < y)
|
||||||
|
sqrt+=0.1;
|
||||||
|
y = sqrt;
|
||||||
|
|
||||||
|
x *= 2.0;
|
||||||
|
y *= 2.0;
|
||||||
|
grey -= x / 200.0;
|
||||||
|
grey -= y / 200.0;
|
||||||
|
|
||||||
|
// output
|
||||||
|
ocol0 = float4(0.0, grey, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,25 +5,19 @@ in vec2 uv0;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
float red = 0.0;
|
float red = 0.0;
|
||||||
float green = 0.0;
|
float green = 0.0;
|
||||||
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);
|
||||||
}
|
}
|
|
@ -5,20 +5,19 @@ in vec2 uv0;
|
||||||
|
|
||||||
float bound(float color)
|
float bound(float color)
|
||||||
{
|
{
|
||||||
if (color < 0.35)
|
if (color < 0.35)
|
||||||
{
|
|
||||||
if (color < 0.25)
|
|
||||||
{
|
{
|
||||||
return color;
|
if (color < 0.25)
|
||||||
|
return color;
|
||||||
|
|
||||||
|
return 0.5;
|
||||||
}
|
}
|
||||||
return 0.5;
|
|
||||||
}
|
return 1.0;
|
||||||
return 1.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -7,16 +7,18 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
float4 tmp = float4(0.0, 0.0, 0.0, 0.0);
|
float4 tmp = float4(0.0, 0.0, 0.0, 0.0);
|
||||||
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;
|
||||||
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.
|
|
||||||
if (uv0.y*resolution.y < 163.0)
|
// get rid of the bottom line, as it is incorrect.
|
||||||
tmp = float4(1.0, 1.0, 1.0, 1.0);
|
if (uv0.y*resolution.y < 163.0)
|
||||||
c0 = c0 + 1.0 - grey * 7.0;
|
tmp = float4(1.0, 1.0, 1.0, 1.0);
|
||||||
ocol0 = float4(c0.r, c0.g, c0.b, 1.0);
|
|
||||||
|
c0 = c0 + 1.0 - grey * 7.0;
|
||||||
|
ocol0 = float4(c0.r, c0.g, c0.b, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,22 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba; // Source Color
|
// Source Color
|
||||||
float sep = 5.0;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
float red = c0.r;
|
float sep = 5.0;
|
||||||
float green = c0.g;
|
float red = c0.r;
|
||||||
float blue = c0.b;
|
float green = c0.g;
|
||||||
|
float blue = c0.b;
|
||||||
|
|
||||||
|
// Left Eye (Red)
|
||||||
|
float4 c1 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
|
||||||
|
red = max(c0.r, c1.r);
|
||||||
|
|
||||||
// Left Eye (Red)
|
// Right Eye (Cyan)
|
||||||
float4 c1 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
|
float4 c2 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
|
||||||
red = max(c0.r, c1.r);
|
float cyan = (c2.g + c2.b) / 2.0;
|
||||||
|
green = max(c0.g, cyan);
|
||||||
|
blue = max(c0.b, cyan);
|
||||||
|
|
||||||
// Right Eye (Cyan)
|
ocol0 = float4(red, green, blue, c0.a);
|
||||||
float4 c2 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
|
|
||||||
float cyan = (c2.g + c2.b) / 2.0;
|
|
||||||
green = max(c0.g, cyan);
|
|
||||||
blue = max(c0.b, cyan);
|
|
||||||
|
|
||||||
|
|
||||||
ocol0 = float4(red, green, blue, c0.a);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,22 @@ uniform vec4 resolution;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float4 c0 = texture(samp9, uv0).rgba; // Source Color
|
// Source Color
|
||||||
float sep = 5.0;
|
float4 c0 = texture(samp9, uv0).rgba;
|
||||||
float red = c0.r;
|
float sep = 5.0;
|
||||||
float green = c0.g;
|
float red = c0.r;
|
||||||
float blue = c0.b;
|
float green = c0.g;
|
||||||
|
float blue = c0.b;
|
||||||
|
|
||||||
|
// Left Eye (Amber)
|
||||||
|
float4 c2 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
|
||||||
|
float amber = (c2.r + c2.g) / 2.0;
|
||||||
|
red = max(c0.r, amber);
|
||||||
|
green = max(c0.g, amber);
|
||||||
|
|
||||||
// Left Eye (Amber)
|
// Right Eye (Blue)
|
||||||
float4 c2 = texture(samp9, uv0 + float2(sep,0.0)*resolution.zw).rgba;
|
float4 c1 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
|
||||||
float amber = (c2.r + c2.g) / 2.0;
|
blue = max(c0.b, c1.b);
|
||||||
red = max(c0.r, amber);
|
|
||||||
green = max(c0.g, amber);
|
|
||||||
|
|
||||||
// Right Eye (Blue)
|
ocol0 = float4(red, green, blue, c0.a);
|
||||||
float4 c1 = texture(samp9, uv0 + float2(-sep,0.0)*resolution.zw).rgba;
|
|
||||||
blue = max(c0.b, c1.b);
|
|
||||||
|
|
||||||
|
|
||||||
ocol0 = float4(red, green, blue, c0.a);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue