file/folder restructuring

This commit is contained in:
itsmattkc
2019-03-13 16:55:49 +11:00
parent d84b5a7f1d
commit 1cd5dabc07
228 changed files with 1269 additions and 1557 deletions
+33
View File
@@ -0,0 +1,33 @@
#version 110
uniform sampler2D image;
uniform float radius;
uniform vec2 resolution;
uniform bool horiz_blur;
uniform bool vert_blur;
uniform int iteration;
varying vec2 vTexCoord;
void main(void) {
float rad = ceil(radius);
float divider = 1.0 / rad;
vec4 color = vec4(0.0);
bool radius_is_zero = (rad == 0.0);
if (iteration == 0 && horiz_blur && !radius_is_zero) {
for (float x=-rad+0.5;x<=rad;x+=2.0) {
color += texture2D(image, (vec2(gl_FragCoord.x+x, gl_FragCoord.y))/resolution)*(divider);
}
gl_FragColor = color;
} else if (iteration == 1 && vert_blur && !radius_is_zero) {
for (float x=-rad+0.5;x<=rad;x+=2.0) {
color += texture2D(image, (vec2(gl_FragCoord.x, gl_FragCoord.y+x))/resolution)*(divider);
}
gl_FragColor = color;
} else {
gl_FragColor = texture2D(image, vTexCoord);
}
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Box Blur" category="Blur">
<row name="Radius">
<field type="double" min="0" default="10" id="radius"/>
</row>
<row name="Horizontal">
<field type="bool" default="1" id="horiz_blur"/>
</row>
<row name="Vertical">
<field type="bool" default="1" id="vert_blur"/>
</row>
<shader vert="common.vert" frag="boxblur.frag" iterations="2"/>
</effect>
+32
View File
@@ -0,0 +1,32 @@
#version 120
uniform sampler2D tex0;
varying vec2 vTexCoord;
const float PI = 3.1415926535;
uniform vec2 resolution;
uniform float amount;
uniform float xoff;
uniform float yoff;
vec2 distort(vec2 p, vec2 offset) {
float theta = atan(p.y, p.x);
float radius = length(p);
radius = pow(radius, (1.0+amount*0.01));
p.x = radius * cos(theta) + offset.x;
p.y = radius * sin(theta) + offset.y;
return 0.5 * (p + 1.0);
}
void main(void) {
vec2 offset = vec2(xoff/resolution.x, yoff/resolution.y);
vec2 xy = 2.0 * vTexCoord - 1.0 - offset;
vec2 uv;
float d = length(xy);
uv = distort(xy, offset);
if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
gl_FragColor = texture2D(tex0, uv);
} else {
discard;
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Bulge" category="Distort">
<row name="Amount">
<field type="double" default="100" id="amount"/>
</row>
<row name="Center">
<field type="double" default="0" id="xoff"/>
<field type="double" default="0" id="yoff"/>
</row>
<shader vert="common.vert" frag="bulge.frag"/>
</effect>
+65
View File
@@ -0,0 +1,65 @@
/*a fast implementation of the chromakey program
(c) 2008 Edward Cannon (adapted to GLSL by Olive Team)
feel free to use or modify at will*/
/*the follwing three functions convert RGB into YCbCr in the same manner as in JPEG images*/
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform vec3 key_color;
uniform float tola;
uniform float tolb;
uniform bool opt;
uniform int mode;
float rgb2y (vec3 c) {
/*a utility function to convert colors in RGB into YCbCr*/
return (0.299*c.r + 0.587*c.g + 0.114*c.b);
}
float rgb2cb (vec3 c) {
/*a utility function to convert colors in RGB into YCbCr*/
return (0.5 + -0.168736*c.r - 0.331264*c.g + 0.5*c.b);
}
float rgb2cr (vec3 c) {
/*a utility function to convert colors in RGB into YCbCr*/
return (0.5 + 0.5*c.r - 0.418688*c.g - 0.081312*c.b);
}
float colorclose(float Cb_p,float Cr_p,float Cb_key,float Cr_key,float tola,float tolb) {
/*decides if a color is close to the specified hue*/
float temp = sqrt(((Cb_key-Cb_p)*(Cb_key-Cb_p))+((Cr_key-Cr_p)*(Cr_key-Cr_p)));
if (temp < tola) {return (0.0);}
if (temp < tolb) {return ((temp-tola)/(tolb-tola));}
return (1.0);
}
void main(void) {
float cb_key = rgb2cb(key_color);
float cr_key = rgb2cr(key_color);
vec4 texture_color = texture2D(tex, vTexCoord);
float cb = rgb2cb(texture_color.rgb);
float cr = rgb2cr(texture_color.rgb);
float mask = colorclose(cb, cr, cb_key, cr_key, (tola/100.0), (tolb/100.0));
if (mode == 0) { // composite
//float submask = 1.0-mask;
float submask = 0.0;
texture_color.r = max(texture_color.r - submask*key_color.r, 0.0) + submask;
texture_color.g = max(texture_color.g - submask*key_color.g, 0.0) + submask;
texture_color.b = max(texture_color.b - submask*key_color.b, 0.0) + submask;
texture_color.a *= mask;
// premultiply
texture_color.rgb *= texture_color.a;
} else if (mode == 1) { // alpha
texture_color.rgb = vec3(mask);
} else if (mode == 2) { // original
}
gl_FragColor = texture_color;
}
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Chroma Key" category="Keying">
<row name="Mode">
<field type="combo" default="0" id="mode">
<option>Composite</option>
<option>Alpha</option>
<option>Original</option>
</field>
</row>
<row name="Key Color">
<field type="color" r="0" g="255" b="0" id="key_color"/>
</row>
<row name="Lower Tolerance">
<field type="double" min="0" default="5" max="100" id="tola"/>
</row>
<row name="Upper Tolerance">
<field type="double" min="0" default="25" max="100" id="tolb"/>
</row>
<shader vert="common.vert" frag="chromakey.frag"/>
</effect>
+22
View File
@@ -0,0 +1,22 @@
#version 110
uniform vec2 resolution;
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform float red_amount;
uniform float green_amount;
uniform float blue_amount;
void main(void) {
vec2 rOffset = vec2(red_amount*0.01)/resolution;
vec2 gOffset = vec2(green_amount*0.01)/resolution;
vec2 bOffset = vec2(blue_amount*0.01)/resolution;
vec4 rValue = texture2D(tex, vTexCoord - rOffset);
vec4 gValue = texture2D(tex, vTexCoord - gOffset);
vec4 bValue = texture2D(tex, vTexCoord - bOffset);
gl_FragColor = vec4(rValue.r, gValue.g, bValue.b, texture2D(tex, vTexCoord).a);
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Chromatic Aberration" category="Stylize">
<row name="Red Amount">
<field type="double" default="350" id="red_amount"/>
</row>
<row name="Green Amount">
<field type="double" default="-40" id="green_amount"/>
</row>
<row name="Blue Amount">
<field type="double" default="-250" id="blue_amount"/>
</row>
<shader vert="common.vert" frag="chromaticaberration.frag"/>
</effect>
+74
View File
@@ -0,0 +1,74 @@
#version 110
uniform float temperature;
uniform float tint;
uniform float exposure;
uniform float contrast;
uniform float highlights;
uniform float shadows;
uniform float whites;
uniform float blacks;
uniform float saturation;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(myTexture, vTexCoord);
vec3 rgb = textureColor.rgb;
// temperature
float temp = temperature * 0.01;
float redTemp = (temp <= 66.0) ? 1.0 : min(1.0, max(0.0,
(1.2929361861 * pow(temp - 60.0, -0.1332047592))
));
float greenTemp = min(1.0, max(0.0,
(temp <= 66.0) ? (0.3900815788 * log(temp) - 0.6318414438) : (1.1298908609 * pow(temp - 60.0, -0.0755148492))
));
float blueTemp = (temp >= 66.0) ? 1.0 : min(1.0, max(0.0,
(0.5432067891 * log(temp - 10.0) - 1.1962540891)
));
rgb *= vec3(redTemp, greenTemp, blueTemp);
// tint
rgb.g *= ((tint*0.01)+1.0);
// exposure
rgb *= pow(2.0, exposure*0.01);
// contrast
float contr_val = (contrast*0.01);
rgb = (rgb*contr_val)-((contr_val-1.0)*0.5);
// shadows/highlights
//float luma = 0.33*rgb.r + 0.5*rgb.g + 0.16*rgb.b;
if (rgb.r < 0.5 && rgb.g < 0.5 && rgb.b < 0.5) {
float shadow_val = 1.0-(shadows*0.01);
rgb = vec3(pow(rgb.r*2.0, shadow_val)*0.5, pow(rgb.g*2.0, shadow_val)*0.5, pow(rgb.b*2.0, shadow_val)*0.5);
} else if (rgb.r > 0.5 && rgb.g > 0.5 && rgb.b > 0.5) {
float highlight_val = 1.0-(highlights*0.01);
rgb = vec3((pow((rgb.r-0.5)*2.0, highlight_val)*0.5)+0.5, (pow((rgb.g-0.5)*2.0, highlight_val)*0.5)+0.5, (pow((rgb.b-0.5)*2.0, highlight_val)*0.5)+0.5);
}
// whites
rgb *= (whites*0.01);
// blacks
float black_val = 2.0-(blacks*0.01);
rgb = (rgb*black_val)-(black_val-1.0);
// saturation
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
vec3 intensity = vec3(dot(rgb, W));
rgb = mix(intensity, rgb, saturation*0.01);
gl_FragColor = vec4(
rgb.r,
rgb.g,
rgb.b,
textureColor.a
);
}
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Color Correction" category="Color">
<row name="Temperature">
<field type="double" min="2000" default="6600" max="40000" id="temperature"/>
</row>
<row name="Tint">
<field type="double" min="-100" default="0" id="tint"/>
</row>
<row name="Exposure">
<field type="double" default="0" id="exposure"/>
</row>
<row name="Contrast">
<field type="double" min="0" default="100" id="contrast"/>
</row>
<row name="Highlights">
<field type="double" default="0" max="100" id="highlights"/>
</row>
<row name="Shadows">
<field type="double" default="0" max="100" id="shadows"/>
</row>
<row name="Whites (Brightness)">
<field type="double" min="0" default="100" id="whites"/>
</row>
<row name="Blacks (Darkness)">
<field type="double" min="0" default="100" max="200" id="blacks"/>
</row>
<row name="Saturation">
<field type="double" min="0" default="100" id="saturation"/>
</row>
<shader vert="common.vert" frag="colorcorrection.frag"/>
</effect>
+83
View File
@@ -0,0 +1,83 @@
/* Filter by color characteristic simple program
Based on Edward Cannon's Simple Chroma Key (adaptation by Olive Team)
RGB to HSV based on MattKC's toonify source code
Feel free to modify and use at will */
#version 110
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform float loc;
uniform float hic;
uniform int compo;
uniform bool invert;
float rgb2luma(vec3 c) {
return (max(max(c.r,c.g), c.b) + min(min(c.r,c.g), c.b))/2.0;
}
vec3 rgb2hsv(vec3 c)
{
float r = c.r;
float b = c.b;
float g = c.g;
float minv, maxv, delta;
vec3 res;
minv = min(min(r, g), b);
maxv = max(max(r, g), b);
res.z = maxv; // v
delta = maxv - minv;
if( maxv != 0.0 )
res.y = delta / maxv; // s
else {
// r = g = b = 0 // s = 0, v is undefined
res.y = 0.0;
res.x = -1.0;
return res;
}
if( r == maxv )
res.x = ( g - b ) / delta; // between yellow & magenta
else if( g == maxv )
res.x = 2.0 + ( b - r ) / delta; // between cyan & yellow
else
res.x = 4.0 + ( r - g ) / delta; // between magenta & cyan
res.x = res.x * 60.0; // degrees
if( res.x < 0.0 )
res.x = res.x + 360.0;
return res;
}
bool isNotIncreasingSequence(float a, float b, float c) {
return (c < b || a > b);
}
void main(void) {
vec4 texture_color = texture2D(tex,vTexCoord);
vec3 color = texture_color.rgb;
float toCheck = 0.0;
if (compo == 0) {
toCheck = rgb2luma(color)*100.0;
} else if (compo == 4) {
toCheck = color.r*100.0;
} else if (compo == 5) {
toCheck = color.g*100.0;
} else if (compo == 6) {
toCheck = color.b*100.0;
} else if (compo == 1) {
toCheck = rgb2hsv(color).z*100.0;
} else if (compo == 2) {
toCheck = rgb2hsv(color).x/3.6;
} else if (compo == 3) {
toCheck = rgb2hsv(color).y*100.0;
}
texture_color.a = isNotIncreasingSequence(loc, toCheck, hic) ? (invert ? texture_color.a : 0.0) : (invert ? 0.0 : texture_color.a);
texture_color.rgb *= texture_color.a;
gl_FragColor = texture_color;
}
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Color Finder" category="Keying">
<row name="Find by">
<field type="combo" default="0" id="compo">
<option>Luminance</option>
<option>Value</option>
<option>Hue</option>
<option>Saturation</option>
<option>Red</option>
<option>Green</option>
<option>Blue</option>
</field>
</row>
<row name="Lower Limit">
<field type="double" min="0" default="0" max="100" id="loc"/>
</row>
<row name="Upper Limit">
<field type="double" min="0" default="100" max="100" id="hic"/>
</row>
<row name="Invert">
<field type="bool" min="0" default="100" max="100" id="invert"/>
</row>
<shader vert="common.vert" frag="colorsel.frag"/>
</effect>
+9
View File
@@ -0,0 +1,9 @@
#version 110
uniform sampler2D tex;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(tex, vTexCoord);
gl_FragColor = textureColor;
}
+8
View File
@@ -0,0 +1,8 @@
#version 110
varying vec2 vTexCoord;
void main() {
vTexCoord = gl_MultiTexCoord0.xy;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
+34
View File
@@ -0,0 +1,34 @@
#version 110
uniform float left;
uniform float top;
uniform float right;
uniform float bottom;
uniform float feather;
uniform mediump float amount_val;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(myTexture, vec2(vTexCoord.x, vTexCoord.y));
float alpha = textureColor.a;
if (feather == 0.0) {
if (vTexCoord.x < (left*0.01) || vTexCoord.y < (top*0.01) || vTexCoord.x > (1.0-(right*0.01)) || vTexCoord.y > (1.0-(bottom*0.01))) {
alpha = 0.0;
}
} else {
float f = pow(2.0, 10.0-(feather*0.1));
if (left > 0.0) alpha = alpha * clamp(((vTexCoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
if (top > 0.0) alpha = alpha * clamp(((vTexCoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
if (right > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
if (bottom > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
}
gl_FragColor = vec4(
textureColor.r*alpha,
textureColor.g*alpha,
textureColor.b*alpha,
alpha
);
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Crop" category="Distort">
<row name="Left">
<field type="double" min="0" default="0" max="100" id="left"/>
</row>
<row name="Top">
<field type="double" min="0" default="0" max="100" id="top"/>
</row>
<row name="Right">
<field type="double" min="0" default="0" max="100" id="right"/>
</row>
<row name="Bottom">
<field type="double" min="0" default="0" max="100" id="bottom"/>
</row>
<row name="Feather">
<field type="double" min="0" default="0" id="feather"/>
</row>
<shader vert="common.vert" frag="crop.frag"/>
</effect>
+44
View File
@@ -0,0 +1,44 @@
#version 110
uniform sampler2D tex0;
uniform float time;
uniform vec2 resolution;
uniform float stitching_size;
uniform bool invert;
varying vec2 vTexCoord;
vec4 PostFX(sampler2D tex, vec2 uv, float time) {
vec4 c = vec4(0.0);
float size = stitching_size;
vec2 cPos = uv * resolution;
vec2 tlPos = floor(cPos / vec2(size, size));
tlPos *= size;
int remX = int(mod(cPos.x, size));
int remY = int(mod(cPos.y, size));
if (remX == 0 && remY == 0)
tlPos = cPos;
vec2 blPos = tlPos;
blPos.y += (size - 1.0);
if ((remX == remY) ||
(((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y)))))
{
if (!invert)
c = vec4(0.2, 0.15, 0.05, 1.0);
else
c = texture2D(tex, tlPos * vec2(1.0/resolution.x, 1.0/resolution.y)) * 1.4;
}
else
{
if (!invert)
c = texture2D(tex, tlPos * vec2(1.0/resolution.x, 1.0/resolution.y)) * 1.4;
else
c = vec4(0.0, 0.0, 0.0, 1.0);
}
return c;
}
void main(void) {
vec2 uv = vTexCoord;
gl_FragColor = PostFX(tex0, uv, time);
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Cross Stitch" category="Stylize">
<row name="Size">
<field type="double" default="6" id="stitching_size"/>
</row>
<row name="Invert">
<field type="bool" default="0" id="invert"/>
</row>
<shader vert="common.vert" frag="crossstitch.frag"/>
</effect>
+30
View File
@@ -0,0 +1,30 @@
#version 110
#define M_PI 3.1415926535897932384626433832795
uniform sampler2D image;
uniform float angle; // degrees
uniform float length;
uniform vec2 resolution;
void main(void) {
if (length > 0.0) {
float ceillen = ceil(length);
float radians = (angle*M_PI)/180.0;
float divider = 1.0 / ceillen;
float sin_angle = sin(radians);
float cos_angle = cos(radians);
vec4 color = vec4(0.0);
for (float i=-ceillen+0.5;i<=ceillen;i+=2.0) {
float y = sin_angle * i;
float x = cos_angle * i;
color += texture2D(image, vec2(gl_FragCoord.x+x, gl_FragCoord.y+y)/resolution)*(divider);
}
gl_FragColor = color;
} else {
gl_FragColor = texture2D(image, gl_FragCoord.xy/resolution);
}
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Directional Blur" category="Blur">
<row name="Length">
<field type="double" min="0" default="10" id="length"/>
</row>
<row name="Angle">
<field type="double" default="0" id="angle"/>
</row>
<shader vert="common.vert" frag="directionalblur.frag"/>
</effect>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Drop Shadow" category="Stylize">
<row name="Color">
<field type="color" r="0" g="0" b="0" id="shadowcolor"/>
</row>
<row name="Softness">
<field type="double" min="0" default="20" id="shadowsoftness"/>
</row>
<row name="Opacity">
<field type="double" min="0" default="100" max="100" id="shadowopacity"/>
</row>
<row name="Distance">
<field type="double" min="0" default="20" id="shadowdistance"/>
</row>
<shader vert="common.vert" frag="dropshadow.frag"/>
</effect>
+38
View File
@@ -0,0 +1,38 @@
/* Original source code: https://www.youtube.com/watch?v=I23zT7iu_Y4
Adapted */
varying vec2 vTexCoord;
uniform vec2 resolution;
uniform sampler2D tex;
uniform float contrast100;
uniform float level;
uniform bool invert;
uniform bool hslmode; // luminance is 2*V
void main() {
float contrast = contrast100 / 100.0;
vec2 onePixel = vec2(floor(level) / resolution.x, floor(level) / resolution.y); // calculating the size of one pixel on the screen for the current resolution
vec3 color = vec3(.5); // initialize color with half value on all channels
if (invert) {
color += texture2D(tex, vTexCoord - onePixel).rgb * contrast;
color -= texture2D(tex, vTexCoord + onePixel).rgb * contrast;
} else {
color -= texture2D(tex, vTexCoord - onePixel).rgb * contrast;
color += texture2D(tex, vTexCoord + onePixel).rgb * contrast;
}
// original color
vec4 color0 = texture2D(tex,vTexCoord);
// grayscale
float gray = (color.r + color.g + color.b) / (hslmode ? 3.0 : 1.5);
//self-multiply
color = color0.rgb * gray;
gl_FragColor = vec4(color * color0.a, color0.a);
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Emboss" category="Stylize">
<row name="Contrast">
<field type="double" min="0" default="50" max="100" id="contrast100"/>
</row>
<row name="Resolution">
<field type="double" min="0" default="1" max="100" id="level"/>
</row>
<row name="HSL mode">
<field type="bool" min="0" default="100" max="100" id="hslmode"/>
</row>
<row name="Invert">
<field type="bool" min="0" default="100" max="100" id="invert"/>
</row>
<shader vert="common.vert" frag="emboss.frag"/>
</effect>
+53
View File
@@ -0,0 +1,53 @@
#version 110
/*varying vec4 vertColor;
varying vec4 vertTexCoord;
uniform sampler2D texture;
//uniform vec2 texOffset;
void main(void) {
// Grouping texcoord variables in order to make it work in the GMA 950. See post #13
// in this thread:
// http://www.idevgames.com/forums/thread-3467.html
vec2 texOffset = vec2(1.0);
vec2 tc0 = vertTexCoord.st + vec2(-texOffset.s, -texOffset.t);
vec2 tc1 = vertTexCoord.st + vec2( 0.0, -texOffset.t);
vec2 tc2 = vertTexCoord.st + vec2(+texOffset.s, -texOffset.t);
vec2 tc3 = vertTexCoord.st + vec2(-texOffset.s, 0.0);
vec2 tc4 = vertTexCoord.st + vec2( 0.0, 0.0);
vec2 tc5 = vertTexCoord.st + vec2(+texOffset.s, 0.0);
vec2 tc6 = vertTexCoord.st + vec2(-texOffset.s, +texOffset.t);
vec2 tc7 = vertTexCoord.st + vec2( 0.0, +texOffset.t);
vec2 tc8 = vertTexCoord.st + vec2(+texOffset.s, +texOffset.t);
vec4 col0 = texture2D(texture, tc0);
vec4 col1 = texture2D(texture, tc1);
vec4 col2 = texture2D(texture, tc2);
vec4 col3 = texture2D(texture, tc3);
vec4 col4 = texture2D(texture, tc4);
vec4 col5 = texture2D(texture, tc5);
vec4 col6 = texture2D(texture, tc6);
vec4 col7 = texture2D(texture, tc7);
vec4 col8 = texture2D(texture, tc8);
vec4 sum = 8.0 * col4 - (col0 + col1 + col2 + col3 + col5 + col6 + col7 + col8);
gl_FragColor = vec4(sum.rgb, 1.0);// * vertColor;
}*/
varying vec4 vertTexCoord;
uniform sampler2D texture;
//uniform vec2 pixels;
void main(void)
{
vec2 pixels = vec2(16.0, 9.0);
vec2 p = vertTexCoord.st;
p.x -= mod(p.x, 1.0 / pixels.x);
p.y -= mod(p.y, 1.0 / pixels.y);
vec3 col = texture2D(texture, p).rgb;
gl_FragColor = vec4(col, 1.0);
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Find Edges" category="Color">
<row name="Bypass">
<field type="bool" default="0" id="amount"/>
</row>
<shader vert="common.vert" frag="findedges.frag"/>
</effect>
+27
View File
@@ -0,0 +1,27 @@
#version 120
uniform sampler2D tex0;
varying vec2 vTexCoord;
#define M_PI 3.1415926535897932384626433832795
uniform float size;
void main(void) {
float maxFactor = 2.0 - (size * 0.01);
vec2 uv;
vec2 xy = 2.0 * vTexCoord - 1.0;
float d = length(xy);
if (d < (2.0-maxFactor)) {
d = length(xy * maxFactor);
float z = sqrt(1.0 - d * d);
float r = atan(d, z) / M_PI;
float phi = atan(xy.y, xy.x);
uv.x = r * cos(phi) + 0.5;
uv.y = r * sin(phi) + 0.5;
} else {
uv = vTexCoord;
}
vec4 c = texture2D(tex0, uv);
gl_FragColor = c;
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Fisheye" category="Distort">
<row name="Size">
<field type="double" min="0" default="100" id="size"/>
</row>
<shader vert="common.vert" frag="fisheye.frag"/>
</effect>
+23
View File
@@ -0,0 +1,23 @@
#version 110
uniform bool horiz;
uniform bool vert;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
if (horiz) x = 1.0 - x;
if (vert) y = 1.0 - y;
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Flip" category="Distort">
<row name="Horizontal">
<field type="bool" default="1" id="horiz"/>
</row>
<row name="Vertical">
<field type="bool" default="0" id="vert"/>
</row>
<shader vert="common.vert" frag="flip.frag"/>
</effect>
+54
View File
@@ -0,0 +1,54 @@
#version 110
#define M_PI 3.1415926535897932384626433832795
uniform sampler2D image;
// uniform float radius;
uniform float sigma;
uniform vec2 resolution;
uniform bool horiz_blur;
uniform bool vert_blur;
uniform int iteration;
varying vec2 vTexCoord;
float gaussian(float x, float sigma) {
return (1.0/(sigma*sqrt(2.0*M_PI)))*exp(-0.5*pow(x/sigma, 2.0));
}
float gaussian2(float x, float y, float sigma) {
return (1.0/(pow(sigma, 2.0)*2.0*M_PI))*exp(-0.5*((pow(x, 2.0) + pow(y, 2.0))/pow(sigma, 2.0)));
}
void main(void) {
float rad = ceil(sigma);
float sum = 0.0;
vec4 color = vec4(0.0);
bool radius_is_zero = (rad == 0.0);
if (!radius_is_zero) {
for (float x=-rad+0.5;x<=rad;x+=2.0) {
sum += gaussian2(x, 0.0, sigma);
}
}
if (iteration == 0 && horiz_blur && !radius_is_zero) {
for (float x=-rad+0.5;x<=rad;x+=2.0) {
float weight = (gaussian2(x, 0.0, sigma)/sum);
color += texture2D(image, (vec2(gl_FragCoord.x+x, gl_FragCoord.y))/resolution)*(weight);
}
gl_FragColor = color;
} else if (iteration == 1 && vert_blur && !radius_is_zero) {
for (float x=-rad+0.5;x<=rad;x+=2.0) {
float weight = (gaussian2(0.0, x, sigma)/sum);
color += texture2D(image, (vec2(gl_FragCoord.x, gl_FragCoord.y+x))/resolution)*(weight);
}
gl_FragColor = color;
} else {
gl_FragColor = texture2D(image, vTexCoord);
}
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Gaussian Blur" category="Blur">
<!-- <row name="Radius">
<field type="double" min="0" default="10" id="radius"/>
</row> -->
<row name="Sigma">
<field type="double" min="0" default="5.5" id="sigma"/>
</row>
<row name="Horizontal">
<field type="bool" default="1" id="horiz_blur"/>
</row>
<row name="Vertical">
<field type="bool" default="1" id="vert_blur"/>
</row>
<shader vert="common.vert" frag="gaussianblur.frag" iterations="2"/>
</effect>
+42
View File
@@ -0,0 +1,42 @@
#version 110
uniform float hue;
uniform float saturation;
uniform float brightness;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main(void) {
vec4 tex_color = texture2D(myTexture, vTexCoord);
vec3 hsv = rgb2hsv(tex_color.rgb);
hsv.r += (hue/360.0);
hsv.g *= (saturation*0.01);
hsv.b *= (brightness*0.01);
vec3 rgb = hsv2rgb(hsv);
gl_FragColor = vec4(
rgb.r,
rgb.g,
rgb.b,
tex_color.a
);
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Hue/Saturation/Brightness" category="Color">
<row name="Hue">
<field type="double" default="0" id="hue"/>
</row>
<row name="Saturation">
<field type="double" min="0" default="100" id="saturation"/>
</row>
<row name="Brightness">
<field type="double" min="0" default="100" id="brightness"/>
</row>
<shader vert="common.vert" frag="huesatbri.frag"/>
</effect>
+13
View File
@@ -0,0 +1,13 @@
#version 110
uniform float amount;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec4 textureColor = texture2D(myTexture, vTexCoord);
float amount_val = amount * 0.01;
vec3 col = textureColor.rgb+((vec3(1.0)-textureColor.rgb-textureColor.rgb)*vec3(amount_val));
gl_FragColor = vec4(col, textureColor.a);
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Invert" category="Color">
<row name="Amount">
<field type="double" min="0" default="100" max="100" id="amount"/>
</row>
<shader vert="common.vert" frag="invert.frag"/>
</effect>
+29
View File
@@ -0,0 +1,29 @@
/* Luma key simple program
Based on Edward Cannon's Simple Chroma Key (adaptation by Olive Team)
Feel free to modify and use at will */
uniform sampler2D tex;
varying vec2 vTexCoord;
uniform float loc;
uniform float hic;
uniform bool invert;
void main(void) {
vec4 texture_color = texture2D(tex,vTexCoord);
float luma = max(max(texture_color.r,texture_color.g), texture_color.b) + min(min(texture_color.r,texture_color.g), texture_color.b);
luma /= 2.0;
if (luma > hic/100.0) {
texture_color.a = (invert ? 0.0 : 1.0);
} else if (luma < loc/100.0) {
texture_color.a = (invert ? 1.0 : 0.0);
} else {
texture_color.a = (invert ? 1.0-luma : luma);
}
texture_color.rgb *= texture_color.a;
gl_FragColor = texture_color;
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Luma Key" category="Keying">
<row name="Lower Limit">
<field type="double" min="0" default="0" max="100" id="loc"/>
</row>
<row name="Upper Limit">
<field type="double" min="0" default="100" max="100" id="hic"/>
</row>
<row name="Invert">
<field type="bool" min="0" default="100" max="100" id="invert"/>
</row>
<shader vert="common.vert" frag="lumakey.frag"/>
</effect>
+47
View File
@@ -0,0 +1,47 @@
#version 110
uniform vec2 resolution;
uniform float time;
uniform float amount;
uniform bool color;
uniform bool blend;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
// precision lowp float;
float PHI = 1.61803398874989484820459 * 00000.1; // Golden Ratio
float PI = 3.14159265358979323846264 * 00000.1; // PI
float SQ2 = 1.41421356237309504880169 * 10000.0; // Square Root of Two
float gold_noise(vec2 coordinate, float seed){
return fract(tan(distance(coordinate*(seed+PHI), vec2(PHI, PI)))*SQ2)*(amount*0.01);
}
void main(void) {
vec3 noise;
if (color) {
noise = vec3(gold_noise(vTexCoord, time + 42069.0), gold_noise(vTexCoord, time + 69220.0), gold_noise(vTexCoord, time + 1337.0));
} else {
noise = vec3(gold_noise(vTexCoord, time + 69420.0));
}
if (blend) {
noise = (noise - vec3(amount*0.005))*vec3(2.0);
vec4 textureColor = texture2D(myTexture, vec2(vTexCoord.x, vTexCoord.y));
gl_FragColor = vec4(textureColor.rgb+noise, textureColor.a);
} else {
gl_FragColor = vec4(noise, 1.0);
}
}
/*void main(void) {
vec4 textureColor = texture2D(myTexture, vec2(vTexCoord.x, vTexCoord.y));
textureColor.r += gold_noise(resolution);
textureColor.g += gold_noise(resolution);
textureColor.b += gold_noise(resolution);
gl_FragColor = textureColor;
}*/
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Noise" category="Color">
<row name="Amount">
<field type="double" min="0" default="20" max="100" id="amount"/>
</row>
<row name="Color Noise">
<field type="bool" default="0" id="color"/>
</row>
<row name="Blend">
<field type="bool" default="1" id="blend"/>
</row>
<shader vert="common.vert" frag="noise.frag"/>
</effect>
+20
View File
@@ -0,0 +1,20 @@
#version 110
varying vec2 vTexCoord;
uniform sampler2D texture;
uniform float pixels_x;
uniform float pixels_y;
uniform bool bypass;
void main(void) {
if (bypass) {
gl_FragColor = texture2D(texture, vTexCoord);
} else {
vec2 p = vTexCoord;
p.x -= mod(p.x, 1.0 / pixels_x);
p.y -= mod(p.y, 1.0 / pixels_y);
gl_FragColor = texture2D(texture, p);
}
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Pixelate" category="Stylize">
<row name="Horizontal Pixels">
<field type="double" min="0" default="16" id="pixels_x"/>
</row>
<row name="Vertical Pixels">
<field type="double" min="0" default="9" id="pixels_y"/>
</row>
<row name="Bypass">
<field type="bool" default="0" id="bypass"/>
</row>
<shader vert="common.vert" frag="pixelate.frag"/>
</effect>
+19
View File
@@ -0,0 +1,19 @@
#version 110
uniform sampler2D sceneTex; // 0
uniform float gamma_cent; // 0.6
uniform float numColors; // 8.0
varying vec2 vTexCoord;
void main() {
float gamma = gamma_cent*0.01;
vec4 color = texture2D(sceneTex, vTexCoord);
vec3 c = color.rgb;
c = pow(c, vec3(gamma, gamma, gamma));
c = c * numColors;
c = floor(c);
c = c / numColors;
c = pow(c, vec3(1.0/gamma));
gl_FragColor = vec4(c, color.a);
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Posterize" category="Stylize">
<row name="Colors">
<field type="double" min="0" default="8" id="numColors"/>
</row>
<row name="Gamma">
<field type="double" min="0" default="60" id="gamma_cent"/>
</row>
<shader vert="common.vert" frag="posterize.frag"/>
</effect>
+37
View File
@@ -0,0 +1,37 @@
#version 110
#define M_PI 3.1415926535897932384626433832795
uniform sampler2D image;
uniform float radius;
uniform float center_x;
uniform float center_y;
uniform vec2 resolution;
void main(void) {
if (radius > 0.0) {
vec2 distance = vec2((gl_FragCoord.x - (resolution.x/2.0) - center_x), (gl_FragCoord.y - (resolution.y/2.0) - center_y));
float angle = atan(distance.y/distance.x);
float sin_angle = sin(angle);
float cos_angle = cos(angle);
float multiplier = length(distance/resolution);
float limit = ceil(radius * multiplier);
float divider = 1.0 / limit;
vec4 color = vec4(0.0);
for (float i=-limit+0.5;i<=limit;i+=2.0) {
float y = sin_angle * i;
float x = cos_angle * i;
color += texture2D(image, vec2(gl_FragCoord.x+x, gl_FragCoord.y+y)/resolution)*(divider);
}
gl_FragColor = color;
} else {
gl_FragColor = texture2D(image, gl_FragCoord.xy/resolution);
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Radial Blur" category="Blur">
<row name="Radius">
<field type="double" min="0" default="100" id="radius"/>
</row>
<row name="Center">
<field type="double" default="0" id="center_x"/>
<field type="double" default="0" id="center_y"/>
</row>
<shader vert="common.vert" frag="radialblur.frag"/>
</effect>
+34
View File
@@ -0,0 +1,34 @@
#version 110
varying vec2 vTexCoord;
uniform float speed;
uniform float intensity;
uniform float frequency;
uniform float xoff;
uniform float yoff;
uniform bool reverse;
uniform bool stretch;
uniform vec2 resolution; // Screen resolution
uniform float time; // time in seconds
uniform sampler2D tex0; // scene buffer
void main(void) {
vec2 texCoord = vTexCoord;
vec2 center = vec2(1.0);
if (!stretch) {
texCoord.x *= (resolution.x/resolution.y);
center.x += (resolution.x/resolution.y)/2.0;
}
center += vec2(xoff, yoff)*0.01;
float real_time = (reverse) ? -time : time;
vec2 p = 2.0 * texCoord - center;
float len = length(p);
vec2 uv = vTexCoord + (p/len)*cos((frequency*0.01)*(len*12.0-real_time*(speed*0.05)))*(intensity*0.0005);
gl_FragColor = texture2D(tex0,uv);
}
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Ripple" category="Distort">
<row name="Speed">
<field type="double" min="0" default="100" id="speed"/>
</row>
<row name="Intensity">
<field type="double" min="0" default="100" id="intensity"/>
</row>
<row name="Frequency">
<field type="double" min="0" default="100" id="frequency"/>
</row>
<row name="Reverse">
<field type="bool" default="0" id="reverse"/>
</row>
<row name="Stretch">
<field type="bool" default="0" id="stretch"/>
</row>
<row name="Center">
<field type="double" default="0" id="xoff"/>
<field type="double" default="0" id="yoff"/>
</row>
<shader vert="common.vert" frag="ripple.frag"/>
</effect>
+45
View File
@@ -0,0 +1,45 @@
#version 110
varying vec2 vTexCoord;
uniform vec2 resolution; // Screen resolution
uniform sampler2D tex0; // scene buffer
uniform float xoff;
uniform float yoff;
uniform float scale;
uniform bool tile;
uniform bool hide_edges;
uniform bool stretch;
void main(void) {
vec2 texCoord = vTexCoord;
vec2 offset = vec2(1.0);
if (!stretch) {
if (resolution.x > resolution.y) {
offset.x = (resolution.x/resolution.y);
texCoord.x *= offset.x;
} else {
offset.y = (resolution.y/resolution.x);
texCoord.y *= offset.y;
}
}
vec2 p = 2.0 * texCoord - offset;
vec2 adj_tc = 2.0 * vTexCoord - 1.0;
float r = dot(p,p);
if (r > 1.0) discard;
float f = (1.0-sqrt(1.0-r))/(r);
vec2 uv;
uv.x = (adj_tc.x*(1.5-scale*0.01))*f+0.5-(xoff*0.01);
uv.y = (adj_tc.y*(1.5-scale*0.01))*f+0.5-(yoff*0.01);
if (tile) {
uv.x = mod(uv.x, 1.0);
uv.y = mod(uv.y, 1.0);
} else if (hide_edges && (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)) {
discard;
}
gl_FragColor = vec4(texture2D(tex0,uv));
}
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Sphere" category="Distort">
<row name="Center">
<field type="double" default="0" id="xoff"/>
<field type="double" default="0" id="yoff"/>
</row>
<row name="Scale">
<field type="double" default="75" max="150" id="scale"/>
</row>
<row name="Tile">
<field type="bool" default="1" id="tile"/>
</row>
<row name="Hide Edges">
<field type="bool" default="0" id="hide_edges"/>
</row>
<row name="Stretch">
<field type="bool" default="1" id="stretch"/>
</row>
<shader vert="common.vert" frag="sphere.frag"/>
</effect>
+31
View File
@@ -0,0 +1,31 @@
#version 110
// Swirl effect parameters
uniform float radius;
uniform float angle;
uniform float center_x;
uniform float center_y;
uniform vec2 resolution;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
vec2 center = vec2((resolution.x*0.5)+center_x, (resolution.y*0.5)+center_y);
vec2 uv = vTexCoord.st;
vec2 tc = uv * resolution;
tc -= center;
float dist = length(tc);
if (dist < radius) {
float percent = (radius - dist) / radius;
float theta = percent * percent * (-angle*0.05) * 8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec3 color = texture2D(myTexture, tc / resolution).rgb;
gl_FragColor = vec4(color, 1.0);
}
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Swirl" category="Distort">
<row name="Radius">
<field type="double" min="0" default="200" id="radius"/>
</row>
<row name="Angle">
<field type="double" default="10" id="angle"/>
</row>
<row name="Center">
<field type="double" default="0" id="center_x"/>
<field type="double" default="0" id="center_y"/>
</row>
<shader vert="common.vert" frag="swirl.frag"/>
</effect>
+43
View File
@@ -0,0 +1,43 @@
#version 110
varying vec2 vTexCoord;
uniform sampler2D tex0; // scene buffer
uniform float scale;
uniform float centerx;
uniform float centery;
uniform bool mirrorx;
uniform bool mirrory;
void main(void) {
vec2 texCoord = vTexCoord;
/*vec2 coord = vec2(
mod(vTexCoord.x*tilecount, 1.0),
mod(vTexCoord.y*tilecount, 1.0)
);
if (mirrorx && mod(vTexCoord.x*tilecount, 2.0) > 1.0) {
coord.x = 1.0 - coord.x;
}
if (mirrory && mod(vTexCoord.y*tilecount, 2.0) > 1.0) {
coord.y = 1.0 - coord.y;
}*/
float adj_scale = scale*0.01;
vec2 scaled_coords = (vTexCoord/adj_scale);
vec2 coord = scaled_coords-vec2(0.5/adj_scale, 0.5/adj_scale)+vec2(0.5, 0.5)+vec2(-centerx*0.01, -centery*0.01);
vec2 modcoord = mod(coord, 1.0);
if (mirrorx && mod(coord.x, 2.0) > 1.0) {
modcoord.x = 1.0 - modcoord.x;
}
if (mirrory && mod(coord.y, 2.0) > 1.0) {
modcoord.y = 1.0 - modcoord.y;
}
gl_FragColor = vec4(texture2D(tex0, modcoord));
}
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Tile" category="Distort">
<row name="Scale">
<field type="double" min="0" default="50" id="scale"/>
</row>
<row name="Center">
<field type="double" default="0" id="centerx"/>
<field type="double" default="0" id="centery"/>
</row>
<row name="Mirror X">
<field type="bool" default="0" id="mirrorx"/>
</row>
<row name="Mirror Y">
<field type="bool" default="0" id="mirrory"/>
</row>
<shader vert="common.vert" frag="tile.frag"/>
</effect>
+168
View File
@@ -0,0 +1,168 @@
#version 150
uniform sampler2D tex0;
in vec2 vTexCoord;
out vec4 FragColor;
uniform float colors; // 12.0
uniform float sat_levels; // 4.0
uniform float bri_levels; // 4.0
uniform float edge_thres; // 0.2;
uniform float edge_thres2; // 5.0;
vec3 RGBtoHSV( float r, float g, float b)
{
float minv, maxv, delta;
vec3 res;
minv = min(min(r, g), b);
maxv = max(max(r, g), b);
res.z = maxv; // v
delta = maxv - minv;
if( maxv != 0.0 )
res.y = delta / maxv; // s
else {
// r = g = b = 0 // s = 0, v is undefined
res.y = 0.0;
res.x = -1.0;
return res;
}
if( r == maxv )
res.x = ( g - b ) / delta; // between yellow & magenta
else if( g == maxv )
res.x = 2.0 + ( b - r ) / delta; // between cyan & yellow
else
res.x = 4.0 + ( r - g ) / delta; // between magenta & cyan
res.x = res.x * 60.0; // degrees
if( res.x < 0.0 )
res.x = res.x + 360.0;
return res;
}
vec3 HSVtoRGB(float h, float s, float v )
{
int i;
float f, p, q, t;
vec3 res;
if( s == 0.0 )
{
// achromatic (grey)
res.x = v;
res.y = v;
res.z = v;
return res;
}
h /= 60.0; // sector 0 to 5
i = int(floor( h ));
f = h - float(i); // factorial part of h
p = v * ( 1.0 - s );
q = v * ( 1.0 - s * f );
t = v * ( 1.0 - s * ( 1.0 - f ) );
switch(i)
{
case 0:
res.x = v;
res.y = t;
res.z = p;
break;
case 1:
res.x = q;
res.y = v;
res.z = p;
break;
case 2:
res.x = p;
res.y = v;
res.z = t;
break;
case 3:
res.x = p;
res.y = q;
res.z = v;
break;
case 4:
res.x = t;
res.y = p;
res.z = v;
break;
default: // case 5:
res.x = v;
res.y = p;
res.z = q;
break;
}
return res;
}
// averaged pixel intensity from 3 color channels
float avg_intensity(vec4 pix)
{
return (pix.r + pix.g + pix.b)/3.;
}
vec4 get_pixel(vec2 coords, float dx, float dy)
{
return texture(tex0,coords + vec2(dx, dy));
}
// returns pixel color
float IsEdge(in vec2 coords)
{
float dxtex = 1.0 /float(textureSize(tex0,0)) ;
float dytex = 1.0 /float(textureSize(tex0,0));
float pix[9];
int k = -1;
float delta;
// read neighboring pixel intensities
for (int i=-1; i<2; i++) {
for(int j=-1; j<2; j++) {
k++;
pix[k] = avg_intensity(get_pixel(coords,float(i)*dxtex,
float(j)*dytex));
}
}
// average color differences around neighboring pixels
delta = (abs(pix[1]-pix[7])+
abs(pix[5]-pix[3]) +
abs(pix[0]-pix[8])+
abs(pix[2]-pix[6])
)/4.;
//return clamp(5.5*delta,0.0,1.0);
return clamp(edge_thres2*delta,0.0,1.0);
}
void main() {
vec2 uv = vTexCoord.xy;
vec4 tc = vec4(1.0, 0.0, 0.0, 1.0);
vec3 colorOrg = texture(tex0, uv).rgb;
vec3 vHSV = RGBtoHSV(colorOrg.r,colorOrg.g,colorOrg.b);
// hue limiting
if (colors == 0.0) {
vHSV.y = 0.0;
} else {
float hue_divider = (360.0/colors);
vHSV.x = round(vHSV.x/hue_divider)*hue_divider;
float sat_divider = 100.0/sat_levels;
vHSV.y = round((vHSV.y*100.0)/sat_divider)*sat_divider/100.0;
}
float bri_divider = 100.0/bri_levels;
vHSV.z = round((vHSV.z*100.0)/bri_divider)*bri_divider/100.0;
float edg = IsEdge(uv);
vec3 vRGB = (edg >= (1.0-((edge_thres-1.0)*0.01)))? vec3(0.0,0.0,0.0):HSVtoRGB(vHSV.x,vHSV.y,vHSV.z);
tc = vec4(vRGB.x,vRGB.y,vRGB.z, 1);
FragColor = tc;
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Toonify" category="Stylize">
<row name="Colors">
<field type="double" min="0" default="12" max="360" id="colors"/>
</row>
<row name="Saturation Levels">
<field type="double" min="0" default="4" id="sat_levels"/>
</row>
<row name="Brightness Levels">
<field type="double" min="0" default="4" id="bri_levels"/>
</row>
<row name="Edge Tolerance">
<field type="double" default="20" id="edge_thres"/>
</row>
<row name="Edge Strength">
<field type="double" default="5" id="edge_thres2"/>
</row>
<shader vert="common.vert" frag="toonify.frag"/>
</effect>
+27
View File
@@ -0,0 +1,27 @@
#version 110
uniform sampler2D sceneTex; // 0
uniform float lensRadiusX;
uniform float lensRadiusY;
uniform bool circular;
uniform vec2 resolution;
// uniform vec2 lensRadius; // 0.45, 0.38
varying vec2 vTexCoord;
void main(void) {
if (lensRadiusX == 0.0) {
discard;
}
vec4 c = texture2D(sceneTex, vTexCoord);
vec2 vignetteCoord = vTexCoord;
if (circular) {
float ar = (resolution.x/resolution.y);
vignetteCoord.x *= ar;
vignetteCoord.x -= (1.0-(1.0/ar));
}
float dist = distance(vignetteCoord, vec2(0.5,0.5));
float size = (lensRadiusX*0.01);
c *= smoothstep(size, size*0.99*(1.0-lensRadiusY*0.01), dist);
gl_FragColor = c;
}
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Vignette" category="Stylize">
<row name="Size">
<field type="double" min="0" default="45" id="lensRadiusX"/>
</row>
<row name="Softness">
<field type="double" min="0" default="38" id="lensRadiusY"/>
</row>
<row name="Circular">
<field type="bool" default="false" id="circular"/>
</row>
<shader vert="common.vert" frag="vignette.frag"/>
</effect>
+19
View File
@@ -0,0 +1,19 @@
#version 110
uniform float amount;
uniform sampler2D tex0;
uniform vec2 resolution; // screen resolution
varying vec2 vTexCoord;
#define T texture2D(tex0,.5+(p.xy*=.992))
void main() {
float alpha = texture2D(tex0, vTexCoord)[3];
vec3 p = gl_FragCoord.xyz/vec3(resolution, 1.0)-.5;
vec3 o = T.rgb;
for (float i=0.;i<amount;i++) {
p.z += pow(max(0.,.5-length(T.rg)),2.)*exp(-i*.08);
}
gl_FragColor=vec4(o*o+p.z, alpha);
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Volumetric Light" category="Stylize">
<row name="Amount">
<field type="double" min="0" default="100" id="amount"/>
</row>
<shader vert="common.vert" frag="volumetriclight.frag"/>
</effect>
+32
View File
@@ -0,0 +1,32 @@
#version 110
uniform float frequency;
uniform float intensity;
uniform float evolution;
uniform bool vertical;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
if (vertical) {
x -= sin((vTexCoord.y-(evolution*0.01))*frequency)*intensity*0.01;
} else {
y -= sin((vTexCoord.x-(evolution*0.01))*frequency)*intensity*0.01;
}
if (y < 0.0 || y > 1.0 || x < 0.0 || x > 1.0) {
discard;
} else {
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
}
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<effect name="Wave" category="Distort">
<row name="Frequency">
<field type="double" min="0" default="10" id="frequency"/>
</row>
<row name="Intensity">
<field type="double" default="10" id="intensity"/>
</row>
<row name="Evolution">
<field type="double" default="0" id="evolution"/>
</row>
<row name="Vertical">
<field type="bool" default="0" id="vertical"/>
</row>
<shader vert="common.vert" frag="wave.frag"/>
</effect>