Shader cleanup
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
bool id(vec2 coords, vec4 base){
|
||||
vec4 target = texture2D(u_texture, coords);
|
||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
||||
}
|
||||
|
||||
bool cont(vec2 T, vec2 v){
|
||||
float step = 1.0;
|
||||
vec4 base = texture2D(u_texture, T);
|
||||
return base.a > 0.1 &&
|
||||
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
||||
id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base));
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 t = v_texCoord.xy;
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
vec2 coord = t / v;
|
||||
vec4 c = texture2D(u_texture, t);
|
||||
|
||||
if(cont(t, v)){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
uniform mat4 u_projectionViewMatrix;
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
|
||||
void main()
|
||||
{
|
||||
v_color = a_color;
|
||||
v_color.a = v_color.a * (255.0/254.0);
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projectionViewMatrix * a_position;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform vec4 u_color;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||
|
||||
c = mix(c, vec4(v_color.r, v_color.g, v_color.b, c.a), v_color.a);
|
||||
|
||||
gl_FragColor = c * vec4(v_color.rgb, 1.0);
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
uniform float u_progress;
|
||||
uniform float u_time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const float chunk = 4.0;
|
||||
const float start = 0.7;
|
||||
const float end = 0.9;
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float round(float f){
|
||||
return float(int(f / chunk)) * chunk;
|
||||
}
|
||||
|
||||
bool id(vec2 coords, vec4 base, float basediff){
|
||||
vec4 target = texture2D(u_texture, coords);
|
||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
||||
}
|
||||
|
||||
bool cont(vec2 T, vec2 v, float basediff){
|
||||
float step = 1.0;
|
||||
vec4 base = texture2D(u_texture, T);
|
||||
return base.a > 0.1 &&
|
||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
||||
}
|
||||
|
||||
bool complete(vec2 coords){
|
||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
||||
float fr = (r-start)*(1.0/(end-start));
|
||||
|
||||
vec2 next = rc + chunk/2.0;
|
||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y));
|
||||
return rdst / (chunk/2.0) < fr;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 t = v_texCoord.xy;
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
bool any = false;
|
||||
|
||||
vec2 coords = (v_texCoord-u_uv) / v;
|
||||
|
||||
|
||||
float value = coords.x + coords.y;
|
||||
|
||||
vec4 color = texture2D(u_texture, t);
|
||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
||||
|
||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
||||
|
||||
const float scl = 10.0;
|
||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
||||
|
||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else if(r > end){
|
||||
gl_FragColor = color;
|
||||
}else if((cont(t, v, 100.0) && mod(u_time / 1.5 + value, 20.0) < 5.0 && color.a > 0.1) ||
|
||||
(complete(coords) && (!complete(coords + vec2(1.0, 0.0)) || !complete(coords + vec2(-1.0, 0.0)) || !complete(coords + vec2(0.0, 1.0))
|
||||
|| !complete(coords + vec2(0.0, -1.0))))){
|
||||
gl_FragColor = u_color;
|
||||
}else if(r > start && color.a > 0.1){
|
||||
float fr = (r-start)*(1.0/(end-start));
|
||||
|
||||
vec2 next = rc + chunk/2.0;
|
||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y));
|
||||
if(rdst / (chunk/2.0) < fr){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
uniform float u_progress;
|
||||
uniform float u_time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
float diff(vec4 target, vec4 base){
|
||||
return (max(target.a / base.a, max(target.r / base.r, max(target.g / base.g, target.b / base.b))) -
|
||||
min (target.a / base.a, min(target.r / base.r, min(target.g / base.g, target.b / base.b)))) * 4.0;
|
||||
}
|
||||
|
||||
bool id(vec2 coords, vec4 base, float basediff){
|
||||
vec4 target = texture2D(u_texture, coords);
|
||||
return (diff(target, base)) > basediff - basediff*u_progress
|
||||
|| (basediff < 5.0 && (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y));
|
||||
}
|
||||
|
||||
bool cont(vec2 T, vec2 v, float basediff){
|
||||
float step = 1.0;
|
||||
vec4 base = texture2D(u_texture, T);
|
||||
return base.a > 0.1 &&
|
||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
||||
}
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 t = v_texCoord.xy;
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
vec2 coords = (v_texCoord-u_uv) / v;
|
||||
float value = coords.x + coords.y;
|
||||
|
||||
vec4 color = texture2D(u_texture, t);
|
||||
|
||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
||||
|
||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else if(cont(t, v, 6.0)){
|
||||
gl_FragColor = color;
|
||||
}else if(cont(t, v, 3.0) && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
uniform float u_progress;
|
||||
uniform float u_time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
|
||||
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
|
||||
|
||||
float snoise(vec3 v){
|
||||
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
|
||||
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
// First corner
|
||||
vec3 i = floor(v + dot(v, C.yyy) );
|
||||
vec3 x0 = v - i + dot(i, C.xxx) ;
|
||||
|
||||
// Other corners
|
||||
vec3 g = step(x0.yzx, x0.xyz);
|
||||
vec3 l = 1.0 - g;
|
||||
vec3 i1 = min( g.xyz, l.zxy );
|
||||
vec3 i2 = max( g.xyz, l.zxy );
|
||||
|
||||
// x0 = x0 - 0. + 0.0 * C
|
||||
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
|
||||
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
|
||||
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
|
||||
|
||||
// Permutations
|
||||
i = mod(i, 289.0 );
|
||||
vec4 p = permute( permute( permute(
|
||||
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
|
||||
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
|
||||
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
|
||||
|
||||
// Gradients
|
||||
// ( N*N points uniformly over a square, mapped onto an octahedron.)
|
||||
float n_ = 1.0/7.0; // N=7
|
||||
vec3 ns = n_ * D.wyz - D.xzx;
|
||||
|
||||
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
|
||||
|
||||
vec4 x_ = floor(j * ns.z);
|
||||
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
|
||||
|
||||
vec4 x = x_ *ns.x + ns.yyyy;
|
||||
vec4 y = y_ *ns.x + ns.yyyy;
|
||||
vec4 h = 1.0 - abs(x) - abs(y);
|
||||
|
||||
vec4 b0 = vec4( x.xy, y.xy );
|
||||
vec4 b1 = vec4( x.zw, y.zw );
|
||||
|
||||
vec4 s0 = floor(b0)*2.0 + 1.0;
|
||||
vec4 s1 = floor(b1)*2.0 + 1.0;
|
||||
vec4 sh = -step(h, vec4(0.0));
|
||||
|
||||
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
|
||||
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
|
||||
|
||||
vec3 p0 = vec3(a0.xy,h.x);
|
||||
vec3 p1 = vec3(a0.zw,h.y);
|
||||
vec3 p2 = vec3(a1.xy,h.z);
|
||||
vec3 p3 = vec3(a1.zw,h.w);
|
||||
|
||||
//Normalise gradients
|
||||
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
// Mix final noise value
|
||||
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
||||
m = m * m;
|
||||
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
||||
dot(p2,x2), dot(p3,x3) ) );
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 t = v_texCoord.xy;
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
vec2 coords = (v_texCoord-u_uv) / v;
|
||||
|
||||
const float scl = 10.0;
|
||||
float result = (snoise(vec3(coords.x / scl, coords.y / scl, u_time/400000.0)) + 1.0)/2.0;
|
||||
|
||||
vec4 color = texture2D(u_texture, t);
|
||||
|
||||
if(result < u_progress){
|
||||
gl_FragColor = color;
|
||||
}else if(result < u_progress*2.0 && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform vec2 u_uv;
|
||||
uniform vec2 u_uv2;
|
||||
uniform float u_progress;
|
||||
uniform float u_time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const float chunk = 4.0;
|
||||
|
||||
bool id(vec2 coords, vec4 base, float basediff){
|
||||
vec4 target = texture2D(u_texture, coords);
|
||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
||||
}
|
||||
|
||||
bool cont(vec2 T, vec2 v, float basediff){
|
||||
float step = 1.0;
|
||||
vec4 base = texture2D(u_texture, T);
|
||||
return base.a > 0.1 &&
|
||||
(id(T + vec2(0, step) * v, base, basediff) || id(T + vec2(0, -step) * v, base, basediff) ||
|
||||
id(T + vec2(step, 0) * v, base, basediff) || id(T + vec2(-step, 0) * v, base, basediff));
|
||||
}
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float round(float f){
|
||||
return float(int(f / chunk)) * chunk;
|
||||
}
|
||||
|
||||
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
|
||||
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
|
||||
|
||||
float snoise(vec3 v){
|
||||
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
|
||||
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
// First corner
|
||||
vec3 i = floor(v + dot(v, C.yyy) );
|
||||
vec3 x0 = v - i + dot(i, C.xxx) ;
|
||||
|
||||
// Other corners
|
||||
vec3 g = step(x0.yzx, x0.xyz);
|
||||
vec3 l = 1.0 - g;
|
||||
vec3 i1 = min( g.xyz, l.zxy );
|
||||
vec3 i2 = max( g.xyz, l.zxy );
|
||||
|
||||
// x0 = x0 - 0. + 0.0 * C
|
||||
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
|
||||
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
|
||||
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
|
||||
|
||||
// Permutations
|
||||
i = mod(i, 289.0 );
|
||||
vec4 p = permute( permute( permute(
|
||||
i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
|
||||
+ i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
|
||||
+ i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
|
||||
|
||||
// Gradients
|
||||
// ( N*N points uniformly over a square, mapped onto an octahedron.)
|
||||
float n_ = 1.0/7.0; // N=7
|
||||
vec3 ns = n_ * D.wyz - D.xzx;
|
||||
|
||||
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
|
||||
|
||||
vec4 x_ = floor(j * ns.z);
|
||||
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
|
||||
|
||||
vec4 x = x_ *ns.x + ns.yyyy;
|
||||
vec4 y = y_ *ns.x + ns.yyyy;
|
||||
vec4 h = 1.0 - abs(x) - abs(y);
|
||||
|
||||
vec4 b0 = vec4( x.xy, y.xy );
|
||||
vec4 b1 = vec4( x.zw, y.zw );
|
||||
|
||||
vec4 s0 = floor(b0)*2.0 + 1.0;
|
||||
vec4 s1 = floor(b1)*2.0 + 1.0;
|
||||
vec4 sh = -step(h, vec4(0.0));
|
||||
|
||||
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
|
||||
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
|
||||
|
||||
vec3 p0 = vec3(a0.xy,h.x);
|
||||
vec3 p1 = vec3(a0.zw,h.y);
|
||||
vec3 p2 = vec3(a1.xy,h.z);
|
||||
vec3 p3 = vec3(a1.zw,h.w);
|
||||
|
||||
//Normalise gradients
|
||||
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
// Mix final noise value
|
||||
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
|
||||
m = m * m;
|
||||
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
||||
dot(p2,x2), dot(p3,x3) ) );
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 t = v_texCoord.xy;
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
bool any = false;
|
||||
|
||||
vec2 coords = (v_texCoord-u_uv) / v;
|
||||
|
||||
/*
|
||||
const float scl = 10.0;
|
||||
float result = (snoise(vec3(coords.x / scl, coords.y / scl, u_time/400000.0)) + 1.0)/2.0;
|
||||
|
||||
vec4 color = texture2D(u_texture, t);
|
||||
|
||||
if(result < u_progress){
|
||||
gl_FragColor = color;
|
||||
}else if(result < u_progress*2.0 && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}*/
|
||||
|
||||
|
||||
float value = coords.x + coords.y;
|
||||
|
||||
vec4 color = texture2D(u_texture, t);
|
||||
vec2 rc = vec2(round(coords.x), round(coords.y));
|
||||
vec2 center = ((u_uv + u_uv2)/2.0 - u_uv) /v;
|
||||
|
||||
float r = clamp(rand(rc) + u_progress, 0.0, 1.0);
|
||||
|
||||
const float start = 0.7;
|
||||
const float end = 0.9;
|
||||
|
||||
const float scl = 10.0;
|
||||
float result = snoise(vec3(coords.x / scl, coords.y / scl, u_time/400.0))*2.0;
|
||||
float dst = (abs(center.x - coords.x) + abs(center.y - coords.y)) / 2.0;
|
||||
|
||||
if(dst - 1.0 < u_progress * (center.x) && dst> u_progress * (center.x) && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else if(r > end){
|
||||
gl_FragColor = color;
|
||||
}else if(cont(t, v, 100.0) && mod(u_time / 1.5 + value, 20.0) < 5.0 && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else if(r > start && color.a > 0.1){
|
||||
float fr = (r-start)*(1.0/(end-start));
|
||||
|
||||
vec2 next = rc + chunk/2.0;
|
||||
float rdst = max(abs(coords.x - next.x), abs(coords.y - next.y)) + result;
|
||||
if(rdst / (chunk/2.0) < fr){
|
||||
gl_FragColor = u_color;
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
/*
|
||||
if(mod(u_time / 1.5 + value, 30.0) < 15.0 && color.a > 0.1){
|
||||
gl_FragColor = u_color;
|
||||
}else if(cont(t, v, 3.0)){
|
||||
gl_FragColor = color;
|
||||
}else if(cont(t, v, 1.5)){
|
||||
gl_FragColor = u_color;
|
||||
//}else if(mix(rand(vec2(dst)) * u_progress, 1.0, u_progress) > 0.5){
|
||||
// gl_FragColor = texture2D(u_texture, T);
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}*/
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
#define s2 vec4(255.0, 165.0, 0.0, 255.0) / 255.0
|
||||
#define s1 vec4(255.0, 121.0, 62.0, 255.0) / 255.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 camerapos;
|
||||
uniform vec2 screensize;
|
||||
uniform float time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
float round(float num, float f){
|
||||
return float(int(num / f)) * f;
|
||||
}
|
||||
|
||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
||||
|
||||
float snoise(vec2 v){
|
||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
||||
-0.577350269189626, 0.024390243902439);
|
||||
vec2 i = floor(v + dot(v, C.yy) );
|
||||
vec2 x0 = v - i + dot(i, C.xx);
|
||||
vec2 i1;
|
||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
||||
vec4 x12 = x0.xyxy + C.xxzz;
|
||||
x12.xy -= i1;
|
||||
i = mod(i, 289.0);
|
||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
||||
dot(x12.zw,x12.zw)), 0.0);
|
||||
m = m*m ;
|
||||
m = m*m ;
|
||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
||||
vec3 h = abs(x) - 0.5;
|
||||
vec3 ox = floor(x + 0.5);
|
||||
vec3 a0 = x - ox;
|
||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
||||
vec3 g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
return 130.0 * dot(m, g);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 c = v_texCoord.xy;
|
||||
vec4 color = texture2D(u_texture, c);
|
||||
|
||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
||||
|
||||
float stime = time / 5.0;
|
||||
|
||||
float mscl = 30.0;
|
||||
float mth = 5.0;
|
||||
|
||||
//if there's something actually there
|
||||
if(color.r > 0.01){
|
||||
vec4 old = color;
|
||||
color = texture2D(u_texture, c + vec2(sin(stime/3.0 + coords.y/0.75) * v.x, 0.0)) * vec4(0.9, 0.9, 1, 1.0);
|
||||
color.a = 1.0;
|
||||
|
||||
if(color.r < 0.01){
|
||||
color = old;
|
||||
}
|
||||
|
||||
const float bs = 1.0;
|
||||
|
||||
float n1 = snoise(coords / (20.0 * bs) + vec2(time) / 250.0);
|
||||
float n2 = snoise((coords + vec2(632.0)) / (9.0 * bs) + vec2(0.0, -time) / 220.0);
|
||||
float n3 = snoise((coords + vec2(2233.0)) / (15.0 * bs) + vec2(time, 0.0) / 290.0);
|
||||
|
||||
float r = (n1 + n2 + n3) / 3.0;
|
||||
|
||||
if(r < -0.5){
|
||||
color = s2;
|
||||
}else if(r < -0.2){
|
||||
color = s1;
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ void main() {
|
||||
|
||||
vec4 c = texture2D(u_texture, v_texCoord.xy);
|
||||
|
||||
c = mix(c, vec4(u_color.r, u_color.g, u_color.b, c.a), v_color.a);
|
||||
c = mix(c, vec4(u_color.rgb, c.a), v_color.a);
|
||||
|
||||
gl_FragColor = c * vec4(v_color.rgb, 1.0);
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
#define s1 vec4(63.0, 63.0, 63.0, 255.0) / 255.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 camerapos;
|
||||
uniform vec2 screensize;
|
||||
uniform float time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
float round(float num, float f){
|
||||
return float(int(num / f)) * f;
|
||||
}
|
||||
|
||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
||||
|
||||
float snoise(vec2 v){
|
||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
||||
-0.577350269189626, 0.024390243902439);
|
||||
vec2 i = floor(v + dot(v, C.yy) );
|
||||
vec2 x0 = v - i + dot(i, C.xx);
|
||||
vec2 i1;
|
||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
||||
vec4 x12 = x0.xyxy + C.xxzz;
|
||||
x12.xy -= i1;
|
||||
i = mod(i, 289.0);
|
||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
||||
dot(x12.zw,x12.zw)), 0.0);
|
||||
m = m*m ;
|
||||
m = m*m ;
|
||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
||||
vec3 h = abs(x) - 0.5;
|
||||
vec3 ox = floor(x + 0.5);
|
||||
vec3 a0 = x - ox;
|
||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
||||
vec3 g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
return 130.0 * dot(m, g);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 c = v_texCoord.xy;
|
||||
vec4 color = texture2D(u_texture, c);
|
||||
|
||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
||||
|
||||
float stime = time / 5.0;
|
||||
|
||||
float mscl = 30.0;
|
||||
float mth = 5.0;
|
||||
|
||||
//if there's something actually there
|
||||
if(color.r > 0.01){
|
||||
vec4 old = color;
|
||||
color = texture2D(u_texture, c + vec2(sin(stime/3.0 + coords.y/0.75) * v.x, 0.0)) * vec4(0.9, 0.9, 1, 1.0);
|
||||
color.a = 1.0;
|
||||
|
||||
if(color.r < 0.01){
|
||||
color = old;
|
||||
}
|
||||
|
||||
float n1 = snoise(coords / 22.0 + vec2(-time) / 540.0);
|
||||
float n2 = snoise((coords + vec2(632.0)) / 8.0 + vec2(0.0, time) / 510.0);
|
||||
|
||||
float r = (n1 + n2) / 2.0;
|
||||
|
||||
if(r < -0.3 && r > -0.6){
|
||||
color *= 1.4;
|
||||
color.a = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec2 u_texsize;
|
||||
uniform float u_time;
|
||||
uniform vec2 u_offset;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 T = v_texCoord.xy;
|
||||
vec2 coords = (T * u_texsize) + u_offset;
|
||||
|
||||
float si = 1.0 + sin(u_time / 20.0 /*+ (coords.x + coords.y) / 30.0*/) / 8.0;
|
||||
|
||||
vec4 color = texture2D(u_texture, T) * vec4(si, si, si, 1.0);
|
||||
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
bool any = false;
|
||||
|
||||
float thickness = 1.0;
|
||||
float step = 1.0;
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.1 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.1))
|
||||
any = true;
|
||||
|
||||
if(any){
|
||||
gl_FragColor = u_color * vec4(si, si, si, 1.0);
|
||||
}else{
|
||||
|
||||
//coords.x = float(int(coords.x));
|
||||
if(color.a > 0.1){
|
||||
float x = coords.x;
|
||||
float y = coords.y;
|
||||
float time = u_time;
|
||||
float w = 1.0;
|
||||
float h = 1.0;
|
||||
float f1 = sin(2.0*time+(y/4.0*cos(time/3.0)+(x/2.0)-w/4.0)*((y/3.0)-h/4.0)/w);
|
||||
float f2 = -2.0*cos(11.0*time/9.0-11.0*pow(y, x)/9.0);
|
||||
|
||||
color.r = (f2 + f1) / 4.0*abs(cos(2.0*(x-y)/w + time));
|
||||
color.g = (f2 + f1) /(3.0 + color.r);
|
||||
color.b = (f2 + f1) /(2.5 + color.g);
|
||||
|
||||
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
#define s1 vec4(63.0, 63.0, 63.0, 255.0) / 255.0
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 u_center;
|
||||
uniform vec2 camerapos;
|
||||
uniform vec2 screensize;
|
||||
uniform float time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
float round(float num, float f){
|
||||
return float(int(num / f)) * f;
|
||||
}
|
||||
|
||||
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
|
||||
|
||||
float snoise(vec2 v){
|
||||
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
||||
-0.577350269189626, 0.024390243902439);
|
||||
vec2 i = floor(v + dot(v, C.yy) );
|
||||
vec2 x0 = v - i + dot(i, C.xx);
|
||||
vec2 i1;
|
||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
||||
vec4 x12 = x0.xyxy + C.xxzz;
|
||||
x12.xy -= i1;
|
||||
i = mod(i, 289.0);
|
||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy),
|
||||
dot(x12.zw,x12.zw)), 0.0);
|
||||
m = m*m ;
|
||||
m = m*m ;
|
||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
||||
vec3 h = abs(x) - 0.5;
|
||||
vec3 ox = floor(x + 0.5);
|
||||
vec3 a0 = x - ox;
|
||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
||||
vec3 g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
return 130.0 * dot(m, g);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 c = v_texCoord.xy;
|
||||
vec4 color = texture2D(u_texture, c);
|
||||
|
||||
vec2 v = vec2(1.0/screensize.x, 1.0/screensize.y);
|
||||
ivec2 icoords = ivec2(int(c.x / v.x + camerapos.x), int(c.y / v.y + camerapos.y));
|
||||
vec2 coords = vec2(float(icoords.x), float(icoords.y));
|
||||
|
||||
float stime = time / 5.0;
|
||||
|
||||
float mscl = 30.0;
|
||||
float mth = 5.0;
|
||||
|
||||
//if there's something actually there
|
||||
if(color.a > 0.01){
|
||||
vec2 diff = camerapos + screensize/2.0 - u_center;
|
||||
|
||||
float dst = mod((distance(coords, camerapos + screensize/2.0 - diff/5.0) + time * 2.0 + snoise(coords / 100.0) * 10.0), 150.0);
|
||||
|
||||
if(dst < 40.0){
|
||||
color = vec4(vec3(0.2), 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision highp float;
|
||||
precision mediump int;
|
||||
#endif
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform vec2 u_center;
|
||||
uniform vec2 camerapos;
|
||||
uniform vec2 screensize;
|
||||
uniform float time;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const float tau = 6.28318530717958647692;
|
||||
const float tscl = 0.4;
|
||||
|
||||
// Gamma correction
|
||||
#define GAMMA (2.2)
|
||||
|
||||
vec3 ToLinear(vec3 col ){
|
||||
// simulate a monitor, converting colour values into light values
|
||||
return pow( col, vec3(GAMMA) );
|
||||
}
|
||||
|
||||
vec3 ToGamma(vec3 col ){
|
||||
// convert back into colour values, so the correct light will come out of the monitor
|
||||
return pow( col, vec3(1.0/GAMMA) );
|
||||
}
|
||||
|
||||
float srand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
vec4 Noise(ivec2 x ){
|
||||
return vec4(srand((vec2(x)+0.5)/256.0));
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec4 resultc = texture2D(u_texture, v_texCoord.xy);
|
||||
|
||||
if(resultc.a > 0.0){
|
||||
|
||||
vec2 coords = v_texCoord.xy*screensize;
|
||||
|
||||
vec3 ray;
|
||||
ray.xy = 2.0*(coords-screensize.xy*.5)/screensize.x;
|
||||
ray.z = 1.0;
|
||||
|
||||
float literallyzero = 0.000000000001;
|
||||
|
||||
float offset = time/60.0*.5 * tscl + camerapos.x * u_center.x * resultc.r * literallyzero;
|
||||
float speed2 = 0.3;
|
||||
float speed = speed2+.1;
|
||||
offset += .1;
|
||||
offset *= 2.0;
|
||||
|
||||
vec3 col = vec3(0.0);
|
||||
|
||||
vec3 stp = ray/max(abs(ray.x),abs(ray.y));
|
||||
|
||||
vec3 pos = 2.0*stp+.5;
|
||||
for ( int i=0; i < 20; i++){
|
||||
float z = Noise(ivec2(pos.xy)).x;
|
||||
z = fract(z-offset);
|
||||
float d = 50.0*z-pos.z;
|
||||
float w = pow(max(0.0,1.0-8.0*length(fract(pos.xy)-.5)),2.0);
|
||||
vec3 c = max(vec3(0),vec3(1.0-abs(d+speed2*.5)/speed,1.0-abs(d)/speed,1.0-abs(d-speed2*.5)/speed));
|
||||
col += 1.5*(1.0-z)*c*w;
|
||||
pos += stp;
|
||||
}
|
||||
|
||||
vec3 color = ToGamma(col);
|
||||
|
||||
if(color.r > 0.3 && color.b > 0.3){
|
||||
color = vec3(240.0, 245.0, 255.0) / 255.0;
|
||||
}else{
|
||||
color = vec3(0.0);
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
}else{
|
||||
gl_FragColor = vec4(0.0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,22 +17,19 @@ uniform vec2 u_texsize;
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
bool id(vec4 v){
|
||||
return v.a > 0.1;
|
||||
}
|
||||
#define SPACE 0.75
|
||||
#define RADIUS 5.0
|
||||
|
||||
bool id(vec2 coords, vec4 base){
|
||||
vec4 target = texture2D(u_texture, coords);
|
||||
return target.a < 0.1 || (coords.x < u_uv.x || coords.y < u_uv.y || coords.x > u_uv2.x || coords.y > u_uv2.y);
|
||||
}
|
||||
bool cont(vec2 t, vec2 v){
|
||||
|
||||
bool cont(vec2 T, vec2 v){
|
||||
vec4 base = texture2D(u_texture, T);
|
||||
return base.a > 0.1 &&
|
||||
(id(T + vec2(0, step) * v, base) || id(T + vec2(0, -step) * v, base) ||
|
||||
id(T + vec2(step, 0) * v, base) || id(T + vec2(-step, 0) * v, base) ||
|
||||
id(T + vec2(step, step) * v, base) || id(T + vec2(-step, -step) * v, base) ||
|
||||
id(T + vec2(step, -step) * v, base) || id(T + vec2(-step, step) * v, base));
|
||||
for(float cx = -RADIUS; cx <= RADIUS; cx ++){
|
||||
for(float cy = -RADIUS; cy <= RADIUS; cy ++){
|
||||
if(cx*cx + cy*cy <= RADIUS * RADIUS && texture2D(u_texture, v_texCoord.xy + vec2(cx, cy) * v * SPACE).a <= 0.001){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void main() {
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
uniform float u_time;
|
||||
|
||||
float round(float f, float v){
|
||||
return float(int(f / v)) * v;
|
||||
}
|
||||
|
||||
void main(){
|
||||
vec2 r = v_texCoords.xy;
|
||||
vec4 c = v_color * texture2D(u_texture, v_texCoords.xy);
|
||||
gl_FragColor = c * vec4(vec3(round(1.0 + sin((r.x + r.y) * 404.0 + u_time / 20.0) / 10.0, 0.05)), 1.0);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Reference in New Issue
Block a user